Claude Code Token Meter banner
itchernetski itchernetski

Claude Code Token Meter

Development community

Description

Local-first dashboard for Claude Code token usage. Parses ~/.claude/projects/*.jsonl and serves an interactive viewer on localhost. No API calls.

Installation

This entry records only its repository, not the path inside it, so there is no exact command to give. Open the source below and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

README

claude-code-token-meter

Local-first dashboard for [Claude Code](https://claude.com/claude-code) token usage. Parses your local session logs (`~/.claude/projects/*/*.jsonl`) and serves an interactive viewer on `localhost`. **No API calls. Zero tokens spent on viewing.**

![screenshot](docs/screenshot.png)

Why

Claude Code writes a JSONL log per session under `~/.claude/projects/`. Those files contain everything you need to understand your usage — input, output, cache-read and cache-create tokens per message — but there's no built-in way to explore them.

This tool parses them, aggregates per session, and exposes:

  • Daily breakdown — weighted tokens per day
  • Project breakdown — share of usage by project
  • Model share — opus / sonnet / haiku split
  • Top 30 sessions — biggest individual sessions, with the rest collapsed into a single "other sessions beyond top 30" line
  • Date filter — 24h / 3d / 7d / 14d / 30d, switched without page reload
  • Burn rate — rolling 5h / 24h / 7d weighted totals + 24h hourly sparkline
  • Quota calibration — anchor the dashboard to your plan via the /usage % you see in Claude Code (see below); also auto-calibrates from clustered rate-limit hits stored locally
  • Theme + lang — light / dark, EN / RU, persisted in localStorage

The "weighted" number uses Anthropic's published cost ratios as a proxy:

weighted = input × 1 + output × 5 + cache_create × 1.25 + cache_read × 0.1

It's not a literal subscription-quota percentage (Anthropic doesn't publish that formula), but it gives the right *relative* ranking of sessions and days.

Install

Requires Python 3.10+.

pipx install claude-code-token-meter

Or from source:

git clone https://github.com/itchernetski/claude-code-token-meter.git
cd claude-code-token-meter
python -m venv .venv
source .venv/bin/activate
pip install -e .

Run

claude-code-token-meter
claude-code-token-meter --port 8000
PORT=8000 claude