Toktrack
Ultra-fast token & cost tracker for LLM Token Usage (e.g. Claude Code)
Install
npx toktrackclaude mcp add toktrack -- npx toktrack{
"mcpServers": {
"toktrack": {
"command": "npx",
"args": [
"toktrack"
]
}
}
}Install command taken from the project's README or registry entry. Always review code before running it.
README excerpt
Read full README on GitHub →English | 한국어
⚠️ Did you know? Claude Code deletes your session data after 30 days by default. Once deleted, your token usage and cost history are gone forever — unless you preserve them.
The token & cost tracker that never loses your history. Most tools re-read your CLI's session files on every run — so when Claude Code deletes them after 30 days, your cost history goes with them. toktrack keeps a persistent cache, so your history survives.
Track usage across all your AI coding CLIs — Claude Code, GitHub Copilot CLI, Codex CLI, Gemini CLI, Qwen Code, OpenCode, PI Agent, Antigravity, and Grok CLI — in one dashboard. Built in Rust, so it stays fast even on huge histories (simd-json + rayon).
Why toktrack?
| Problem | Solution |
|---|---|
| 🗑️ Claude Code deletes data after 30 days — your cost history disappears | 💾 Persistent cache — history survives even after the CLI deletes its files |
| 📊 No unified view — each CLI keeps its own separate data | 🎯 One dashboard — Claude Code, Copilot, Codex, Gemini, Qwen, OpenCode, PI Agent, Grok in one place |
| 🐌 Re-scanning big histories is slow | ⚡ Cached queries in ~0.04s — instant on every run |
Features
- Data Preservation — Persistent cache keeps your cost history even after a CLI deletes its own session files
- Multi-CLI Support — Claude Code, GitHub Copilot CLI, Codex CLI, Gemini CLI, Qwen Code, OpenCode, PI Agent, Antigravity, Grok CLI in one place
- TUI Dashboard — 5 tabs (Overview, Stats, Models, Projects, Audit) with daily/weekly/monthly views
- Per-Project Breakdown — the Projects tab shows token & cost usage per project (the session working directory), for CLIs that record one. Drill into any project for its day-by-day, per-model breakdown. Usage from CLIs that don't record a project is grouped under
(no project). Project details are cached, so they survive past the CLI's 30-day deletion - CLI Commands —
daily,weekly,monthly,statswith JSON output support - Usage Reports — Shareable text & SVG receipts via
toktrack report - Fast on huge histories — simd-json + rayon parallel parsing (~3 GiB/s); cached runs in ~0.04s
Installation
npx (Recommended)
No Rust toolchain required. Downloads the correct binary for your platform automatically.
npx toktrack
# or
bunx toktrack
Homebrew (macOS / Linux)
brew tap mag123c/toktrack
brew install toktrack
From Source
cargo install --git https://github.com/mag123c/toktrack
Pre-built Binaries
Download from GitHub Releases.
| Platform | Architecture |
|---|---|
| macOS | x64, ARM64 |
| Linux | x64, ARM64 |
| Windows | x64 |
Quick Start
# Launch TUI dashboard
npx toktrack
# Get today's cost in JSON
npx toktrack daily --json
# Monthly summary
npx toktrack monthly --json
Usage
TUI Mode (Default)
toktrack
CLI Commands
# Open TUI at specific tab
toktrack daily # Overview (daily view)
toktrack weekly # Overview (weekly view)
toktrack monthly # Overview (monthly view)
toktrack stats # Stats tab
# JSON output (for scripting)
toktrack daily --json
toktrack weekly --json
toktrack monthly --json
toktrack stats --json
Similar plugs
CLI proxy that reduces LLM token consumption by 60-90% on common dev commands. Single Rust binary, zero dependencies
Bash is all you need - A nano claude code–like 「agent harness」, built from 0 to 1
Documented system prompts from Anthropic - Claude Fable 5.1, Opus 5.5, Claude Design, Claude Code. OpenAI - ChatGPT GPT-6-Astra, Codex. Google - Gemini 3.8 Flash, 3.1 Pro,…
Wrap Antigravity, ChatGPT Codex, Claude Code, Grok Build, Muse Code, Devin as an OpenAI/Gemini/Claude/Codex compatible API service, allowing you to enjoy the free Gemini…