Skip to content

mm7894215/TokenTracker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

126 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Token Tracker

Know exactly what you're spending on AI β€” across every CLI

Auto-collect token counts from 8 AI coding tools, aggregate them locally, and see real cost trends in a beautiful dashboard. No cloud account, no API keys, no setup β€” just one command.

npm version npm downloads Homebrew License: MIT Platform GitHub stars


Token Tracker Dashboard



⭐ If TokenTracker saves you time, please star it on GitHub β€” it helps other developers find it.


⚑ Quick Start

Requirements: Node.js 20+ (CLI runs on macOS / Linux / Windows; menu bar app and Cursor SQLite reader are macOS-only).

npx tokentracker-cli

That's it. First run installs hooks, syncs your data, and opens the dashboard at http://localhost:7680.

What you get in 30 seconds:

  • πŸ“Š A local dashboard at localhost:7680 with usage trends, model breakdown, cost analysis
  • πŸ”Œ Auto-detected hooks for every supported AI tool you have installed
  • 🏠 100% local β€” no account, no API keys, no network calls (except optional leaderboard)

Want a native macOS menu bar app? Download TokenTrackerBar.dmg β†’ drag to Applications. Includes desktop widgets, menu bar status icon, and the same dashboard in a WKWebView.

Install globally for shorter commands:

npm i -g tokentracker-cli

tokentracker              # Open the dashboard
tokentracker sync         # Manual sync
tokentracker status       # Check hook status
tokentracker doctor       # Health check

🍺 Homebrew (macOS)

Prefer brew? Install directly β€” no extra tap step needed:

# macOS menu bar app (DMG)
brew install --cask mm7894215/tokentracker/tokentracker

# CLI only
brew install mm7894215/tokentracker/tokentracker

Upgrade with brew upgrade --cask mm7894215/tokentracker/tokentracker. The tap auto-bumps within an hour of every new release.


✨ Features

  • πŸ”Œ 8 AI tools out of the box β€” Claude Code, Codex CLI, Cursor, Gemini CLI, Kiro, OpenCode, OpenClaw, Every Code
  • 🏠 100% local β€” Token data never leaves your machine. No account, no API keys.
  • πŸš€ Zero config β€” Hooks auto-install on first run. From zero to dashboard in 30 seconds.
  • πŸ“Š Beautiful dashboard β€” Usage trends, cost breakdowns by model, GitHub-style activity heatmap, project attribution
  • πŸ–₯️ Native macOS app β€” Menu bar status icon, embedded server, WKWebView dashboard
  • 🎨 4 desktop widgets β€” Pin Usage / Activity Heatmap / Top Models / Usage Limits to your desktop
  • πŸ“ˆ Real-time rate limit tracking β€” Claude / Codex / Cursor / Gemini / Kiro / Antigravity quota windows with reset countdowns
  • πŸ’° Cost engine β€” 70+ model pricing tables, accurate USD breakdowns
  • 🌐 Optional leaderboard β€” Compare with developers worldwide (opt-in, sign in to participate)
  • πŸ”’ Privacy-first β€” Only token counts and timestamps. Never prompts, responses, or file contents.

πŸ–ΌοΈ Showcase

Dashboard β€” usage trends, model breakdown, cost analysis

Dashboard

Desktop Widgets β€” pin usage to your desktop

Desktop Widgets

Menu Bar App β€” animated Clawd companion + native panels

Menu Bar App

Global Leaderboard β€” compare with developers worldwide

Leaderboard

πŸ”Œ Supported AI Tools

Tool Detection Method
Claude Code βœ… Auto SessionEnd hook in settings.json
Codex CLI βœ… Auto TOML notify hook in config.toml
Cursor βœ… Auto API + SQLite auth token
Kiro βœ… Auto SQLite + JSONL hybrid
Gemini CLI βœ… Auto SessionEnd hook
OpenCode βœ… Auto Plugin system + SQLite
OpenClaw βœ… Auto Session plugin
Every Code βœ… Auto TOML notify hook

Missing your tool? Open an issue β€” adding new providers is usually one parser file away.


πŸ†š Why TokenTracker?

TokenTracker ccusage Cursor stats
AI tools supported 8 1 (Claude) 1 (Cursor)
Local-first, no account βœ… βœ… ❌
Native menu bar app βœ… ❌ ❌
Desktop widgets βœ… 4 widgets ❌ ❌
Rate-limit tracking βœ… 6 providers ❌ Cursor only

πŸ—οΈ How It Works

flowchart LR
    A["AI CLI Tools<br/>Claude Β· Codex Β· Cursor<br/>Gemini Β· Kiro Β· OpenCode Β· ..."]
    A -->|hooks trigger| B[Token Tracker]
    B -->|parse logs<br/>30-min UTC buckets| C[(Local SQLite)]
    C --> D[Web Dashboard]
    C --> E[Menu Bar App]
    C --> F[Desktop Widgets]
    C -.->|opt-in| G[(Cloud Leaderboard)]
