AI Token Analytics

See where your AI
tokens actually go.

Track token usage across Claude Code, Codex, and Open Code.Beautiful heatmaps, deep analytics, 100% local.

Privacy-first/Multi-provider/Open source
tokenleak — zsh
tokenleak terminal dashboard — Claude Code heatmap with 855M tokens, $1482 cost, 98.5% cache hit rate

How it works

Three steps. That's it.

01

Install

One command. Works with npx for a one-off run, or install globally with bun/npm.

$npx tokenleak
# or: bun install -g tokenleak
02

Run

tokenleak auto-detects Claude Code, Codex, and Open Code from your local config directories. No setup required.

$tokenleak
# interactive launcher opens in TTY
03

Get your dashboard

A full terminal dashboard appears — heatmap, streaks, cost, cache hit rate, model breakdown, and more. Export to SVG, PNG, or JSON anytime.

$tokenleak --format svg -o usage.svg
# or share with --upload gist

Features

Everything you need to know
about your token spend.

100% Local

Your data never leaves your machine. tokenleak reads local logs only — no APIs, no telemetry, no cloud.

Multi-Provider

Automatically detects Claude Code, Codex, and Open Code. One unified dashboard for all your AI coding tools.

Beautiful Output

Terminal dashboards with ANSI heatmaps, self-contained SVGs, PNG cards, and structured JSON. Dark and light themes.

Deep Analytics

Streaks, rolling windows, peak days, cache economics, day-of-week and hour-of-day breakdowns, session stats, projected monthly burn, and model rankings.

Compare Ranges

Auto-split or pick custom date ranges with --compare. See deltas across tokens, cost, streaks, active days, cache hit rate, and model mix.

Share Anywhere

Copy to clipboard, open in your default app, or upload to GitHub Gist with --upload gist. One command, shared everywhere.

Gallery

Every provider. Every theme.

Claude Code, Codex, and Open Code — all in one view. Switch between dark and light themes, or focus on a single provider.

tokenleak — zsh
tokenleak terminal dashboard — Claude Code single provider dark theme

Compare Mode

See how your usage changed over time.

Split your date range in half automatically, or specify two custom periods. tokenleak computes deltas across every metric — tokens, cost, streaks, cache hit rate, and model mix.

# auto-split: compares last 60 days vs prior 60
$tokenleak --days 120 --compare auto
# custom range comparison
$tokenleak --compare 2025-01-01..2025-03-31
Metric
Current
Δ vs Prior
Total tokens+127M
Total cost+$284
Active days+8 days
Current streak+3 days
Avg daily tokens+4.2M
Cache hit rate-0.4%

Output: currentPeriod · previousPeriod · deltas

Output Formats

Terminal. SVG. PNG. JSON.

--format terminal

Terminal

  • GitHub-style heatmap (░▒▓█)
  • Streaks, cache rate, cost panel
  • Day-of-week + hour-of-day bars
  • Adapts to terminal width
--format svg

SVG

  • Self-contained, no dependencies
  • Embeds in READMEs and docs
  • Dark and light themes
  • Badge variant for streak counts
--format png

PNG

  • High-resolution via sharp
  • 1200×630 wrapped year card
  • Perfect for social sharing
  • --upload gist in one command
--format json

JSON

  • Schema-versioned output
  • Daily usage per provider
  • All aggregated stats
  • Pipe into your own tools
tokenleak · share
tokenleak shareable card — light theme showing Claude Code and Codex heatmaps with total stats

Export & Share

One command to share everywhere.

Export your usage as a shareable PNG card, self-contained SVG, or structured JSON — then send it anywhere in one step.

--upload gistUpload to a GitHub Gist via gh CLI
--clipboardCopy rendered output straight to your clipboard
--openOpen the output file in your default application
-o card.pngSave as a high-resolution PNG — perfect for social

AI Wrapped

Your year in tokens, laid bare.

A 12-slide interactive presentation of your Claude Code & Codex sessions — streaks, peak days, model breakdowns, cache efficiency, and more. Obsidian dark, aged gold. Zero fluff.

01 / 12 · Intro

AI
Wrapped
'25

01Big Numbers
14.2M tokens · $241
04Top Models
claude-opus-4 · 58%
06Day of Week
Tuesday peaks
08Cache Mastery
60% hit rate
10Achievements
8 of 10 unlocked
+7 MORE SLIDES
TokenLeakBuilt with TokenLeak

Providers

All your tools. One view.

C

Claude Code

~/.claude/projects/*/*.jsonl

Reads JSONL conversation logs. Parses every assistant message with a usage field for input, output, and cache token counts.

Auto-detected
C

Codex

~/.codex/sessions/YYYY/MM/DD/

Reads JSONL session logs. Parses response events for token usage with cumulative delta extraction.

Auto-detected
O

Open Code

~/.local/share/opencode/storage/

Reads from the primary message storage, with SQLite database and legacy JSON session fallback.

Auto-detected
0
Providers
0+
Models Priced
0
Output Formats
0
Data Sent

Get Started

Up and running in seconds.

terminal
# Run directly with npx
$npx tokenleak
# Export as SVG heatmap
$tokenleak --format svg -o usage.svg
# Compare last 60 days vs prior 60
$tokenleak --days 120 --compare auto
# PNG card — upload to GitHub Gist
$tokenleak -o card.png --upload gist
# Copy JSON report to clipboard
$tokenleak --format json --clipboard
# Filter to Claude Code, light theme
$tokenleak --provider claude-code --theme light

Or install globally: bun install -g tokenleak

Get started

Ready to see
your tokens?

No account, no API keys, no data leaving your machine. Just run one command and see exactly where your AI spend is going.

View on GitHub

Or install globally with bun install -g tokenleak