tokenchit is used to convert the usage logs of local AI coding agents into a statistics card that can be committed to a repository README. It reads the local logs of Claude Code, Codex, and OpenCode, counts the total number of tokens, daily and hourly activity, breakdowns by agent and by model, and provides a yearly recap.
Main capabilities:
- A single command can discover local agents, display statistics, and write the card.
- The card is an SVG file, not a hosted image or screenshot, so it does not depend on the availability and rate limits of third-party services, and GitHub can serve the file directly.
- Supports the --no-publish parameter; this path contains no network code at all and does not send any data.
- Provides commands such as init, sync, recap, ledger, and doctor; none of these commands import network modules, and tests enforce this.
- Supports migrating usage history between machines via ledger --export and --import, with merging done by session rather than by day.
- Provides an MCP server containing four tools: get_usage, get_daily_usage, get_recap, and detect_agents, for models to query usage, and these tools cannot make network requests.
- Provides a GitHub Action to re-fetch the published card and commit it, preventing the SVG in the README from drifting out of sync with the real data.
Usage:
- Run a single command to generate the card; use --no-publish to prevent uploading.
- If you need to run it frequently, install it globally: npm i -g @tokenchit/cli, then run tokenchit generate --no-publish.
- Commit the generated SVG file to the repository where the README is located, with the path relative to the Markdown file.
- To publish to the public leaderboard, remove --no-publish; in a terminal it will prompt for confirmation, while in a pipe or script it publishes directly.
- Common parameters include --out, --theme auto|light|dark, --layout default|compact, --json, --dry-run.
- Use tokenchit help <command> to view the description of a single command; NO_COLOR=1 can disable colors and animations.
Use cases:
- Developers who want to display AI coding agent usage statistics in their own repository README.
- Users who need to merge usage history across machines and keep the data portable.
- Users who want models to answer questions about their own usage via MCP.
- Users who want to keep the card updated without relying on external hosting services.
Limitations and notes:
- Logs are rotated, prices change, and some models do not have public pricing; when the data is incomplete, the tool will state this clearly.
- Gemini only records token counts in newer versions; if all installation records predate that version, it will be reported as "detected but uncountable" rather than zero.
- Copilot CLI is detected but reported as unsupported, because it only records live context usage and never records cumulative totals.
- The statistics do not match Claude Code's Stats panel, which counts each API call by streaming rewrite, giving a reading of about twice as much; sync prints both numbers and the gap.
- Equivalent cost is not the actual amount paid, but the cost calculated at API list prices; most agent usage runs under a subscription.
- The publishing feature uploads daily total tokens, agent and model names, and handle; it does not upload prompts, replies, file paths, branch names, or repository names.
- Submissions to the public leaderboard are self-reported, with two thresholds for rejection and deferred review.
- Requires Node 22 or higher; OpenCode support uses the built-in node:sqlite.
- Upgrades migrate the ledger, but downgrades are not safe; if you need to roll back, you should first run tokenchit ledger --export.
- GitHub disables scheduled workflows after 60 days of repository inactivity, and no commit is produced when the card has not changed.