toktrack CLI
A fast Rust tracker of tokens and costs across Claude Code, Codex, Gemini CLI and others that keeps history beyond 30 days.
- 196 ★ on the repository
- Last commit
- MIT
Extended access
Why this level
- The utility reads local session logs of all coding agents and writes a cache to the home directory.
- For remote Codex sources it syncs files over SSH.
Install
- Works in
Manual install
npx toktrackDownloads the binary for your platform, no Rust needed. Running without arguments opens the terminal dashboard.
Access and checks
How we reviewExtended accessThe tool runs code or makes network calls and only reads external data.
- The utility reads local session logs of all coding agents and writes a cache to the home directory.
- For remote Codex sources it syncs files over SSH.
This is third-party code. Review the repository files before installing.
What it does
toktrack gathers token and cost usage into one dashboard across Claude Code, GitHub Copilot CLI, Codex CLI, Gemini CLI, Qwen Code, OpenCode, PI Agent, Antigravity and Grok CLI. Claude Code deletes session data after 30 days by default, and toktrack keeps its own persistent cache so history does not vanish with the files. The terminal interface has five tabs: Overview, Stats, Models, Projects and Audit, with daily, weekly and monthly views. The `daily`, `weekly`, `monthly` and `stats` commands can output `--json`, `toktrack report` builds a text and SVG receipt, and `toktrack audit` shows what is left on disk versus only in the cache. Repeat runs from cache take about 0.04 seconds.
Who it is for. Developers paying for several coding agents at once who want total spend and a history longer than a month.
Good fit when
- You need to see how many tokens and dollars Claude Code and Codex used together over a month.
- Spending history must survive the automatic deletion of sessions after 30 days.
- Costs are viewed per project and git worktree, grouped into a root folder.
- Today's total is shown right in a zsh, bash or fish prompt.
Not a fit when
- You need cloud cost tracking for a whole team with shared sign-in.
- Your agents keep no local session logs.
- You need limit control, not only viewing.
Example request
Show token and cost usage across all my coding agents for last month, broken down by project and model.Limitations
The utility reads local session logs, so it sees only what agents wrote to disk; the project comes from where the CLI stores a working directory, otherwise the row goes to `(no project)`. The cache lives in `~/.toktrack/cache` and needs protecting if you want history. Remote Codex sources are pulled over SSH using your own `ssh` and `rsync` setup. Cost is computed from model prices and may differ from the provider bill.
How to disable. Remove the binary (`brew uninstall toktrack`) and the `~/.toktrack` directory with cache and settings. Remove the prompt line from your shell rc file.
FAQ
How do I install toktrack?
With `npx toktrack`, no Rust needed. There is also `bunx toktrack`, Homebrew (`brew tap mag123c/toktrack`), `cargo install` from source and binaries on the releases page.
How do I get data for a script?
Add `--json` to `toktrack daily`, `weekly`, `monthly` or `stats`. `toktrack report` makes a general report, and with `--svg` it also writes an image.
What does `toktrack audit` do?
It shows per-source coverage: what is still on disk and what remains only in the cache after an agent deleted its files.
Does toktrack work with remote machines?
For Codex logs yes: `toktrack remote add devbox ubuntu@devbox` pulls files over SSH. The program stores no passwords or keys.
Which agents does it cover?
Claude Code, GitHub Copilot CLI, Codex CLI, Gemini CLI, Qwen Code, OpenCode, PI Agent, Antigravity and Grok CLI.
Discussion
No questions or reviews yet.
Related
CLI toolsTokenTracker counts tokens and spend across Claude Code, Codex, Cursor, Gemini CLI and other agents from local logs and shows them on a local dashboard
Tokdash shows token usage and session cost for Claude Code, Codex, Gemini CLI and a dozen more agents locally
Counts token use and cost of Claude Code and Codex sessions from local logs and shows remaining limits in the status line
htop for AI costs: a terminal dashboard shows tokens and spending across 11 providers and 8 coding agents in real time.
Token and cost reports for Claude Code, Codex, Gemini CLI and other agents from local logs, by day, month and session
A limits and token spend monitor for Claude Code, Codex, Antigravity and Grok CLI: macOS menu bar, Windows tray, HTML reports
Comparison with similar tools
Cards that share the main search query, and how they differ.
| Tool | Official | Repository stars | Main difference |
|---|---|---|---|
| toktrack (this card) | no | 196 | |
| ccusage | no | 19,425 | CLI usage reports; toktrack keeps history in a persistent cache after sessions are cleaned and merges nine agents |
| Claude Code Usage Monitor | no | 8,801 | a real-time Claude Code usage monitor; toktrack shows history, projects and models across several agents |
README in short
The program is written in Rust with simd-json and rayon parallel parsing. The project stresses that other tools re-read session files on every run and lose history when an agent cleans them.