hermes atlas
217·repos hermes·v0.19.0 ★ star this repo

Javis603/token-monitor

Real-time token, cost, and AI limits widget with multi-device sync for Claude Code, Codex, OpenCode, Hermes, OpenClaw, Cursor, Antigravity and more. | 为 AI Tools 打造的即时Token、成本与限额监控桌面组件,支持多设备同步

★ 1.0K langJavaScript licenseMIT updated2026-07-28

Token Monitor is a desktop widget for Windows, macOS, and Linux that tracks live token usage and account limits across more than 28 AI coding tools. It provides a dashboard for monitoring historical trends and usage breakdowns by tool, device, model, session, or project with multi-device synchronization.

  • Tracks token usage and limits for tools like Claude Code and Cursor.
  • Supports real-time multi-device synchronization of usage data.
  • Provides detailed breakdowns of input, output, and cache-hit metrics.
full readme from github

EN | | | KO | JA

Token Monitor logo

Token Monitor

One live dashboard for every AI coding tool, synced across every machine.

Latest release Total downloads Windows 10 or later macOS 14 or later Linux x64 Discord License: MIT

What is Token Monitor?

A desktop widget that shows live token usage and AI Tool Limits across 28+ AI coding tools — Claude Code, Codex, Cursor, GitHub Copilot, and more — with real-time multi-device sync, historical usage trends, and breakdowns by tool, device, model, session, or project.

Supported Tools

Token Monitor supports token usage, account-limit checks, and session details separately:

