Skip to content
Projects

About

Your AI coding token usage as an animated pixel badge for your GitHub profile. No server, no cost.

Developer Tools

How these counts are measured

Measured star growth

in 24h
Collecting history
in 7 days
Collecting history
in 15 days
Collecting history
in 1 month
Collecting history

Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.

README.md

Original

TOCHI and BURNIE, the tokenfire mascots

TOKENFIRE TOKENFIRE

tokenfire

Your AI coding token usage, as an animated pixel badge for your GitHub profile.
Counts tokens from Claude Code and Codex on your machine. No server, no cost.

No Server, No Cost Latest version License: MIT OR Apache-2.0 Platform: macOS, Linux, Windows GitHub stars GitHub forks

English · 한국어 · 日本語 · 简体中文 · 繁體中文
Quick Start · Gallery · Add to README · FAQ

The author's live tokenfire scene card The author's live tokenfire scene card

  • Counts tokens from Claude Code and Codex on your machine.
  • A mascot grows through 11 levels as your all-time total rises.
  • No server, no cost. Badges live in your own GitHub gists and update four times a day.
  • A dynamic badge follows the time of day: dawn, day, dusk and night.
  • Prompts, code and file paths never leave your machine. See Privacy for exactly what is uploaded.

The card at the top is the author's real badge, updated four times a day. The gallery below uses example data.

Contents

Gallery

There are four themes, each in light and dark. All four are uploaded on every sync, so you can switch any time by changing one URL.

Images below are shown at their real size relative to each other.

scene-card (846×225): mascot, a year of daily activity and your streak

scene-card

compact (336×64): one small line

compact

kiln-gauge (448×146): progress to the next level

kiln-gauge

achievement-card (504×174): level, total and streak seal

achievement-card

Dynamic badge

Every theme also comes as a dynamic file (<theme>-dynamic.svg). Its sky changes with the time of the last sync, in your computer's time zone.

Dawn (06–12) Day (12–18)
scene-card at dawn scene-card in the day
Dusk (18–22) Night (22–06)
scene-card at dusk scene-card at night

The regular light and dark files use the day sky and the night sky, so they follow GitHub's light and dark mode instead.

Mascots

Pick one. TOCHI (default) is an orange flame boy. BURNIE is a pastel pink flame girl with a ribbon.

TOCHI and BURNIE from Lv.0 to Lv.10

Quick start

# 1. Install with Homebrew on macOS or Linux (also installs the GitHub CLI)
#    Windows, or no Homebrew? See "Install" below.
brew install keemtj/tap/tokenfire

# 2. Log in to GitHub with gist permission
gh auth login --scopes gist

# 3. Preview locally. Nothing is uploaded.
tokenfire sync --dry-run

# 4. Create your gists and get a README snippet
tokenfire sync

# 5. Update four times a day
tokenfire schedule on

Paste the snippet from step 4 into your profile README. Done.

Install

Requirements

What Why
macOS, Linux or Windows macOS 11 or later, Linux on x86_64 or arm64 (WSL included), or Windows 10/11 on x86_64.
GitHub CLI (gh) tokenfire asks gh for a token each time it uploads. It never stores the token. Homebrew and Scoop install it for you. With the other methods, install it yourself (cli.github.com).
Claude Code / Codex The source of your usage logs. Install tokenfire where they run. If you use them inside WSL, install tokenfire inside WSL too.

Choose an install method

Method You need Installs gh Good for
Homebrew (recommended) Homebrew on macOS or Linux Yes Most people on macOS and Linux. No Rust needed.
Scoop Scoop on Windows Yes Windows (PowerShell, Command Prompt or Git Bash)
Install script curl No Linux without Homebrew
Cargo Rust (rustup.rs) No People who already use Rust
From source Rust and Git No Contributors

Use one method only. Each method below lists how to install, update and remove tokenfire. After any update, run tokenfire sync once. It uploads badges in the new design and updates the schedule if it changed. Your README snippet keeps working.

Homebrew (recommended)

Works on macOS and on Linux (including WSL) with Homebrew on Linux.

