TokenTracker CLI
TokenTracker counts tokens and spend across Claude Code, Codex, Cursor, Gemini CLI and other agents from local logs and shows them on a local dashboard
- 2,149 ★ on the repository
- Last commit
- MIT
Broad access
Why this level
- The first run writes hooks into the config of Claude Code, Codex, Gemini CLI and other agents
- It reads agent session files and by default makes network requests: provider quotas using credentials already on the machine, prices, updates and anonymous telemetry
Install
- Works in
Manual install
npx tokentracker-cliRequires Node.js 20 or newer. The first run installs hooks and opens the dashboard at localhost:7680.
Access and checks
How we reviewBroad accessThe tool can change data, run commands or handle secrets.
- The first run writes hooks into the config of Claude Code, Codex, Gemini CLI and other agents
- It reads agent session files and by default makes network requests: provider quotas using credentials already on the machine, prices, updates and anonymous telemetry
This is third-party code. Review the repository files before installing.
What it does
The tokentracker-cli package reads local logs of AI agents, counts tokens and converts them to dollars. The first run of npx tokentracker-cli installs hooks, syncs the data and opens a dashboard at http://localhost:7680 with trends, a per-model breakdown, an activity heatmap and spend attributed to projects. Prices come from the LiteLLM table refreshed daily, and a copy on disk lets it compute costs offline. It supports more than forty tools, including Claude Code, Codex CLI, Cursor, Gemini CLI, GitHub Copilot, OpenCode, Goose, Cline and Roo Code. For Claude Code, Codex and Gemini CLI it writes a SessionEnd hook or a notify entry into the agent's own config. The other agents are read passively from their session files. The dashboard also shows remaining quota windows for several providers. On the desktop there are apps for macOS (menu bar), Windows (tray) and Linux, four widgets and an optional Skills tab. Scripts and agents can pull the status with tokentracker status --json. tokentracker uninstall removes all hooks and deletes the local data.
Who it is for. For developers who use several AI agents at once and want one view of token spend in dollars without handing prompts or code to anyone.
Good fit when
- You pay for Claude Code, Codex and Cursor at once and need to know which subscription and which model eats the most
- You want spend by project and by day as a heatmap rather than log lines
- You need a cheap way to watch provider limits: the dashboard shows quota windows for Claude, Codex, Cursor and others
- A script or agent needs a machine-readable status: tokentracker status --json returns a summary for jq
- Agents run on a server over SSH or in CI: tokentracker status --light prints a plain ASCII table with no spinner
Not a fit when
- You need a detailed terminal report by session and billing block: the CLI side of TokenTracker is basic and the focus is the dashboard and apps
- Node.js 20 or newer is missing and cannot be installed
- You cannot touch agent configuration: on first run the tool appends hooks to the settings of Claude Code, Codex and others
- You need exact cost for a model with no published price: such models are counted in tokens and their cost shows as $0
Example request
Run tokentracker status --json and tell me which model I spent the most on this week.Limitations
- Node.js 20 or newer is required.
- The first run writes hooks into agent configs; tokentracker uninstall removes them.
- Models with no published price show $0 cost, though tokens are still counted.
- By default the tool makes network requests: provider quota checks using credentials already on the machine, price refreshes, update checks and anonymous telemetry. Telemetry is disabled with TOKENTRACKER_NO_TELEMETRY=1 or DO_NOT_TRACK=1.
- Cloud sync and the public leaderboard work only with explicit opt-in.
How to disable. Run tokentracker uninstall: it removes the hooks in every detected agent and deletes the local config and data. It is safe to run again. If you installed through Homebrew or npm, remove the package as well.
FAQ
How do I count tokens and spend in Claude Code and Codex at once?
Run npx tokentracker-cli. The first run adds a SessionEnd hook for Claude Code and a notify entry for Codex, reads the logs and opens a dashboard at localhost:7680 with total spend by model and project.
Does TokenTracker read my prompts and code?
No. According to the author, it extracts only token counts, timestamps and model names from local logs. Prompts, responses and code are not saved or uploaded. The parsing logic sits in src/lib/rollout.js, so you can audit it.
How does TokenTracker differ from ccusage?
The author puts it this way: ccusage has stronger terminal reports, while TokenTracker offers a dashboard, apps for macOS, Windows and Linux, four widgets, quota tracking and an optional leaderboard.
How do I remove TokenTracker and its hooks?
tokentracker uninstall removes all hooks in the detected agents and deletes the local config and data. It is safe to run repeatedly.
Which agents does TokenTracker support?
More than forty tools, among them Claude Code, Codex CLI, Cursor, Gemini CLI, GitHub Copilot, OpenCode, Goose, Cline and Roo Code. Hooks are written for Claude Code, Codex and Gemini CLI, and the rest are read from session files. The dashboard shows provider limits for several tools.
Discussion
No questions or reviews yet.
Related
CLI toolsCounts token use and cost of Claude Code and Codex sessions from local logs and shows remaining limits in the status line
Token and cost reports for Claude Code, Codex, Gemini CLI and other agents from local logs, by day, month and session
A CLI and MCP server that tally token spend across 41 tools and agents, break it down by project and model, and help cut wasted tokens
Local browsing, search and cost tracking for Claude Code, Codex and other agent sessions in one web UI
Yandex Tracker CLI
tracker
The tracker command-line tool for Yandex Tracker with JSON output and a ready SKILL.md workflow for agents
A CLI and skill for Yandex Tracker and Wiki: short output readable by people and agents alike, instead of raw MCP payloads costing thousands of tokens
Comparison with similar tools
Entries that share the main search query, and how they differ.
| Entry | Official | Repository stars | Main difference |
|---|---|---|---|
| TokenTracker (this entry) | no | 2,149 | |
| ccusage | no | 19,238 | terminal reports on tokens from logs, while TokenTracker adds a dashboard, apps and widgets |
| Claude Code Usage Monitor | no | 8,781 | a terminal monitor of the Claude Code limit window, while this entry covers dozens of agents |
| Claude Usage | no | 2,282 | a local dashboard over Claude Code logs alone, while TokenTracker gathers many agents |
README in short
The README shows a one-command quick start with npx and lists install options: npm, Homebrew, and builds for macOS, Windows and Linux. It then covers the features: the dashboard, the pricing engine, provider limits, widgets, achievements and optional cloud functions. A table describes how the tool hooks into each supported agent. Separate sections cover privacy, environment variables, session discovery in WSL, troubleshooting and removal.