Logo Tool Data path Token Usage AI Tool Limits Session Details
Claude Code Claude Code ~/.claude/projects/, ~/.claude/transcripts/
Codex Codex ~/.codex/sessions/
OpenCode OpenCode ~/.local/share/opencode/
Hermes Agent Hermes Agent $HERMES_HOME/state.db or ~/.hermes/state.db
OpenClaw OpenClaw ~/.openclaw/agents/
Cursor Cursor ~/.config/tokscale/cursor-cache/ (kept fresh by Cursor sync)
Antigravity Antigravity ~/.config/tokscale/antigravity-cache/ (kept fresh by Antigravity sync)
Cline Cline VS Code globalStorage tasks (.../saoudrizwan.claude-dev/tasks/)
Kimi Kimi CLI / Kimi Code ~/.kimi/sessions/, ~/.kimi-code/sessions/ (KIMI_CODE_HOME); Kimi Code API key (Kimi Code quota via Kimi API)
Qwen Qwen CLI ~/.qwen/projects/
Grok Build Grok Build $GROK_HOME/sessions/ or ~/.grok/sessions/
GitHub Copilot GitHub Copilot VS Code workspaceStorage/*/chatSessions/, ~/.copilot/otel/
Pi Pi ~/.pi/agent/sessions/, ~/.omp/agent/sessions/ (Oh My Pi)
Zed Zed ~/.local/share/zed/threads/threads.db
Kilo Code Kilo Code VS Code globalStorage tasks (.../kilocode.kilo-code/tasks/) — Linux & remote/WSL only
MiMo Code MiMo Code ~/.local/share/mimocode/mimocode.db
ZCode ZCode / GLM ~/.zcode/projects/; Z.ai API key (GLM personal/team Coding Plan quota via Z.ai API)
Kiro Kiro ~/.kiro/sessions/cli/, Kiro IDE globalStorage & kiro-cli DB
CodeBuddy CodeBuddy ~/.codebuddy/projects/ + IDE / VS Code extension logs
WorkBuddy WorkBuddy ~/.workbuddy/projects/, ~/.workbuddy/workbuddy.db
Proma Proma ~/.proma/agent-sessions/*.jsonl
DeepSeek DeepSeek DeepSeek API key (balance via DeepSeek API)
OpenRouter OpenRouter OpenRouter API key (usage/key limit; balance when credits access is authorized, documented for Management keys)
Minimax Minimax Minimax API key (Token Plan quota via Minimax API)
Volcengine Volcengine Ark API key or Volcengine AK/SK (Ark Coding Plan quota via Volcengine API)
Qoder Qoder Qoder dashboard cookie (big-model credits via Qoder usage API)
Ollama Ollama Ollama Cloud cookie (session/weekly usage via ollama.com/settings)
Third-party APIs Third-party APIs New API-compatible account preset (including compatible One API forks), New API API-key preset, and a declarative Custom balance endpoint

Custom maps numeric JSON fields from one GET balance endpoint; OpenAI or Anthropic compatibility alone is not enough.

Showcase

Home View
Customizable dashboard — choose which modules show and their order
Limits View
Multiple accounts side by side, one-click switch of the active Codex account
Tools View
Click any tool to expand input / output and cache-hit detail
Session View
Open a single session to break each prompt into tokens and tools used
Models View
Every model's usage and cost, aggregated across tools
Devices View
Each device's usage, cost, and sync status — expand for per-machine detail
Usage Dashboard Overview
A year of activity heatmap and streaks, aggregated across all devices
Usage Dashboard Trends
A year of daily trends, stacked by tool / model, with K-line

Why Token Monitor?

Most usage monitors are useful on the machine they run on. Token Monitor is built for multi-device work: each device watches its own local logs, sends summary updates to your hub, and every connected widget sees token changes almost immediately.

Features

Tracking usage

  • Live token tracking — Claude Code, Codex, Cursor, GitHub Copilot, Antigravity, OpenCode, and 21+ AI tools, with the UI updating within seconds of each turn (full list in the table above)
  • Per-session detail — open a Claude Code, Codex, or OpenCode session to see tokens per prompt, expandable to each reply's exact token split and tools used (read on-demand from local transcripts or databases, never synced)
  • Cache hit statistics — click any tool or model to expand a detailed breakdown of input tokens (cache hit vs miss), output tokens, and hit-rate percentages
  • Cost & currency — cost alongside token counts, shown in USD, TWD, HKD, or CNY; exchange rates auto-update daily and can be manually overridden in Settings
  • WSL usage (Windows) — file-based usage from a running WSL distro is detected automatically and merged about every 5 minutes; SQLite-backed tools such as OpenCode and Hermes may require a headless agent inside WSL

Limits, trends & export

  • AI Tool Limits detection — provider-specific session, weekly, billing, and credits windows for Claude Code, Codex, Cursor, OpenRouter, third-party APIs, GLM, Kimi, and 18+ providers, including multiple OpenRouter/third-party profiles and DeepSeek prepaid balance/spend
  • Multiple accounts & Codex switching — track several accounts per provider, each with its own limits; a tracked Codex account can be switched as the active local account in one click, without re-authenticating
  • Preserve deleted session usage — many tools prune old sessions (Claude Code drops transcripts after 30 days by default), losing that history. When enabled, Token Monitor archives observed daily tool/model usage locally so the heatmap and trends survive even after the source files are gone (see Session data retention below)
  • Usage Trends & Dashboard — a home-screen activity heatmap and trend chart, plus a dedicated dashboard window with streaks and stacked per-tool/per-model history (bar and K-line views) across all your devices
  • Optional Status view — Claude, OpenAI, Cursor, and DeepSeek status pages, with manual or interval re-checks
  • Data export — export usage as tool-agnostic CSV + JSON, manually or auto-written to a folder, for spreadsheets, Obsidian, Grafana, or scripts; see docs/export.md

Multi-device & deployment

  • Real-time multi-device sync — Server-Sent Events push an update on one device to the others within seconds
  • Local-first — no servers needed for single-device use
  • Self-hosted sync backend — in-widget hub, Node CLI hub, or Cloudflare Worker
  • iOS widget support — Widgy and Scriptable through the Worker hub
  • Privacy-first — prompts, responses, source code, and file contents stay on your machine

Interface & surfaces

  • Breakdown views — grouped by tool, device, model, session, project, or account limits
  • Menu bar (macOS) and system tray (Windows) popover — live cost, tokens, or the closest-to-empty provider limit % next to the icon
  • Floating Bubble mode — collapses the widget into a draggable mini-window with click or hover preview and tray-style content
  • Menu bar layout composer — the menu bar and the floating bubble can use a built-in preset or a layout you build yourself: pick "Custom…" to add AI tool icons, quota bars, percentages, reset times, cost, or custom text, drag to reorder against a live preview, and give each item its own AI tool, account, quota window, and typeface
  • Appearance controls — interface theme switching (incl. a light mode), per-tool vendor colours, glass opacity, blur, and transparent window mode
  • Customizable tool list — hide, pin, and reorder tools in the main dashboard without changing what gets tracked
  • Recordable global shortcut — show or hide the window from anywhere
  • Discord Rich Presence — broadcast today's tokens, cost, and top client (opt-in)

Installation

Download from GitHub Releases.

  • macOS (Apple Silicon).dmg, signed and notarized
  • macOS (Intel) — x64 .dmg, signed and notarized
  • Windows 10/11 — setup and portable .exe, code-signed
  • Linux x64.AppImage

Packaged builds check GitHub Releases automatically. When an update is available, the app shows an update indicator; supported platforms can also install from Settings → General.

First run

Local mode is the default: launch the app and it starts tracking this device. No hub, agent, or config required.

Multi-device sync

Pick ONE hub backend that all your devices (and any headless agents) connect to. On each device, open the widget and pick a mode under Settings → Multi-device Sync. The widget contributes this device's usage automatically; run npm run agent only on machines without a widget.

Option A — Host the hub from the widget (easiest, no CLI)

In the widget on one always-on machine, open Settings → Multi-device Sync and pick Host hub on this device. The widget generates a random secret and lists the LAN URLs other devices can connect to (Tailscale or ZeroTier addresses appear here too). On every other device, pick Connect to a hub and paste the URL + secret.

The hub runs while Token Monitor is running — quitting (not just closing the window) stops it for all connected devices.

Option B — Self-hosted Node hub (always-on headless machine)
# on the always-on machine
cp .env.example .env
# set TOKEN_MONITOR_SECRET to something private, then:
npm run hub
Option C — Cloudflare Worker hub (across networks, including iPhone)

Deploy to Cloudflare

One-click deploy — Cloudflare will prompt for the TOKEN_MONITOR_SECRET during setup. Or deploy manually:

cd worker
npm install
npx wrangler login
npx wrangler secret put TOKEN_MONITOR_SECRET
npx wrangler deploy

Paste the deployed URL into each device's widget at Settings → Multi-device Sync. See worker/README.md for the iOS widget recipe and endpoint reference, or docs/API.md for the hub HTTP API.

App data

App state lives in the OS user-data dir — delete it along with the app to fully uninstall.

Platform Path
macOS ~/Library/Application Support/Token Monitor/
Windows %APPDATA%/Token Monitor/
Linux ~/.config/Token Monitor/

Build from source

To build your own installer, use Node.js 22.13+ on the target OS (electron-builder can't cross-build a macOS .dmg on Windows, or vice-versa).

npm install
npm run dist:mac     # macOS arm64 .dmg           → dist/
npm run dist:mac:x64 # macOS Intel x64 .dmg       → dist/
npm run dist:win     # Windows x64 installer .exe → dist/
npm run dist:linux   # Linux x64 AppImage         → dist/
npm run pack         # unpacked app dir (no installer), for quick local testing

Output lands in dist/. Windows and Linux use the matching dist:* script above on the target OS. Packaging the macOS release build requires a local Developer ID Application signing identity; use npm start for local development or unsupported platforms.

How it works

Mode A — Local (default, no setup)
    widget (Electron) ──▶ tokscale ──▶ ~/.claude, ~/.codex, $HERMES_HOME

Mode B — Sync (opt-in, multi-device)
    device A agent ──▶
    device B agent ──▶  hub  ──▶  widget on any device
    device C agent ──▶

The widget chooses local vs sync mode based on Settings → Multi-device Sync. The hub itself can run as a separate npm run hub process, a Cloudflare Worker, or directly inside one of the widgets (Host mode). In sync mode the hub pushes aggregated stats to every connected widget over Server-Sent Events, so updates on one device appear on the others within a few seconds.

Session data retention

With Preserve deleted session usage enabled (Settings → Collection), Token Monitor archives observed daily tool/model usage locally with no time limit — so even after a source tool prunes its own sessions, the heatmap and trends are unaffected.

Advanced: extend the source tool's own retention

The heatmap and sync payload use a rolling 370-day window (older observations remain available locally for future views). Claude Code keeps only 30 days of transcripts by default (cleanupPeriodDays); to keep the full rolling year before the archive kicks in, raise it in ~/.claude/settings.json before the window passes:

{
  "cleanupPeriodDays": 370
}

A larger value keeps more, at the cost of transcripts living on disk for as long as you set. tokscale's Session Data Retention table covers the other tools' defaults and config paths.

This archive only covers days Token Monitor has already observed; data deleted before it started tracking cannot be recovered.

Settings

There are two places to configure Token Monitor; day-to-day use only needs the first:

  • Widget (GUI) — click the button in the bottom-right corner. Sections, in order: General (language, launch at login, updates), Main (Home modules and display currency), Window (window behavior, menu bar and floating-bubble layout, tray mode, shortcut), Appearance (theme and vendor colours), Collection (tracked tools, collection cadence, Preserve deleted session usage, data export), AI Tool Limits, Accounts (per-provider credentials), and Multi-device Sync. The button in the title bar cycles the window behavior.
  • Headless agent & hub — no UI; configured with a .env file at the project root (copy from .env.example), precedence CLI flag → env var → built-in default.

See the configuration reference for every setting and all environment variables.

Privacy

Token Monitor processes usage logs locally and sends no analytics or telemetry to the project maintainer. Network access occurs only for documented or user-enabled features. See the privacy policy for the data used by updates, provider integrations, Discord Rich Presence, and optional multi-device sync.

Star History

Star History Chart

Contributing

Issues and PRs are welcome. Project conventions, architecture notes, and the command reference live in AGENTS.md — written for coding agents, but it doubles as the contributor guide.

Acknowledgments

License

MIT © @Javis