TokenTracker

xiufengsunMIT活跃维护

本地优先统计 Claude Code、Codex、Cursor 等 31 款编程工具的 token 用量与费用,不读取提示词,提供原生桌面应用和仪表盘。

Local-first AI token usage & cost tracker for 31 coding tools incl. Claude Code, Codex, Cursor, Gemini & DeepSeek Harness—with native apps. Never reads prompts.

v1.5.15发布于 2026-11-08 03:08 UTC2,224star +19 / 7 天230fork同步于 2026-11-10 17:46 UTC

怎么上手

由 README 提炼,执行前请确认
npx tokentracker-cli
硬件要求按 README 说明

README 未说明 GPU 或显存要求;CLI 需 Node.js 20+,可跑在 macOS、Linux、Windows;原生应用支持 macOS 菜单栏、Windows 系统托盘、Linux AppImage 托盘。

下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

本地统计 47 款 AI 编程工具的 token 用量与花费,不读提示词,无需账号和 API Key

本地优先统计 Claude Code、Codex、Cursor 等 31 款编程工具的 token 用量与费用,不读取提示词,提供原生桌面应用和仪表盘。

核心能力

  • 自动检测已装 AI 工具的 hook 并同步本地日志
  • 本地仪表盘展示用量趋势、模型分布与成本分析
  • 提供 macOS 菜单栏、Windows 托盘与 Linux 托盘原生应用
  • 附带桌面宠物、4 个原生小组件与 15 条成就线
  • status --json 输出机器可读摘要,便于脚本或 agent 接入

容易踩的坑

首次运行会自动安装各 AI 工具的 hook 并同步数据,需 Node.js 20+ 否则报 engines.node 错误;默认端口 7680 被占用时会自动顺延,WSL 下默认改用 7681;macOS 应用为 ad-hoc 签名,首次启动需在隐私与安全里手动放行,Cursor/Kiro 集成还需授予 App Management 权限。

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

