claude-usage

skill
Security Audit
Warn
Health Pass
  • License — License: MIT
  • Description — Repository has a description
  • Active repo — Last push 0 days ago
  • Community trust — 226 GitHub stars
Code Warn
  • network request — Outbound network request in dashboard.py
Permissions Pass
  • Permissions — No dangerous permissions requested
Purpose
This tool is a local dashboard that reads Claude Code JSONL log files to track your token usage, session history, and cost estimates across API, Pro, and Max plans. It serves an interactive web page on your local machine via a built-in Python HTTP server.

Security Assessment
Risk Rating: Low. The tool accesses local files, specifically reading JSONL logs inside `~/.claude/projects/` and writing to a local SQLite database (`~/.claude/usage.db`). It does not request dangerous system permissions, execute arbitrary shell commands, or contain hardcoded secrets. The only outbound network request detected is its use of the local HTTP server to load the Chart.js library from a CDN to render the dashboard UI. It is entirely built using Python's standard library, requiring no third-party packages, and does not transmit your usage data externally.

Quality Assessment
Quality is Good. The project uses the permissive MIT license and is actively maintained, with repository updates pushed as recently as today. It has generated positive community trust, currently sitting at 226 GitHub stars. The codebase is lightweight, transparent, and specifically designed to run without complex virtual environments or external dependencies.

Verdict
Safe to use.
SUMMARY

A local dashboard for tracking your Claude Code token usage, costs, and session history. Pro and Max subscribers get a progress bar. This gives you the full picture.

README.md

Claude Code Usage Dashboard

License: MIT
claude-code

Pro and Max subscribers get a progress bar. This gives you the full picture.

Claude Code writes detailed usage logs locally — token counts, models, sessions, projects — regardless of your plan. This dashboard reads those logs and turns them into charts and cost estimates. Works on API, Pro, and Max plans.

Claude Usage Dashboard

Created by: The Product Compass Newsletter


What this tracks

Works on API, Pro, and Max plans — Claude Code writes local usage logs regardless of subscription type. This tool reads those logs and gives you visibility that Anthropic's UI doesn't provide.

Captures usage from:

  • Claude Code CLI (claude command in terminal)
  • VS Code extension (Claude Code sidebar)
  • Dispatched Code sessions (sessions routed through Claude Code)

Not captured:

  • Cowork sessions — these run server-side and do not write local JSONL transcripts

Requirements

  • Python 3.8+
  • No third-party packages — uses only the standard library (sqlite3, http.server, json, pathlib)

Anyone running Claude Code already has Python installed.

Quick Start

No pip install, no virtual environment, no build step.

Windows

git clone https://github.com/phuryn/claude-usage
cd claude-usage
python cli.py dashboard

macOS / Linux

git clone https://github.com/phuryn/claude-usage
cd claude-usage
python3 cli.py dashboard

Usage

On macOS/Linux, use python3 instead of python in all commands below.

# Scan JSONL files and populate the database (~/.claude/usage.db)
python cli.py scan

# Show today's usage summary by model (in terminal)
python cli.py today

# Show all-time statistics (in terminal)
python cli.py stats

# Scan + open browser dashboard at http://localhost:8080
python cli.py dashboard

The scanner is incremental — it tracks each file's path and modification time, so re-running scan is fast and only processes new or changed files.


How it works

Claude Code writes one JSONL file per session to ~/.claude/projects/. Each line is a JSON record; assistant-type records contain:

  • message.usage.input_tokens — raw prompt tokens
  • message.usage.output_tokens — generated tokens
  • message.usage.cache_creation_input_tokens — tokens written to prompt cache
  • message.usage.cache_read_input_tokens — tokens served from prompt cache
  • message.model — the model used (e.g. claude-sonnet-4-6)

scanner.py parses those files and stores the data in a SQLite database at ~/.claude/usage.db.

dashboard.py serves a single-page dashboard on localhost:8080 with Chart.js charts (loaded from CDN). It auto-refreshes every 30 seconds and supports model filtering with bookmarkable URLs.


Cost estimates

Costs are calculated using Anthropic API pricing as of April 2026 (claude.com/pricing#api).

Only models whose name contains opus, sonnet, or haiku are included in cost calculations. Local models, unknown models, and any other model names are excluded (shown as n/a).

Model Input Output Cache Write Cache Read
claude-opus-4-6 $6.15/MTok $30.75/MTok $7.69/MTok $0.61/MTok
claude-sonnet-4-6 $3.69/MTok $18.45/MTok $4.61/MTok $0.37/MTok
claude-haiku-4-5 $1.23/MTok $6.15/MTok $1.54/MTok $0.12/MTok

Note: These are API prices. If you use Claude Code via a Max or Pro subscription, your actual cost structure is different (subscription-based, not per-token).


Files

File Purpose
scanner.py Parses JSONL transcripts, writes to ~/.claude/usage.db
dashboard.py HTTP server + single-page HTML/JS dashboard
cli.py scan, today, stats, dashboard commands

Reviews (0)

No results found