brew install keemtj/tap/tokenfire   # install (also installs gh)
brew upgrade tokenfire              # update
brew uninstall tokenfire            # remove

Scoop (Windows)

Run in PowerShell. Afterwards tokenfire works in PowerShell, Command Prompt and Git Bash.

scoop bucket add keemtj https://github.com/keemtj/homebrew-tap
scoop install keemtj/tokenfire      # install (also installs gh)
scoop update tokenfire              # update
scoop uninstall tokenfire           # remove

Install script (Linux and macOS)

Downloads the latest release, checks its checksum and puts tokenfire in ~/.local/bin. Run the same line again to update.

curl -fsSL https://raw.githubusercontent.com/keemtj/tokenfire/main/install.sh | sh   # install or update
rm ~/.local/bin/tokenfire                                                              # remove

Set TOKENFIRE_INSTALL_DIR to install somewhere else, or TOKENFIRE_VERSION=1.3.0 to pick a version. Install gh yourself (cli.github.com).

Cargo

cargo install tokenfire             # install (then install gh from cli.github.com)
cargo install tokenfire --force     # update
cargo uninstall tokenfire           # remove

From source

git clone https://github.com/keemtj/tokenfire.git
cd tokenfire
cargo install --path crates/tokenfire            # install
git pull && cargo install --path crates/tokenfire --force   # update
cargo uninstall tokenfire                        # remove

Switching methods

Remove the old copy first, then install the new one and run tokenfire schedule on once so the schedule points to the new copy. For example, from Cargo to Homebrew:

cargo uninstall tokenfire
brew install keemtj/tap/tokenfire
tokenfire schedule on

Check which copy runs with which tokenfire (where tokenfire on Windows) and tokenfire --version.

Log in to GitHub

gh auth login --scopes gist

Already logged in? Add the gist scope with gh auth refresh --scopes gist.

Set up your badge

1. Pick a mascot (optional)

tokenfire mascot burnie   # or: tokenfire mascot tochi (default)

2. Preview locally

tokenfire sync --dry-run --out ./tokenfire-preview

This reads your logs and writes all badges and profile.json into ./tokenfire-preview. Open the SVG files in a browser. No gist is created or changed.

3. Create your gists

Run this in a terminal, because it asks for your consent first:

tokenfire sync

tokenfire creates two gists under your account:

Gist Visibility Contents
Badge gist Public 8 theme SVGs, 4 dynamic SVGs, 4 legacy aliases, profile.json
Ledger gist Secret (unlisted) Your ledger: daily token counts per model, a random device ID and your UTC offset. A backup of your history.

At the end it prints a snippet for your README.

Already answered the question once and want to script it? tokenfire sync --yes allows creating the public gist without asking.

Add it to your profile README

Your profile README is the README.md in the repository named after your username (<you>/<you>). If you don't have one, create it.

Print a snippet for the theme you want:

tokenfire snippet                          # scene card
tokenfire snippet --theme compact
tokenfire snippet --theme kiln-gauge
tokenfire snippet --theme achievement-card
tokenfire snippet --dynamic                # one dynamic badge (see below)

It looks like this. GitHub shows the first line in light mode and the second line in dark mode, and clicking the badge takes readers to the tokenfire repository.

