npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

tokentracker-cli

v0.5.41

Published

Token usage tracker for AI agent CLIs (Claude Code, Codex, Cursor, Kiro, Gemini, OpenCode, OpenClaw)

Readme

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 License: MIT Platform GitHub stars

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

✨ 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

Desktop Widgets — pin usage to your desktop

Menu Bar App — animated Clawd companion + native panels

Global Leaderboard — compare with developers worldwide


🔌 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)]
  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

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).

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

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.

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 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 → OpenOpen in the confirmation dialog.

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.

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


🤝 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