DISCOVER THE FUTURE OF AI AGENTSarrow_forward

toktrack

calendar_todayAdded Apr 23, 2026
categoryAgent & Tooling
codeOpen Source
Rust大语言模型AI AgentsCLIAgent & ToolingModel & Inference FrameworkDeveloper Tools & CodingData Analytics, BI & Visualization

Ultra-fast token & cost tracker for LLM usage across Claude Code, Codex CLI, Gemini CLI, OpenCode, and PI Agent.

toktrack is an ultra-fast LLM token usage and cost tracker built in Rust, designed for AI coding CLI users. It achieves approximately 3 GiB/s JSON parsing throughput through SIMD-accelerated parsing (simd-json) and parallel processing (rayon), with cold startup in ~1 second and cached queries in ~0.04 seconds.

The tool offers three usage modes: an interactive TUI dashboard (Overview/Stats/Models tabs with day/week/month view switching and automatic terminal theme detection), CLI subcommands (daily/weekly/monthly/stats, all supporting --json output), and shareable usage report generation (text/SVG receipt format).

toktrack provides unified support for five AI coding tools: Claude Code, Codex CLI, Gemini CLI, OpenCode, and PI Agent, using the CLIParser trait with independent parser implementations for each CLI. Its data persistence caching mechanism stores daily usage summaries under ~/.toktrack/cache/, ensuring historical cost data is preserved even when original session files are cleaned up (e.g., Claude Code's default 30-day deletion), with fs2 file locking to prevent concurrent race conditions.

Cost calculation automatically pulls model pricing from LiteLLM (1-hour TTL), while supporting custom pricing files via the TOKTRACK_PRICING_FILE environment variable. Installation is flexible—recommended via npx toktrack for one-click usage (auto-downloads platform binaries without requiring Rust toolchain)—with Homebrew and source compilation also supported. The project is licensed under MIT, primarily implemented in Rust (98.2%), and supports macOS, Linux, and Windows.

Related Projects

View All arrow_forward

STAY UPDATED

Get the latest AI tools and trends delivered straight to your inbox. No spam, just intelligence.

rocket_launch