[![tokenfire: Lv.5 High Bonfire, 34,567,890,123 tokens burned](https://gist.githubusercontent.com/<you>/<gist-id>/raw/scene-card-light.svg#gh-light-mode-only)](https://github.com/keemtj/tokenfire)
[![tokenfire: Lv.5 High Bonfire, 34,567,890,123 tokens burned](https://gist.githubusercontent.com/<you>/<gist-id>/raw/scene-card-dark.svg#gh-dark-mode-only)](https://github.com/keemtj/tokenfire)

Prefer the badge that follows the time of day? tokenfire snippet --dynamic prints one line instead:

[![tokenfire: Lv.5 High Bonfire, 34,567,890,123 tokens burned](https://gist.githubusercontent.com/<you>/<gist-id>/raw/scene-card-dynamic.svg)](https://github.com/keemtj/tokenfire)

To switch themes later, replace scene-card in the URLs with another theme name. You don't need to sync again.

Tips:

  • Keep the URLs without a commit hash (/raw/<file>). Then the badge always points to the newest version.
  • Keep the #gh-light-mode-only and #gh-dark-mode-only endings. Without them, readers see both images.
  • Want it smaller? Use an HTML tag instead, for example <img src="…/scene-card-light.svg#gh-light-mode-only" width="420">.
  • The alt text is fixed at the moment you paste it. Run tokenfire snippet again to get a fresh one if you like.
  • Snippets from version 1.0 (with <picture>) keep working.

Auto sync

tokenfire schedule on

This runs tokenfire sync --non-interactive four times a day, at 06:00, 12:00, 18:00 and 22:00. These are the times when the dynamic badge's sky changes. If your computer is asleep or off at one of those times, the run happens when it is back. If the network is not ready yet, it tries again after 30 seconds, 2 minutes and 5 minutes. A scheduled run never asks questions and never creates gists. It only updates the ones you already have.

OS Registered with Check it
macOS launchd (~/Library/LaunchAgents/local.tokenfire.sync.plist) launchctl list | grep tokenfire
Linux systemd user timer (~/.config/systemd/user/tokenfire-sync.timer). Without systemd, one line in your crontab. systemctl --user list-timers tokenfire-sync.timer or crontab -l
Windows Task Scheduler (task tokenfire-sync) schtasks /Query /TN tokenfire-sync

On every OS the log is in ~/.tokenfire/logs/sync.log, and tokenfire status shows the next run.

  • WSL: some setups have systemd turned off. tokenfire then uses cron if it is installed. If neither is available, tokenfire schedule on explains how to turn systemd on (systemd=true under [boot] in /etc/wsl.conf, then wsl --shutdown). WSL only runs while it is open, so a run missed while it was closed happens the next time it starts.
  • Windows: a console window may flash for a moment when a scheduled sync starts.

Updating from 1.0? Run tokenfire sync once in a terminal (or tokenfire schedule on again). It moves the old 04:00 schedule to the new times.

Turn it off with tokenfire schedule off.

Several computers? Right now one badge comes from one machine. Merging usage from several machines into one badge is planned.

Levels

The level is based on your all-time total tokens: input, output and cache tokens combined, summed across Claude Code and Codex.

Level Stage Total tokens
0 Cold Cinder 0
1 First Spark 1
2 Wickglow 100,000,000
3 Tinderflame 1,000,000,000
4 Hearthlight 5,000,000,000
5 High Bonfire 20,000,000,000
6 Beaconfire 50,000,000,000
7 Wildblaze 150,000,000,000
8 Dawnflare 400,000,000,000
9 Sunburst 1,000,000,000,000
10 Nova Bloom 3,000,000,000,000

The thresholds may be tuned in a future version.

Badge numbers are estimates from your local logs and may differ from what you are billed. See the FAQ.

The streak counts consecutive days with any usage, ending today (or yesterday, if you haven't used anything yet today). The streak seal on the achievement card shows the highest milestone reached: 1, 3, 7, 14, 21, 30, 60, 90, 180 or 365 days.

Commands

Command What it does
tokenfire sync Collect logs, render badges and update your gists
tokenfire sync --dry-run Compute and render locally only. Never touches gists.
tokenfire sync --out <DIR> Save the badges and profile.json to this folder (default for a real sync: ~/.tokenfire/out)
tokenfire sync --yes Allow creating the public gist without asking
tokenfire sync --non-interactive For scheduled runs. Asks nothing and never creates gists.
tokenfire status Show the mascot, level, total, last sync and whether a gist is linked
tokenfire snippet [--theme <THEME>] [--dynamic] Print a README snippet. Themes: scene-card, compact, kiln-gauge, achievement-card. --dynamic prints the time-of-day badge.
tokenfire mascot <tochi|burnie> Change the mascot for the next sync
tokenfire import-stats --force Re-import the Claude Code stats snapshot (see FAQ)
tokenfire schedule on / off Turn the scheduled sync (06:00, 12:00, 18:00, 22:00) on or off

Files in the badge gist

File Contents
scene-card-light.svg, scene-card-dark.svg Scene card
compact-light.svg, compact-dark.svg Compact badge
kiln-gauge-light.svg, kiln-gauge-dark.svg Kiln gauge
achievement-card-light.svg, achievement-card-dark.svg Achievement card
card-light.svg, card-dark.svg Same as scene card (kept for older snippets)
badge-light.svg, badge-dark.svg Same as compact (kept for older snippets)
scene-card-dynamic.svg, compact-dynamic.svg, kiln-gauge-dynamic.svg, achievement-card-dynamic.svg Dynamic badges. The sky follows the time of the last sync.
profile.json level, mascot, stage_name, total_tokens, updated_at, sky

Privacy

flowchart TD
    logs["Claude Code / Codex logs<br/>~/.claude · ~/.codex"] -->|token counts only| local["Your computer<br/>~/.tokenfire"]
    local --> pub["Public gist<br/>badges · profile.json<br/><i>anyone can see</i>"]
    local --> sec["Secret gist<br/>daily counts per model · device ID · UTC offset<br/><i>anyone with the URL</i>"]
    logs -.-x|never uploaded| nx["prompts · responses · code<br/>file names · project paths"]
  • Your GitHub token comes from gh auth token at upload time and is never written to disk.
  • The secret gist is unlisted, but anyone who knows its URL can read it.
  • The first tokenfire sync asks before creating anything.
  • Local data lives in ~/.tokenfire (change it with TOKENFIRE_HOME).

FAQ and troubleshooting

The badge on my profile doesn't change.

GitHub caches images on profile pages, so a new badge can take a few hours to appear. Open the raw gist URL directly to see the newest file. If that is also old, check ~/.tokenfire/logs/sync.log and run tokenfire status.

My total looks bigger than my bill.

Claude Code deletes old session logs after a while. To keep older history, tokenfire imports ~/.claude/stats-cache.json once. That file can count more than the billed responses. Cache tokens are also counted, and they are usually the biggest part.

When does the dynamic badge change?

At each scheduled sync: 06:00 (dawn), 12:00 (day), 18:00 (dusk) and 22:00 (night), in your computer's time zone. The sky shows the time of the last sync, so it only changes when a sync runs. Without tokenfire schedule on, it keeps the sky of your last manual sync. GitHub's image cache can add a delay of its own.

I deleted my gist by accident.

Run tokenfire sync in a terminal. Scheduled runs never create gists, so you need to answer the consent prompt yourself. Your gist ID changes, so update the URLs in your README with tokenfire snippet.

gh is not found, or authentication fails.

Install the GitHub CLI and run gh auth login --scopes gist. tokenfire looks for gh on your PATH and then in the usual install folders (Homebrew, /usr/bin, C:\Program Files\GitHub CLI, Scoop).

My logs are in a different folder.

Set CLAUDE_CONFIG_DIR or CODEX_HOME, the same variables those tools use.

My total went up after updating.

Since 1.2.0, tokenfire also reads older Codex sessions, including the older log format and compressed .jsonl.zst files, without counting the same session twice. Your all-time total and level may go up after the first sync. This is expected.

Can I use only the compact badge?

Yes. All themes are uploaded every time. Your README decides which one people see.

Can I change the language of the CLI messages?

tokenfire prints Korean or English based on your system language (LANG and related variables on Linux), and English for any other language. On Windows it prints English unless you choose. To choose one yourself, set TOKENFIRE_LANG=en or TOKENFIRE_LANG=ko. Scheduled runs use the language of your last manual run. Badges are always in English.

Uninstall

tokenfire schedule off
brew uninstall tokenfire     # Homebrew
scoop uninstall tokenfire    # Scoop
rm ~/.local/bin/tokenfire    # install script
cargo uninstall tokenfire    # Cargo or from source
rm -rf ~/.tokenfire

Run only the line for the method you used.

Then delete the two gists from gist.github.com and remove the snippet from your README.

Contributing

Bug reports and pull requests are welcome. See CONTRIBUTING.md.

License

Licensed under either of

at your option.

Explore related projects

Loading…