5 个版本v1.5.15
  1. v1.5.15最新正式版2026-11-08 · 2026-11-08 03:08 UTC

    What's Changed

    New Contributors

    Full Changelog: https://github.com/xiufengsun/TokenTracker/compare/v1.5.14...v1.5.15

    SHA-256 checksums

    2067d2aa6dc084aadea6fdf38f3d88e48c6961b2fea166a5438690b6721ca965  TokenTracker-Setup.exe
    a60434f5e8f42a89cde94ae59c62538678daad34ab7c55915544eb72a669eb6f  TokenTracker-linux-x86_64.AppImage
    60379ec1334d2dfe537b753c9b757eeab9b7b272cb22400e92b04d82c3978a2d  TokenTracker-linux-x86_64.deb
    96299dcc067080bc7b601d452833add384b97d02190c39aa456a93c8a6acb8a0  TokenTracker-linux-x86_64.rpm
    62fce3a561fcfc8d9cd7b4c2f868c60543b118f91c8ffd08b520cd1d00e31c64  TokenTracker-win-x64.zip
    087d769d97df2b3ed79c8408bbe95209ac6419dcd34ee7f9e73d18deb4bc35cc  TokenTrackerBar.dmg
    
  2. v1.5.142026-11-07 · 2026-11-07 10:31 UTC
    查看更新说明

    Fix duplicate DeepSeek Harness fork and replay usage with safe historical repairs.

    SHA-256 checksums

    0064912deb94187c6128276dfa4670dc33d801e1ab4fe436f6304d9406f2e62a  TokenTracker-Setup.exe
    58f4c7046bd15766bcf945655c7b821356759062d724d40f89b7a36a3575c5c5  TokenTracker-linux-x86_64.AppImage
    621140e65ce706619ae4fc0f1a8571737930ab19604ae0023e9b2367bca8fb66  TokenTracker-linux-x86_64.deb
    1484cc918c3adb59cded1d71484682a0a992fc80f492d4d96959829f61e54dd5  TokenTracker-linux-x86_64.rpm
    176cd40c4c6bf4f1e5a3e633ae548f9f27c0772241ab177b3f947ce6168df3fa  TokenTracker-win-x64.zip
    0d41d8b31a6f8884309c23b634893e8d9d66855f7e146aabe8953cd9c4251717  TokenTrackerBar.dmg
    
  3. v1.5.132026-11-07 · 2026-11-07 03:13 UTC
    查看更新说明

    Speed up desktop startup by serving the dashboard before incremental runtime updates.

    SHA-256 checksums

    34a1f80699f19545d7e83ad37901fac6bfc030b7857c1f7d019da27bfa78b011  TokenTracker-Setup.exe
    65f14853e22471426caeb26aea5edff3c30af3756c4eb38a5c7354df681b3e6d  TokenTracker-linux-x86_64.AppImage
    b5a566cee133d6046058afe8dfc4271b4d350eb9a0e9efc4ab19b93da6c215c1  TokenTracker-linux-x86_64.deb
    04e507e27186970a1e44cf678ace293ab82ef415881b27aeb34986c810d6672e  TokenTracker-linux-x86_64.rpm
    658d00e9982ae220d7df18e8ccc0cb5c18d72e9353a695549b0253b904d6a0b0  TokenTracker-win-x64.zip
    c34d4bdd022a27ee053e62096ecad438a0fee93ece571fed171513c8158e3dd2  TokenTrackerBar.dmg
    
  4. v1.5.122026-11-06 · 2026-11-06 11:05 UTC
    查看更新说明

    Fix desktop startup unexpectedly opening a browser.

  5. v1.5.112026-11-06 · 2026-11-06 04:00 UTC
    查看更新说明

    Fix IP history storage errors and defer loading community statistics.

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    Token Tracker

    English · 简体中文 · 日本語 · 한국어 · Deutsch

    Track every AI token — then bring your usage to life

    An accurate, local-first token usage and cost dashboard for 47 AI coding tools — plus a desktop pet, 4 native widgets, and 15 achievement tracks. No cloud account, no API keys, no setup.

    npm version npm downloads Homebrew License: MIT CLI macOS app Windows app GitHub stars Featured in 阮一峰周刊 #393 Author tokens

    📊 See the token dashboard in action

    🏆 Unlock achievements from the way you actually code.

    🎬 Meet TokenTracker

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

    ko-fi


    This project is tested with BrowserStack.


    ⚡ Quick Start

    Requirements: Node.js 20+ (CLI runs on macOS / Linux / Windows; native desktop app ships for macOS (menu bar), Windows (system tray) and Linux (AppImage, tray). Cursor token reading uses the system sqlite3 CLI when available and falls back to node:sqlite on supported Node releases).

    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
    • 🏠 Local-first — parses logs on your machine; no account or API keys required
    • 🧩 Optional: a Skills tab that browses 250+ public skills and syncs them across Claude · Codex · Grok · Antigravity · Gemini · OpenCode · Hermes

    Want a native desktop app?

    • macOS — Download TokenTrackerBar.dmg → drag to Applications. Menu bar status icon, desktop widgets, and the dashboard in a WKWebView.
    • Windows — Download TokenTracker-Setup.exe → run the per-user installer (no admin needed). System-tray app with the dashboard in WebView2. Portable zip also on the releases page.
    • Linux — Download TokenTracker-linux-x86_64.AppImage → chmod +x and run. Tray app with the dashboard in a WebKitGTK window. It carries its own GTK/WebKit, so it needs nothing from your distro beyond a current glibc; on GNOME the tray icon still needs the AppIndicator extension. .deb and .rpm packages are also on the releases page — those link the distro's webkit2gtk-4.1, gtk3 and appindicator instead, so the .deb will not install on Debian 12 (use the AppImage there).

    Install globally for shorter commands:

    npm i -g tokentracker-cli
    
    tokentracker              # Open the dashboard
    tokentracker sync         # Manual sync
    tokentracker status       # Check hook status
    tokentracker status --json     # Machine-readable summary (pipe to jq, ingest from AI agents)
    tokentracker status --light    # Plain ASCII table (CI / SSH, no spinner)
    tokentracker doctor       # Health check
    

    🍺 Homebrew (macOS)

    Prefer brew? Install directly — no extra tap step needed:

    # macOS menu bar app (DMG)
    brew install --cask xiufengsun/tokentracker/tokentracker
    
    # CLI only
    brew install xiufengsun/tokentracker/tokentracker
    

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

    🐧 Linux (AppImage, .deb, .rpm)

    Every release ships all three. One self-contained file, no package manager:

    chmod +x TokenTracker-linux-x86_64.AppImage
    ./TokenTracker-linux-x86_64.AppImage
    

    Or install through your package manager:

    sudo apt install ./TokenTracker-linux-x86_64.deb    # Debian / Ubuntu
    sudo dnf install ./TokenTracker-linux-x86_64.rpm    # Fedora / RHEL
    

    Debian 12: the .deb depends on libappindicator3-1, which bookworm dropped in favour of libayatana-appindicator3-1, so apt refuses it. Use the AppImage.

    All three bundle their own Node runtime and the dashboard. The AppImage additionally carries GTK3, WebKitGTK and appindicator, which is why it is ~120MB and installs nowhere; the .deb and .rpm link the distro's webkit2gtk-4.1, gtk3 and appindicator instead, at ~55MB. Tested on Arch + KDE Plasma; on GNOME the tray icon requires the AppIndicator extension, and clicking the tray icon opens the menu rather than the window (a libayatana-appindicator limitation).

    An Arch PKGBUILD for a local pacman install lives in TokenTrackerLinux/packaging/arch/tokentracker-linux — see TokenTrackerLinux/README.md. It is not published to the AUR.


    ✨ Features

    • 🔌 47 AI tools out of the box — Claude Code, Codex CLI, AStudio, Cursor, Gemini CLI, Antigravity, Kiro, OpenCode, OpenSquilla, OpenClaw, Every Code, Hermes Agent, GitHub Copilot, Kimi Code, CodeBuddy, WorkBuddy, WorkBuddy AI, Grok Build, oh-my-pi, OmO, pi, Dots, Prime Agent, Craft Agents, Reasonix, Muse Code, Kilo CLI, Kilo Code, Roo Code, Zed Agent, Goose, Droid, Mimo Code, DuMate, ZCode, Qoder, AnythingLLM Desktop, Claude Science, DeepSeek Harness, TRAE Work CN, LM Studio, Unsloth Studio, Devin CLI, Cline, MiniMax Code, Command Code, TRAE
    • 🏠 Local-first — Runs on your machine. Parses logs locally with no account or API keys needed.
    • 🚀 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 desktop app — macOS menu bar (+ widgets) and Windows system tray, each with an embedded server and the dashboard in a native webview
    • 🐾 Desktop pet — A pixel companion powered by real coding activity: it works when you work, celebrates streaks, and sleeps when you rest
    • 🎨 4 desktop widgets — Pin Usage / Activity Heatmap / Top Models / Usage Limits to your desktop
    • 🏆 15 achievement tracks — Turn daily usage, streaks, tools, models, and milestones into collectible badges worth sharing
    • 📈 Real-time usage limits — Claude / Codex / Cursor / Gemini / Kimi / Kiro / Grok / Copilot / Antigravity / ZCode / OpenCode Go / Qoder / Qoder CN / Command Code / Ark Coding Plan / Ark Agent Plan / Devin quota windows, with last-good caching when a local provider app is temporarily closed
    • 🟢 Service Status page — live operational and incident status from 8 official provider status pages
    • 💰 Cost engine — 2,200+ models priced via LiteLLM (auto-refreshed daily) + curated overrides for niche tools (Kiro, Cursor Composer, Kimi, CodeBuddy hy3); 24h disk cache + bundled offline snapshot mean accurate USD without an internet connection. Models without published vendor pricing (e.g. Tencent hy3-preview) are tracked by tokens but show $0 cost until the vendor publishes a rate.
    • 🌐 Optional leaderboard — Compare with developers worldwide; drag-to-reorder columns to focus on the providers you care about (opt-in, sign in to participate)
    • 🔄 Cross-device account view — Optional cloud sync merges usage across your machines (laptop, desktop, server) into one view. Off by default; local tracking stays independent.
    • 🧩 Optional Skills tab — browse 250+ public skills from anthropics/skills, ComposioHQ/awesome-claude-skills, skills.sh and any GitHub repo you add; sync them across Claude / Codex / Grok / Antigravity / Gemini / OpenCode / Hermes with named targets and one-click Undo
    • 🔒 Privacy-first — Local usage metrics only (token counts, timestamps, and model names). Prompts, completions, and code never leave your machine.

    🖼️ 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

    Skills Manager — browse 250+ public skills from GitHub & skills.sh, install once, sync to Claude / Codex / AStudio / Grok / Antigravity / Gemini / OpenCode / Hermes. Per-target toggles, one-click Undo, no manual file copying.

    Desktop Pet — a pixel companion that floats on your desktop and reacts to your real token burn: it codes when you code, celebrates streaks, and sleeps when you rest. Import community pets from codex-pets.net with a link or a .codex-pet.zip — V2 pets even turn their head to follow your cursor in 16 directions. macOS, Windows, and web.

    Achievements — 15 tracks turn usage milestones, streaks, tools, and models into collectible badges — with progress visible before each unlock.


    🔌 Supported AI Tools

    ToolDetectionMethod
    Claude Code✅ AutoSessionEnd hook in settings.json
    Codex CLI✅ AutoTOML notify hook in config.toml
    AStudio✅ AutoTOML notify hook in config.toml
    Cursor✅ AutoAPI + SQLite auth token
    Kiro✅ AutoSQLite + JSONL hybrid
    Gemini CLI✅ AutoSessionEnd hook
    OpenCode✅ AutoPlugin system + SQLite
    OpenSquilla✅ AutoPassive SQLite reader for finalized model usage from Desktop (%APPDATA%\@opensquilla\desktop-electron\opensquilla\state\sessions.db) or CLI (~/.opensquilla/state/sessions.db); reads timestamps, model IDs, and token counters only. Override with TOKENTRACKER_OPENSQUILLA_DB
    OpenClaw✅ AutoSession plugin
    Every Code✅ AutoTOML notify hook
    Hermes Agent✅ AutoSQLite sessions table (~/.hermes/state.db)
    GitHub Copilot App / CLI✅ AutoUnified per-request SQLite usage (~/.copilot/session-store.db); App DB legacy baseline
    GitHub Copilot Chat extension / legacy CLI✅ AutoOpenTelemetry file exporter (COPILOT_OTEL_FILE_EXPORTER_PATH)
    Kimi Code✅ AutoPassive wire.jsonl reader (~/.kimi/sessions/**/wire.jsonl)
    oh-my-pi (Pi Coding Agent)✅ AutoPassive reader (~/.omp/agent/sessions/**/*.jsonl) + managed notify extension written by tokentracker init to ~/.omp/agent/extensions/tokentracker-notify.ts for near-real-time sync (skipped if a same-named unmanaged file already exists; removed by tokentracker uninstall when still managed)
    CodeBuddy (Tencent)✅ AutoSessionEnd hook in ~/.codebuddy/settings.json (Claude-Code fork)
    WorkBuddy (Tencent)✅ AutoSessionEnd hook in ~/.workbuddy/settings.json (Claude-Code fork) + passive projects/**/*.jsonl scan
    WorkBuddy AI✅ AutoInternational build: hooks and passive usage under ~/.workbuddy-ai; override with WORKBUDDY_AI_HOME
    Grok Build (xAI)✅ AutoSessionEnd hook + passive updates.jsonl / signals.json scan (~/.grok/sessions/**/)
    Kilo CLI (kilo.ai)✅ AutoPassive SQLite reader (~/.local/share/kilo/kilo.db, OpenCode-fork schema)
    Kilo Code (VS Code extension)✅ AutoPassive ui_messages.json reader (Cursor/Code/CodeBuddy/Windsurf globalStorage)
    Antigravity✅ AutoPassive transcript reader (~/.gemini/{antigravity,antigravity-ide,antigravity-cli}/brain/**/transcript.jsonl); see quota credentials and Linux keyring setup. Disable quota lookup with TOKENTRACKER_DISABLE_ANTIGRAVITY_QUOTA=1
    OmO✅ AutoPassive reader (~/.omo/agent/sessions/**/*.jsonl, subagent transcripts included). Same session format as oh-my-pi but a separate install root, cursor namespace and source label, so both can be tracked side by side. Reasoning tokens are reported as a subset of output (Codex convention) and are never billed twice
    pi (@mariozechner/pi-coding-agent)✅ AutoPassive reader (~/.pi/agent/sessions/**/*.jsonl)
    Dots✅ AutoRouted through pi's provider split (pi-dots source, same passive reader) — no separate hook
    Prime Agent✅ AutoMetadata-only passive usage reader (~/.prime/agent/sessions/*.jsonl; reads usage/model/provider/timestamp, never prompts or responses)
    Craft Agents✅ AutoPassive session reader (~/.craft-agent + workspace session logs)
    Reasonix✅ AutoPassive telemetry reader (~/.reasonix/**/*.jsonl.telemetry.json)
    Muse Code✅ AutoPassive session reader (~/.local/share/muse/sessions/**/session.jsonl; override with TOKENTRACKER_MUSE_HOME)
    Roo Code (VS Code extension)✅ AutoPassive ui_messages.json reader (rooveterinaryinc.roo-cline)
    Zed Agent✅ AutoPassive SQLite reader (threads.db, all providers — hosted zed.dev + bring-your-own)
    Goose (Block)✅ AutoPassive SQLite reader (sessions.db, cumulative deltas)
    Droid (Factory)✅ AutoPassive session reader (~/.factory/sessions/**/settings.json, cumulative deltas)
    Mimo Code (mimocode)✅ AutoPassive SQLite reader (~/.local/share/mimocode/mimocode.db, OpenCode-fork schema; counts only mimo-native turns — mirrored Claude/claude-mem history is excluded)
    DuMate (Baidu)AutoPassive OpenCode SQLite reader (%APPDATA%/qianfan-desktop-app/qianfan_desk_xdg/*/data/opencode/opencode.db); independent dumate source with reinstall-copy deduplication. Override with TOKENTRACKER_DUMATE_HOME. See DuMate collection
    ZCode (Z.ai)✅ AutoPassive SQLite reader (~/.zcode/cli/db/db.sqlite, OpenCode-fork schema; counts only Z.ai/BigModel GLM turns — bundled Claude/Codex/Gemini sub-agents are excluded)
    Qoder✅ AutoPassive SQLite reader (Qoder/SharedClientCache/cache/db/local.db; reads assistant token_info, separates cached input, and never reads prompt or response text), plus Plan Credits and Ultimate Free Calls limits from Qoder's local session. Qoder Desktop 0.4.x limits fall back to scanning the tails of its local main.log/renderer.log files for the account-usage summary (see Qoder desktop limits). Qoder CN (国内版, QoderCN/SharedClientCache/cache/db/local.db) is tracked as its own source with quota from qoder.com.cn.
    LM Studio✅ AutoPassive recursive reader for ~/.lmstudio/server-logs/**/*.log; reads only final-response IDs, models, timestamps, and scalar usage counters from Chat Completions and Responses API records. Mirrored response IDs are deduplicated; prompt and response bodies are never retained. These developer-server records cover local inference and LM Link at zero marginal API cost, not Bionic Secure Cloud billing.
    Unsloth Studio✅ AutoPassive SQLite reader for $UNSLOTH_STUDIO_HOME/studio.db (default ~/.unsloth/studio/studio.db). Reads scalar contextUsage metadata and content-free api_usage_events only; prompts, replies, attachments, API subjects, credentials, and training metrics are excluded. Local routes stay zero-cost, while known paid provider routes use the model that actually answered for estimated token cost.
    AnythingLLM Desktop✅ AutoPassive SQLite reader (anythingllm-desktop/storage/anythingllm.db; reads per-message token metrics only, never prompts or responses)
    Devin CLI (Cognition)✅ AutoPassive SQLite reader ($XDG_DATA_HOME/devin/cli/sessions.db, default ~/.local/share/devin/cli/sessions.db; reads per-request usage metrics deduplicated by request_id — replay/fork/compaction copies never double-count — using the recorded generation model, never prompts, responses, or cogs_json). Devin models (swe-2, swe-2-high, compactor) currently have no pricing data, so their token counts are reported but excluded from dollar estimates — a $0 figure does not mean free usage. No native Windows data dir is known; a WSL install is read via \\wsl$.
    Cline (CLI v3 / desktop app)✅ AutoPassive reader (~/.cline/data/sessions/<id>/*.messages.json). Per-turn metrics are usage deltas where inputTokens already includes cache read+write and outputTokens already includes reasoning, so the cached prefix is subtracted and reasoning is never billed twice; Cline's own per-call cost is trusted when reported. cline-free/* and cline-pass/* gateway models are priced at $0. The VS Code extension's globalStorage layout is not read. Path overrides: TOKENTRACKER_CLINE_SESSIONS_DIR, TOKENTRACKER_CLINE_DATA_DIR, TOKENTRACKER_CLINE_HOME, CLINE_SESSION_DATA_DIR, CLINE_DATA_DIR, or CLINE_DIR
    MiniMax Code✅ AutoPassive reader (~/.minimax/v2/sessions/YYYY/MM/DD/<session>/messages.jsonl). Dedupes on message_id, records the routed upstream model per message, and ignores the always-zero usage.cost in favor of normal pricing. Override the directory with TOKENTRACKER_MINIMAX_HOME
    Command Code✅ AutoPassive session reader (~/.commandcode/projects/<cwd-slug>/<session-id>.jsonl; *.checkpoints.jsonl snapshots and .prompts. sidecars are skipped). Scans transcripts locally and extracts selected usage metadata, including token counts and the CLI's costUsd display estimate. Token Tracker estimates cost with its shared model price table instead. Subtracts both cache reads and writes from cache-inclusive input to avoid double counting. Token Tracker does not persist or upload prompt, reply or code bodies. Override the directory with TOKENTRACKER_COMMANDCODE_HOME
    Claude Science✅ AutoPassive SQLite reader (~/.claude-science/operon-cli.db; reads the frames table's token counters only, never prompts, artifacts or research content). No native Windows build — on Windows the app runs inside WSL and is read from there.
    DeepSeek Harness✅ AutoPassive session reader (~/.dsh/sessions/**/session[.vN].jsonl[.zstd]; parses session header and assistant events, handles multi-frame zstd decompression). Also feeds the Sessions browser with one row per session: subagent sessions nest under their parent, a seeded fork is reported as a branch, and replayed messages are attributed to the log that created them so a fork never bills its parent's tokens twice in the Sessions browser
    TRAE (international)✅ AutoLocal TRAE / TRAE SOLO SQLCipher usage metadata with the shared application key by default; optional TOKENTRACKER_TRAE_SQLCIPHER_KEY override. No vendor API calls. See setup and limitations.
    TRAE Work CN✅ AutoRequires an explicit opt-in: set TOKENTRACKER_TRAE_CN_USAGE=1. Reading usage transmits the locally stored sign-in authorization to TRAE's internal API, so nothing is sent until you turn it on. Once opted in: during eligible non-background sync when local TRAE Work CN auth exists, reads session-token usage from the locally signed-in macOS / Windows app; its internal API may change

    Do I need to install any plugin or hook manually? No. tokentracker (or tokentracker init) handles everything on first run:

    • Hook-based tools (Claude Code, Codex, AStudio, Gemini, Every Code, CodeBuddy, WorkBuddy, Grok Build) — we write a SessionEnd hook or TOML notify entry into the tool's own config.
    • Plugin-based tools (OpenCode, OpenClaw) — plugins ship inside the npm package. OpenClaw's session plugin lives at ~/.tokentracker/tracker/openclaw-plugin/openclaw-session-sync/; we link and enable it via OpenClaw's own CLI, then set hooks.allowConversationAccess=true so OpenClaw permits the session-finished event that triggers sync. No download, no drag-and-drop.
    • oh-my-pi — passive session scan is always the billing/token source of truth (~/.omp/agent/sessions/**/*.jsonl). When OMP is detected, tokentracker init also writes a managed notify extension to ~/.omp/agent/extensions/tokentracker-notify.ts so turns can trigger near-real-time sync. That file is owned only when it carries TokenTracker's managed marker: a same-named user-authored extension is never overwritten or deleted. tokentracker uninstall removes the extension only while it is still managed.
    • OmO — passive session scan only (~/.omo/agent/sessions/**/*.jsonl, including nested subagent transcripts). No plugin or hook is installed. Path overrides, in precedence order: TOKENTRACKER_OMO_AGENT_DIR, then TOKENTRACKER_OMO_HOME / OMO_HOME (appended with /agent). PI_CONFIG_DIR and PI_CODING_AGENT_DIR are not honored: those belong to pi/omp.
    • Cline — passive session scan only (~/.cline/data/sessions/<id>/*.messages.json, Cline CLI v3 / desktop app; the VS Code extension's globalStorage is a separate, older install and is not read). No hook is installed. Per-turn metrics are usage deltas where inputTokens already contains cache read+write, so only the non-cached remainder is billed. Path overrides, in precedence order: TOKENTRACKER_CLINE_SESSIONS_DIR, TOKENTRACKER_CLINE_DATA_DIR, TOKENTRACKER_CLINE_HOME, then Cline's own CLINE_SESSION_DATA_DIR, CLINE_DATA_DIR, CLINE_DIR.
    • Passive readers (Cursor, Kiro, Hermes, Kimi Code, Copilot, Grok Build, OmO, pi, Craft Agents, Reasonix, Muse Code, Kilo CLI, Kilo Code, Roo Code, Antigravity, Zed Agent, Goose, Droid, Mimo Code, DuMate, ZCode, Qoder, LM Studio, Unsloth Studio, OpenSquilla, AnythingLLM Desktop, Devin CLI, MiniMax Code, Claude Science, DeepSeek Harness, Cline) — nothing is installed into those tools. We only read files they already produce (SQLite DB, JSONL, OTEL export, session logs). Copilot App / CLI usage is read per request from ~/.copilot/session-store.db; data.db provides the one-time legacy adoption baseline and stays observe-only after the store becomes canonical, while the Chat extension and legacy CLI continue using OTEL. TokenTracker coordinates the sources so overlapping requests are counted once. Mixed App/CLI usage that predates adoption is retained as a github-copilot-legacy aggregate rather than assigned to a guessed request model.
    • Grok Build estimate — current local telemetry exposes cumulative updates.jsonl totalTokens, but not a stable prompt/output/cache split; signals.json remains a fallback with contextTokensUsed snapshots. TokenTracker estimates Grok cost until per-call usage details are available.
    • Grok product shares — the Grok limits card shows the shared weekly or monthly pool as one bar. The headline follows the Used / Remaining display setting, the same as every other provider. Expand the card (click it in the macOS menu bar) to see each product's share (Grok Build, Chat, Voice, Imagine, and any other product the billing API reports). Those percentages are portions of the amount used, not separate quotas, so in Remaining mode they do not add up to the headline. The stacked bar itself is shown in Used mode.

    Run tokentracker status anytime to verify every integration's state. If something shows skipped, the detail column explains why (e.g. tool CLI not on PATH, config unreadable).

    Deeper dives: OpenClaw integration & troubleshooting.

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


    🆚 Why TokenTracker?

    Looking for a desktop app with widgets and a visual dashboard? TokenTracker pairs local log parsing across AI coding tools with native desktop apps, desktop widgets, provider quota tracking, and optional cloud sync.

    CapabilityTokenTrackerccusageTokscale
    AI tools supported47Multi-agentMulti-agent
    Primary interfaceDesktop apps & web dashboardTerminal CLITerminal TUI & CLI
    Local analysis✅✅✅
    Native desktop apps✅ macOS, Windows, Linux❌❌
    Desktop widgets✅ 4 widgets❌❌
    Rate-limit tracking✅ 18 providersLimited (Claude blocks)Multiple providers
    Terminal analyticsBasic CLI (status, --json)Strong CLI reportingInteractive TUI & CLI
    JSON export✅✅✅
    Public leaderboardOptional (opt-in)❌Optional (submit)

    🏗️ How It Works

    flowchart LR
        A["AI coding tools<br/>Claude Code · Codex · AStudio · Cursor · Gemini · Kiro<br/>OpenCode · OpenClaw · Every Code · Hermes · Copilot<br/>Kimi Code · CodeBuddy · WorkBuddy · Grok Build · Kilo CLI · Kilo Code<br/>Antigravity · oh-my-pi · OmO · pi · Dots · Craft · Roo · Zed · Goose · Droid · Mimo · DuMate · ZCode · Qoder · AnythingLLM · Claude Science · DeepSeek Harness · TRAE · TRAE Work CN · LM Studio · Unsloth Studio · Devin CLI · Cline · MiniMax Code · Command Code"]
        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 — prompts, responses, and code are never saved or uploaded
    4. Aggregated into 30-minute UTC buckets
    5. Dashboard, menu bar app, and widgets all read from the same local snapshot

    Local features remain free and open source. Optional TokenTracker Cloud is the officially hosted cross-device analytics service; see the Cloud guide for plans, trial, and transition rules. Purchases are live at the same worldwide USD base price for recurring and fixed-term access: USD 4.99/month or USD 39.99/year before checkout tax (final amount shown by Waffo). Self-hosted software is free with infrastructure and maintenance handled by its owner; the complete installation is currently a technical preview.

    🛡️ Privacy

    📄 Full Privacy Policy — every network request the app can make, what each one sends, and how to switch it off.

    TokenTracker processes your usage data locally. It never collects or uploads prompts, code, or model responses.

    ProtectionDescription
    No code or prompt collectionTokenTracker parses local log files for token counts and timestamps. Prompts, completions, code, and conversation bodies are never saved or uploaded.
    Local-first by defaultUsage tracking runs entirely on your machine. No account, login, or API keys required. Cloud sync and the public leaderboard are strictly opt-in.
    AuditableOpen source. Check src/lib/rollout.js — only numbers, timestamps, and model names are extracted.
    Transparent network activityFully documented in the Privacy Policy. Default requests are limited to direct provider quota checks (using credentials already on your machine), GitHub star counts, update checks, pricing data refreshes (raw.githubusercontent.com), and anonymous telemetry (daily heartbeat + PostHog pageviews, plus optional Sentry error reports when a DSN is configured — all disabled with TOKENTRACKER_NO_TELEMETRY=1 or DO_NOT_TRACK=1). Telemetry never includes tokens, models, prompts, or code.

    📦 Configuration

    Most users never need this — defaults are sensible. For advanced setups:

    VariableDescriptionDefault
    TOKENTRACKER_DEBUGEnable debug output (1 to enable)—
    TOKENTRACKER_NO_TELEMETRYDisable all anonymous telemetry — daily heartbeat and dashboard analytics (1 to disable; the DO_NOT_TRACK standard is also respected)—
    TOKENTRACKER_HTTP_TIMEOUT_MSHTTP timeout in milliseconds20000
    TOKENTRACKER_DISABLE_GIT_ATTRIBUTIONSkip Git commit attribution (1 to disable). Attribution runs git log inside the working directory of each recent session. Disabling keeps TokenTracker out of your project directories entirely — the Outcomes view then shows only manually recorded outcomes—
    TOKENTRACKER_GIT_ATTRIBUTION_PROTECTED_DIRSLet Git attribution enter macOS TCC-protected locations (1 to allow). By default sessions under ~/Documents, ~/Downloads, ~/Desktop, ~/Library, the media folders and /Volumes are skipped, because macOS raises a separate folder-access prompt for each one. Enable this only if you keep repositories there and don't mind granting access—
    TOKENTRACKER_WSL_MODEWSL install resolution behavior on Windows (for aggregating native and WSL installations). wsl-first (prefer WSL), native-first, wsl-only, native-only, both (aggregate both installs)wsl-first
    CODEX_HOMEOverride Codex CLI directory~/.codex
    TOKENTRACKER_ACODE_HOMEOverride AStudio directory~/.acode
    GEMINI_HOMEOverride Gemini CLI directory~/.gemini
    TOKENTRACKER_GROK_HOMEOverride Grok Build directory for the Grok integration and Skills Manager~/.grok
    GROK_HOMELegacy Grok Build directory override, used when TOKENTRACKER_GROK_HOME is unset~/.grok
    TOKENTRACKER_ANTIGRAVITY_HOMEForce a single Antigravity Skills directory (auto-detects ~/.gemini/antigravity + ~/.gemini/antigravity-ide otherwise)auto
    TOKENTRACKER_DISABLE_ANTIGRAVITY_QUOTASet to 1 to skip all Antigravity credential reads and remote quota lookupsunset
    TOKENTRACKER_LMSTUDIO_HOMEOverride the LM Studio data directory used by the passive server-log reader~/.lmstudio
    TOKENTRACKER_UNSLOTH_DBOverride the Unsloth Studio database file used by the passive usage reader$UNSLOTH_STUDIO_HOME/studio.db
    TOKENTRACKER_OPENSQUILLA_DBOverride the OpenSquilla sessions database used by the passive usage readerDesktop or CLI profile state/sessions.db
    TOKENTRACKER_DEVIN_DBOverride the Devin CLI database file used by the passive usage reader$XDG_DATA_HOME/devin/cli/sessions.db
    TOKENTRACKER_MINIMAX_HOMEOverride the MiniMax Code data directory used by the passive usage reader~/.minimax
    TOKENTRACKER_COMMANDCODE_HOMEOverride the Command Code (cmd) data directory used by the passive session reader~/.commandcode

    Offline usage transfer

    In the local dashboard, open Settings → App → Local data. Export usage on one computer, then select that JSON file on another computer, review the preview and confirm the merge. Imported computers appear in the dashboard's existing device selector and device distribution card. You can remove an imported source from the same settings page.

    Preview totals and device contributions follow the dashboard's current display metric; the original counters remain in the snapshot. Context breakdown is available with this device selected. Project, session and outcome analyses remain local to this computer, with a scope notice when offline sources are present.

    A newer complete snapshot replaces that computer's previous snapshot; importing the same file again does not add usage. Exports contain only this computer's retained device-level history, including token counts, tools, models, time buckets and its device label. They exclude imported sources, credentials, prompts, project/session data, and account-level Cursor/TRAE CN usage. Imported snapshots stay local and never enter the cloud upload queue. Transfer files only between computers with independent histories: copied sessions cannot be deduplicated from aggregated usage. Legacy tokentracker-sync synthetic queues require separate migration. Files are limited to 5 MiB, with up to 32 imported computers.

    🐧 Windows Subsystem for Linux (WSL) Auto-Discovery

    If you run AI coding agents inside WSL on Windows, TokenTracker can auto-discover and aggregate metrics from both native Windows and WSL installations.

    Configure this behavior using the TOKENTRACKER_WSL_MODE environment variable:

    • both (Recommended): Scans and aggregates metrics from both native Windows and WSL.
    • wsl-first (Default): Checks WSL first; if found, uses WSL metrics, otherwise falls back to Windows.
    • native-first: Checks native Windows first; if found, uses Windows metrics, otherwise falls back to WSL.
    • wsl-only: Scans WSL environment only.
    • native-only: Scans native Windows environment only.

    [!NOTE] Preference (-first) vs. Isolation (-only): Preference modes prioritize your choice but gracefully fall back to scanning the other environment if the tool is missing. Isolation modes strictly lock scanning to that single environment and ignore the other completely.

    Supported providers for WSL auto-discovery and aggregation:

    • Dual-Install Aggregation (both mode):
      • File-list & Active CLIs: Every Code, Kimi (legacy & Code), Gemini CLI, Antigravity, OpenCode (JSON), Codex CLI, AStudio, CodeBuddy, WorkBuddy, WorkBuddy AI, oh-my-pi (omp), pi, GitHub Copilot (OTEL), Roo Code, Craft, Kilo Code, Droid, Cline.
      • SQLite-based DBs: Hermes, Zed Agent, Goose, OpenCode (opencode.db), Kilo CLI, Mimo Code, DuMate, ZCode, Qoder, Claude Science (operon-cli.db), GitHub Copilot (App DB).
    • WSL Auto-Discovery (Preference/Isolation only, no dual aggregation):
      • Grok Build (dynamically selects either native or WSL depending on the mode, but does not aggregate both in both mode).
      • Devin CLI (no native Windows data directory is known, so automatic discovery only ever finds a WSL install; native-only mode discovers nothing and both never aggregates a native copy). The TOKENTRACKER_DEVIN_DB override still points at an explicit database file.

    Extra scan roots (multiple profiles, agent harnesses)

    TokenTracker scans ~/.codex and ~/.claude (plus CODEX_HOME / CLAUDE_CONFIG_DIR when the syncing process has them set). If your sessions live somewhere else — a second profile, or an agent harness that gives Codex / Claude Code a private home — list those roots once in ~/.tokentracker/tracker/config.json and every sync (hook-triggered, app background refresh, CLI) walks them:

    {
      "scanRoots": {
        "codex": ["~/.local/share/my-agent/codex"],
        "claude": ["~/.local/share/my-agent/claude", "~/.claude-work"]
      }
    }
    

    Each Codex root is expected to hold sessions/ (and optionally archived_sessions/), each Claude root a projects/ directory. Roots are de-duplicated by resolved path, so a profile whose projects/ is a symlink to another profile's is read once. tokentracker status and tokentracker doctor list the extra roots and flag any that are missing.

    🛠️ Development

    git clone https://github.com/xiufengsun/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

    • Antivirus quarantined tracker.js on Windows — see Antivirus false positives (suspected Kaspersky PDM false positive; vendor review still required).

    ZCode totals decreased after v0.96.0? This release corrects historical cache/reasoning double counting, including previously uploaded months. See the ZCode history correction for the accounting change and local backup details.

    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
    

    WSL2 note: on Windows hosts the Delivery Optimization service (DoSvc) listens on 7680, and under NAT networking the conflict is invisible from inside WSL — the server starts fine but the Windows browser reaches DoSvc instead. TokenTracker therefore defaults to 7681 when running under WSL (logged on startup).

    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 → Open → Open 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/TokenTracker.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.


    🪪 README Badges

    Show off your token usage on your GitHub profile or project README.

    To get YOUR_USER_ID:

    1. Run tokentracker, open the dashboard, and sign in to the leaderboard.
    2. Go to Settings → Account.
    3. Use the User ID shown there. On headless machines, tokentracker device-login also writes the same user_id to ~/.tokentracker/tracker/config.json.

    Then drop one of these in:

    [![tokens](https://srctyff5.us-east.insforge.app/functions/tokentracker-badge-svg?user_id=YOUR_USER_ID&metric=tokens)](https://github.com/xiufengsun/TokenTracker)
    [![cost](https://srctyff5.us-east.insforge.app/functions/tokentracker-badge-svg?user_id=YOUR_USER_ID&metric=cost)](https://github.com/xiufengsun/TokenTracker)
    [![rank](https://srctyff5.us-east.insforge.app/functions/tokentracker-badge-svg?user_id=YOUR_USER_ID&metric=rank)](https://github.com/xiufengsun/TokenTracker)
    

    The link target defaults to the TokenTracker repo so every click helps other developers discover the tool. Swap it for your leaderboard profile, personal site, or https://www.tokentracker.cc if you'd rather route clicks elsewhere.

    Renders shields.io-compatible badges with your current totals (60s cache):

    ParamValuesDefault
    metrictokens / cost / ranktokens
    periodweek / month / totaltotal
    styleflat / flat-squareflat
    labelany short stringmetric name
    colorhex, e.g. ff6b35brand green

    Privacy: badges only resolve for profiles where leaderboard sharing is on (Settings → Account → Public profile). Private profiles get a "private" placeholder.


    ⭐ Star History


    🤝 Contributing & Support

    🙏 Credits

    The bot companion's morphing engine is bloub by Jérémy Perret (MIT).

    The Clawd character design belongs to Anthropic. This is a community project with no official affiliation with Anthropic.

    🔗 Friendly Links

    • LINUX DO — a developer community we like

    License

    MIT


    Token Tracker — Quantify your AI output.

    tokentracker.cc · npm · GitHub