Loading
  1. AI CLI tools generate logs during normal use
  2. Lightweight hooks detect changes and trigger sync (Cursor uses API instead of hooks)
  3. Token counts parsed locally β€” never any prompt or response content
  4. Aggregated into 30-minute UTC buckets
  5. Dashboard, menu bar app, and widgets all read from the same local snapshot

πŸ›‘οΈ Privacy

Protection Description
No content upload Only token counts and timestamps. Never prompts, responses, or file contents.
Local-only by default All data stays on your machine. The leaderboard is fully opt-in.
Auditable Open source. Read src/lib/rollout.js β€” only numbers and timestamps.
No telemetry No analytics, no crash reporting, no phone-home.

πŸ“¦ Configuration

Most users never need this β€” defaults are sensible. For advanced setups:

Variable Description Default
TOKENTRACKER_DEBUG Enable debug output (1 to enable) β€”
TOKENTRACKER_HTTP_TIMEOUT_MS HTTP timeout in milliseconds 20000
CODEX_HOME Override Codex CLI directory ~/.codex
GEMINI_HOME Override Gemini CLI directory ~/.gemini

πŸ› οΈ Development

git clone https://github.com/mm7894215/TokenTracker.git
cd TokenTracker
npm install

# Build dashboard + run CLI
cd dashboard && npm install && npm run build && cd ..
node bin/tracker.js

# Tests
npm test

Building the macOS App

cd TokenTrackerBar
npm run dashboard:build              # Build the dashboard bundle
./scripts/bundle-node.sh             # Bundle Node.js + tokentracker source
xcodegen generate                    # Generate the Xcode project
ruby scripts/patch-pbxproj-icon.rb   # Patch in the Icon Composer asset
xcodebuild -scheme TokenTrackerBar -configuration Release clean build
./scripts/create-dmg.sh              # Package the .app into a DMG

Requires Xcode 16+ and XcodeGen.


πŸ”§ Troubleshooting

CLI

"engines.node" or unsupported version error

TokenTracker requires Node 20+. Check your version:

node --version

If lower, upgrade via nvm, fnm, or your package manager (brew upgrade node, apt install nodejs).

Port 7680 already in use

The dashboard server picks the next free port automatically (7681, 7682, ...) when 7680 is taken. The actual port is logged on startup. If you want to force a specific port:

PORT=7700 tokentracker serve

To find what's holding 7680:

lsof -i :7680
A provider isn't being detected

Check the integration status:

tokentracker status

Then run the doctor for a deeper health check:

tokentracker doctor

If a provider shows as not configured even though you use it, try tokentracker activate-if-needed to re-run hook detection. If still missing, open an issue with the doctor output attached.

How to uninstall hooks and remove all config
tokentracker uninstall

This removes every hook TokenTracker installed across all detected AI tools, plus the local config and data. Safe to re-run.

macOS App

"TokenTrackerBar can't be opened" β€” unidentified developer

TokenTrackerBar is ad-hoc signed (not notarized with an Apple Developer ID β€” that requires a paid developer account). Gatekeeper blocks it on first launch.

  1. Open System Settings β†’ Privacy & Security
  2. Scroll to the Security section β€” you'll see "TokenTrackerBar was blocked to protect your Mac."
  3. Click Open Anyway
  4. Confirm with Open in the follow-up dialog (you'll need to authenticate)

You only need to do this once. Older macOS alternative: right-click the app in Finder β†’ Open β†’ Open in the confirmation dialog.

"TokenTrackerBar is damaged and can't be opened"

This is Gatekeeper reacting to the com.apple.quarantine attribute macOS attaches to every downloaded file β€” not an actual problem. Clear it once with:

xattr -cr /Applications/TokenTrackerBar.app

After that the app opens normally.

"TokenTrackerBar wants to access data from other apps"

This is required for the Cursor and Kiro integrations. They store auth tokens / usage data inside their own ~/Library/Application Support/ folders, which macOS protects with the App Management permission.

  • βœ… Click Allow if you use Cursor or Kiro
  • ❌ Click Don't Allow if you don't β€” those providers will be silently skipped, everything else keeps working

Once granted, the permission is remembered. Note that ad-hoc signed builds re-prompt after each upgrade because each build has a new signing identity.


⭐ Star History

Star History Chart

🀝 Contributing & Support

πŸ™ Credits

Clawd pixel art inspired by Clawd-on-Desk by @marciogranzotto. The Clawd character design belongs to Anthropic. This is a community project with no official affiliation with Anthropic.

License

MIT


Token Tracker β€” Quantify your AI output.

token.rynn.me Β· npm Β· GitHub

About

Track Claude Code, Codex, Cursor, Gemini, Kiro, OpenCode, OpenClaw & Every Code token usage. Local-first, zero-config, with a beautiful dashboard, native macOS menu bar app, and 4 desktop widgets.

Topics

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors