tokenfire

skill
Guvenlik Denetimi
Uyari
Health Uyari
  • License — License: Apache-2.0
  • Description — Repository has a description
  • Active repo — Last push 0 days ago
  • Low visibility — Only 9 GitHub stars
Code Gecti
  • Code scan — Scanned 12 files during light audit, no dangerous patterns found
Permissions Gecti
  • Permissions — No dangerous permissions requested

Bu listing icin henuz AI raporu yok.

SUMMARY

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

README.md

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 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 (also installs the GitHub CLI)
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 (macOS)
tokenfire schedule on

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

Install

Requirements

What Why
macOS Scheduled sync uses launchd. Manual tokenfire sync works on any OS where the CLI builds, but only macOS is tested.
GitHub CLI (gh) tokenfire asks gh for a token each time it uploads. It never stores the token. Homebrew installs it for you. Otherwise install it from cli.github.com.
Claude Code / Codex The source of your usage logs.

Install the CLI

With Homebrew (recommended, no Rust needed):

brew install keemtj/tap/tokenfire
tokenfire --version

With Rust (cargo, from rustup.rs):

cargo install tokenfire

Or build from a clone:

git clone https://github.com/keemtj/tokenfire.git
cd tokenfire
cargo install --path crates/tokenfire

Update

brew upgrade tokenfire          # Homebrew
cargo install tokenfire --force # Rust

Then run tokenfire sync once. It uploads badges in the new design and updates the schedule if it changed. Your README snippet keeps working.

Moving from a cargo install to Homebrew? Run cargo uninstall tokenfire, then brew install keemtj/tap/tokenfire and tokenfire schedule on once, so the schedule points to the Homebrew copy.

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 registers a launchd job that 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 Mac is asleep at one of those times, launchd runs it when it wakes. 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.

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.

Check it:

launchctl list | grep tokenfire
tail ~/.tokenfire/logs/sync.log
tokenfire status

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.

Linux or Windows? There is no built-in schedule yet. You can run tokenfire sync --non-interactive from cron or Task Scheduler, but these platforms are not tested yet.

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 (macOS)

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 /opt/homebrew/bin/gh.

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, and English for any other language. 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   # or: cargo uninstall tokenfire
rm -rf ~/.tokenfire

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.

Yorumlar (0)

Sonuc bulunamadi