GitHub-style contribution heatmap for your AI coding tool usage. Supports Claude Code, Codex, OpenCode & Cursor.
Project description
tokenmap
Your AI coding stats, visualized.
A GitHub-style contribution heatmap that shows how much you actually use AI coding tools. One command. Auto-detected. Shareable.
pip install tokenmap
tokenmap
That's it. It reads your local data, renders a heatmap in your terminal, and exports a shareable PNG.
Supported Tools
| Tool | Data Source | What's Tracked |
|---|---|---|
| Claude Code | ~/.claude/stats-cache.json |
Tokens, models, sessions, costs |
| Codex CLI | ~/.codex/sessions/*.jsonl |
Tokens, models, session durations |
| OpenCode | ~/.local/share/opencode/ |
Tokens, models, messages |
| Cursor | Cursor API + local state.vscdb |
Tokens, models, usage events |
tokenmap auto-detects which tools you have installed. No configuration needed.
Install
pip install tokenmap
Requires Python 3.10+.
System Dependencies
For PNG export, you need Cairo installed:
# macOS
brew install cairo
# Ubuntu/Debian
sudo apt install libcairo2-dev
# Fedora
sudo dnf install cairo-devel
Usage
# Basic — auto-detect all tools, export PNG
tokenmap
# Add your name to the heatmap
tokenmap --user yourname
# Filter to a specific tool
tokenmap --claude
tokenmap --codex
tokenmap --cursor
tokenmap --opencode
# Filter to a specific year
tokenmap --year 2025
# Change the color theme
tokenmap --theme dark-green
# Export as SVG instead of PNG
tokenmap --export svg
# Custom output path
tokenmap --out ~/Desktop/my-ai-usage.png
# Terminal only, no file export
tokenmap --no-export
# Copy PNG to clipboard (macOS/Linux/Windows)
tokenmap --copy
# Dump raw stats as JSON (for scripting)
tokenmap --json
# Show estimated cost breakdown by model
tokenmap --cost
tokenmap --claude --cost
# See all themes
tokenmap --list-themes
Themes
10 built-in themes — 5 light, 5 dark:
| Dark | Light |
|---|---|
dark-ember |
green (default) |
dark-green |
purple |
dark-purple |
blue |
dark-blue |
amber |
dark-mono |
mono |
Options
| Flag | Description | Default |
|---|---|---|
--user <name> |
Username shown on the heatmap | — |
--claude |
Include only Claude Code data | — |
--codex |
Include only Codex data | — |
--opencode |
Include only OpenCode data | — |
--cursor |
Include only Cursor data | — |
--theme <name> |
Color theme | green |
--export <fmt> |
Export format: png or svg |
png |
--no-export |
Skip file export, terminal only | — |
--out <path> |
Custom output file path | tokenmap.png |
--copy |
Copy PNG to clipboard after export | — |
--year <year> |
Filter to a specific year | last 365 days |
--json |
Output raw stats as JSON | — |
--cost |
Show estimated cost breakdown by model | — |
--list-themes |
Show all available themes | — |
Programmatic Usage
from tokenmap import aggregate_multi, render_terminal, render_svg, compute_stats
from tokenmap.types import RenderOptions
# Load data from all detected tools
panels = aggregate_multi()
# Render to terminal
render_terminal(panels, RenderOptions(theme="dark-green", user="myname"))
# Generate SVG
svg_string = render_svg(panels, RenderOptions(theme="dark-green", user="myname"))
# Access raw stats
for panel in panels:
print(f"{panel.tool}: {panel.stats.total_tokens} tokens")
How It Works
tokenmap reads locally stored data from your AI coding tools. It never sends data anywhere — everything stays on your machine.
- Detect — scans for installed tool data directories
- Aggregate — merges token usage, sessions, and model stats across tools
- Render — generates a terminal heatmap + exportable image
- Export — saves a high-res PNG/SVG with stats panel
Privacy
- All data is read locally from your filesystem
- Nothing is uploaded or transmitted
- The only network request is Cursor's API (to fetch your own usage CSV, using your local auth token) — and even that's optional with a loca
Attribution
This project is a Python port of tokenviz by Harsh Kedia. Original source: https://github.com/harshkedia177/tokenviz
Licensed under MIT. Original copyright retained.
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tokenmap-0.1.1.tar.gz.
File metadata
- Download URL: tokenmap-0.1.1.tar.gz
- Upload date:
- Size: 38.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ad118afa7c4c771577e3bb6e633496962138596267fbec9e6ca430f3e2c508ab
|
|
| MD5 |
53d218f331a075b41e2dab7136f08191
|
|
| BLAKE2b-256 |
650b7bffdbb4d37f793f9b2fc8011d08480be1d9333eb9ee32f9f0a16e112501
|
Provenance
The following attestation bundles were made for tokenmap-0.1.1.tar.gz:
Publisher:
publish.yml on akshatshaw/tokenmap
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tokenmap-0.1.1.tar.gz -
Subject digest:
ad118afa7c4c771577e3bb6e633496962138596267fbec9e6ca430f3e2c508ab - Sigstore transparency entry: 1338814960
- Sigstore integration time:
-
Permalink:
akshatshaw/tokenmap@fcac7e150e60b17802166f426bd092d0e11820db -
Branch / Tag:
refs/tags/latest - Owner: https://github.com/akshatshaw
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@fcac7e150e60b17802166f426bd092d0e11820db -
Trigger Event:
release
-
Statement type:
File details
Details for the file tokenmap-0.1.1-py3-none-any.whl.
File metadata
- Download URL: tokenmap-0.1.1-py3-none-any.whl
- Upload date:
- Size: 42.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c343fcf2130c60dbe5b634ff94c0bba8645eb3c5c7b4f4c3a963f1c2f8cb0eef
|
|
| MD5 |
82790018a9705b8cab87a67f480c75d0
|
|
| BLAKE2b-256 |
5c6184ffd1a523b38de54b96efde72349ad735a7bdc283be864832ee4ee7e9dd
|
Provenance
The following attestation bundles were made for tokenmap-0.1.1-py3-none-any.whl:
Publisher:
publish.yml on akshatshaw/tokenmap
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tokenmap-0.1.1-py3-none-any.whl -
Subject digest:
c343fcf2130c60dbe5b634ff94c0bba8645eb3c5c7b4f4c3a963f1c2f8cb0eef - Sigstore transparency entry: 1338814964
- Sigstore integration time:
-
Permalink:
akshatshaw/tokenmap@fcac7e150e60b17802166f426bd092d0e11820db -
Branch / Tag:
refs/tags/latest - Owner: https://github.com/akshatshaw
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@fcac7e150e60b17802166f426bd092d0e11820db -
Trigger Event:
release
-
Statement type: