[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-83848":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":17,"stars7d":18,"stars30d":18,"stars90d":16,"forks30d":16,"starsTrendScore":19,"compositeScore":20,"rankGlobal":10,"rankLanguage":10,"license":21,"archived":22,"fork":22,"defaultBranch":23,"hasWiki":24,"hasPages":24,"topics":25,"createdAt":10,"pushedAt":10,"updatedAt":46,"readmeContent":47,"aiSummary":10,"trendingCount":16,"starSnapshotCount":16,"syncStatus":48,"lastSyncTime":49,"discoverSource":50},83848,"token-monitor","Javis603\u002Ftoken-monitor","Javis603","Real-time token, cost, and AI limits widget with multi-device sync for Claude Code, Codex, OpenCode, Hermes, OpenClaw, Cursor, and Antigravity. | 为 AI Tools 打造的即时Token、成本与限额监控桌面组件，支持多设备同步","http:\u002F\u002Fjavis-ai.com\u002Ftoken-monitor\u002F",null,"JavaScript",175,6,1,3,0,14,108,97,2.54,"MIT License",false,"main",true,[26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45],"ai","ai-tools","antigravity","claude-code","cloudflare-workers","codex","cursor","hermes-agent","linux","llm","llm-monitoring","local-first","macos","multi-device","openclaw","opencode","self-hosted","token-tracker","token-usage","windows","2026-06-12 02:04:35","\u003Cp align=\"right\">\n   \u003Cstrong>EN\u003C\u002Fstrong> | \u003Ca href=\".\u002FREADME.zh-CN.md\">简\u003C\u002Fa> | \u003Ca href=\".\u002FREADME.zh-TW.md\">繁\u003C\u002Fa>\n\u003C\u002Fp>\n\u003Cdiv align=\"center\">\n    \u003Cimg src=\".github\u002Fassets\u002Fapp.png\" alt=\"Token Monitor logo\" width=\"120\">\n    \u003Ch1>Token Monitor\u003C\u002Fh1>\n\u003C\u002Fdiv>\n\n\u003Cp align=\"center\">\n    \u003Cem>One live dashboard for every AI coding tool, synced across every machine.\u003C\u002Fem>\n\u003C\u002Fp>\n\n\u003Cp align=\"center\">\n    \u003Ca href=\"https:\u002F\u002Fgithub.com\u002FJavis603\u002Ftoken-monitor\u002Freleases\">\u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fv\u002Frelease\u002FJavis603\u002Ftoken-monitor?include_prereleases&style=flat-square&label=release&color=22c55e\" alt=\"Latest release\" \u002F>\u003C\u002Fa>\n    \u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FWindows-10%2B-0078D4?style=flat-square\" alt=\"Windows 10 or later\" \u002F>\n    \u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FmacOS-14%2B-0A84FF?style=flat-square&logo=apple&logoColor=white\" alt=\"macOS 14 or later\" \u002F>\n    \u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FiOS-16%2B-0A84FF?style=flat-square&logo=apple&logoColor=white\" alt=\"iOS 16 or later\" \u002F>\n    \u003Ca href=\"worker\u002FREADME.md\">\u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FWorker-Cloudflare-F38020?style=flat-square&logo=cloudflare&logoColor=white\" alt=\"Cloudflare Worker\" \u002F>\u003C\u002Fa>\n    \u003Ca href=\"https:\u002F\u002Fdiscord.gg\u002FHmdNVVvw5P\">\u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fdiscord\u002F1344259784219689031?color=5865F2&label=Discord&logo=discord&logoColor=white&style=flat-square\" alt=\"Discord\">\u003C\u002Fa>\n    \u003Ca href=\"LICENSE\">\u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Flicense-MIT-A855F7?style=flat-square\" alt=\"License: MIT\" \u002F>\u003C\u002Fa>\n\u003C\u002Fp>\n\n\u003Cdiv align=\"center\">\n    \u003Cimg src=\".github\u002Fassets\u002Fdemo.gif\">\n\u003C\u002Fdiv>\n\n## What is Token Monitor?\n\nA desktop widget that shows live token usage and AI Tool Limits across your AI coding tools — Claude Code, Codex, Hermes Agent, OpenCode, OpenClaw, Cursor, Antigravity, and more — with breakdowns by tool, device, and model.\n\nIt runs entirely on your own machine by default. Add an optional hub to sync token changes from multiple Macs, Windows PCs, headless agents, and iPhone widgets in seconds.\n\nOnly summary numbers ever leave your machine. Raw prompts, source files, and conversation transcripts stay local.\n\n## Supported Tools\n\nToken Monitor supports token usage, account-limit checks, and session details separately:\n\n| Logo | Tool | Data path | Token Usage | AI Tool Limits | Session Details |\n|:---:|------|-----------|:---:|:---:|:---:|\n| \u003Cimg src=\".github\u002Fassets\u002Ftools-icon\u002Fclaude.png\" width=\"28\" alt=\"Claude Code\" \u002F> | Claude Code | `~\u002F.claude\u002Fprojects\u002F`, `~\u002F.claude\u002Ftranscripts\u002F` | ✅ | ✅ | ✅ |\n| \u003Cimg src=\".github\u002Fassets\u002Ftools-icon\u002Fcodex.png\" width=\"28\" alt=\"Codex\" \u002F> | Codex | `~\u002F.codex\u002Fsessions\u002F` | ✅ | ✅ | ✅ |\n| \u003Cimg src=\".github\u002Fassets\u002Ftools-icon\u002Fopencode.png\" width=\"28\" alt=\"OpenCode\" \u002F> | OpenCode | `~\u002F.local\u002Fshare\u002Fopencode\u002F` | ✅ | ✅ | ✅ |\n| \u003Cimg src=\".github\u002Fassets\u002Ftools-icon\u002Fhermes-agent.png\" width=\"28\" alt=\"Hermes Agent\" \u002F> | Hermes Agent | `$HERMES_HOME` or `~\u002F.hermes\u002F` | ✅ | — | — |\n| \u003Cimg src=\".github\u002Fassets\u002Ftools-icon\u002Fopenclaw.png\" width=\"28\" alt=\"OpenClaw\" \u002F> | OpenClaw | `~\u002F.openclaw\u002Fagents\u002F` | ✅ | — | — |\n| \u003Cimg src=\".github\u002Fassets\u002Ftools-icon\u002Fcursor.png\" width=\"28\" alt=\"Cursor\" \u002F> | Cursor | `~\u002F.config\u002Ftokscale\u002Fcursor-cache\u002F` (kept fresh by Cursor sync) | ✅ | ✅ | — |\n| \u003Cimg src=\".github\u002Fassets\u002Ftools-icon\u002Fantigravity.png\" width=\"28\" alt=\"Antigravity\" \u002F> | Antigravity | `~\u002F.config\u002Ftokscale\u002Fantigravity-cache\u002F` (kept fresh by Antigravity sync) | ✅ | ✅ | — |\n| \u003Cimg src=\".github\u002Fassets\u002Ftools-icon\u002Fdeepseek.png\" width=\"28\" alt=\"DeepSeek\" \u002F> | DeepSeek | DeepSeek API key (balance via DeepSeek API) | — | ✅ | — |\n\n## Why Token Monitor?\n\nMost 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.\n\n## Features\n\n- **Live token tracking** for Claude Code, Codex, Hermes Agent, OpenCode, OpenClaw, Cursor, and Antigravity (UI updates within seconds of each turn)\n- **Real-time multi-device sync** over Server-Sent Events\n- **Breakdown views** grouped by tool, device, model, session, or account limits\n- **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)\n- **Cost breakdown** alongside token counts\n- **AI Tool Limits detection** for Claude Code, Codex, Cursor, Antigravity, and OpenCode with session, weekly, billing, and credits windows, plus DeepSeek prepaid balance and today\u002Fmonth spend\n- **Optional Status view** for Claude, OpenAI, Cursor, and DeepSeek status pages, with manual or interval re-checks\n- **Customizable tool list** to hide, pin, and reorder tools in the main dashboard without changing what gets tracked\n- **Appearance controls** for glass opacity, blur, and transparent window mode\n- **Menu bar (macOS) and system tray (Windows) popover** with live cost, tokens, or closest Claude\u002FCodex\u002FCursor\u002FAntigravity\u002FOpenCode limit % next to the icon\n- **Floating Bubble mode** that collapses the widget into a draggable mini-window with click or hover preview and tray-style content\n- **Recordable global shortcut** to show or hide the window from anywhere\n- **Local-first:** no servers needed for single-device use\n- **Self-hosted sync backend** (in-widget hub, Node CLI hub, or Cloudflare Worker)\n- **iOS widget support** via Widgy and Scriptable through the Worker hub\n- **Discord Rich Presence** to broadcast today's tokens, cost, and top client (opt-in)\n- **Privacy-first:** only summary numbers ever leave your machine\n\n| Limits View | Devices View | Models View |\n|:---:|:---:|:---:|\n| ![Limits View](.github\u002Fassets\u002Flimits-view.png) | ![Devices View](.github\u002Fassets\u002Fdevices-view.png) | ![Models View](.github\u002Fassets\u002Fmodels-view.png) |\n\n| Session View | Session Details | Discord Rich Presence |\n|:---:|:---:|:---:|\n| ![Session View](.github\u002Fassets\u002Fsessions-view.png) | ![Session Details](.github\u002Fassets\u002Fsession-details.png) | ![Discord Rich Presence](.github\u002Fassets\u002Fdiscord-rpc.png) |\n\n## Installation\n\n### Local mode — single device\n\nThe default. No hub, no agent, no config.\n\n```bash\nnpm install\nnpm start\n```\n\n### Multi-device sync\n\nPick 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.\n\n#### Option A — Host the hub from the widget (easiest, no CLI)\n\nIn 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.\n\nThe hub runs while Token Monitor is running — quitting (not just closing the window) stops it for all connected devices.\n\n#### Option B — Self-hosted Node hub (always-on headless machine)\n\n```bash\n# on the always-on machine\ncp .env.example .env\n# set TOKEN_MONITOR_SECRET to something private, then:\nnpm run hub\n```\n\n#### Option C — Cloudflare Worker hub (across networks, including iPhone)\n\n[![Deploy to Cloudflare](https:\u002F\u002Fdeploy.workers.cloudflare.com\u002Fbutton)](https:\u002F\u002Fdeploy.workers.cloudflare.com\u002F?url=https:\u002F\u002Fgithub.com\u002FJavis603\u002Ftoken-monitor\u002Ftree\u002Fmain\u002Fworker)\n\nOne-click deploy — Cloudflare will prompt for the `TOKEN_MONITOR_SECRET` during setup. Or deploy manually:\n\n```bash\ncd worker\nnpm install\nnpx wrangler login\nnpx wrangler secret put TOKEN_MONITOR_SECRET\nnpx wrangler deploy\n```\n\nPaste the deployed URL into each device's widget at Settings → Multi-device Sync. See [worker\u002FREADME.md](worker\u002FREADME.md) for the iOS widget recipe and endpoint reference, or [docs\u002FAPI.md](docs\u002FAPI.md) for the hub HTTP API.\n\n## Desktop installer\n\nYou can download the app from the [releases page](https:\u002F\u002Fgithub.com\u002FJavis603\u002Ftoken-monitor\u002Freleases). All releases are unsigned; release notes include first-launch unlock steps for macOS (arm64) and Windows (x64). Other platforms run from source via `npm start`.\n\nApp state lives in the OS user-data dir — delete it along with the app to fully uninstall.\n\n| Platform | Path |\n|----------|------|\n| macOS | `~\u002FLibrary\u002FApplication Support\u002FToken Monitor\u002F` |\n| Windows | `%APPDATA%\u002FToken Monitor\u002F` |\n\n## Build from source\n\nReleases are unsigned, so you may prefer to build your own installer — same code, your machine. Needs Node.js 18.17+ and the **target** OS (electron-builder can't cross-build a macOS `.dmg` on Windows, or vice-versa).\n\n```bash\nnpm install\nnpm run dist:mac   # macOS arm64 .dmg          → dist\u002F\nnpm run dist:win   # Windows x64 installer .exe → dist\u002F\nnpm run pack       # unpacked app dir (no installer), for quick local testing\n```\n\nOutput lands in `dist\u002F`. Builds are unsigned, so the same first-launch unlock steps apply. Linux and Intel Macs have no packaging target — run directly with `npm start`.\n\n## How it works\n\n```text\nMode A — Local (default, no setup)\n    widget (Electron) ──▶ tokscale ──▶ ~\u002F.claude, ~\u002F.codex, $HERMES_HOME\n\nMode B — Sync (opt-in, multi-device)\n    device A agent ──▶\n    device B agent ──▶  hub  ──▶  widget on any device\n    device C agent ──▶\n```\n\nThe 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.\n\n## Settings\n\n### Widget (GUI)\n\nClick the `⚙` button in the widget header to open the Settings panel.\n\n- **Multi-device Sync** — three modes: **Local only** (this device, no hub), **Connect to a hub** (paste another machine's Hub URL + secret), or **Host hub on this device** (open a hub here so other devices can connect; LAN\u002FTailscale\u002FZeroTier addresses are listed for you).\n- **Tracked Tools** — choose which AI tools are collected, and independently hide, pin, or reorder tools in the main list.\n- **AI Tool Limits** — choose Claude Code, Codex, Cursor, Antigravity, OpenCode, and DeepSeek limit detection and refresh frequency.\n- **Window behavior** — choose floating above apps, a normal window, or desktop pinned mode.\n- **Tray Mode** — switch to a menu bar (macOS) or system tray (Windows) popover and choose what shows next to the icon: cost, today's tokens, total tokens, cost + tokens, the closest Claude\u002FCodex\u002FCursor\u002FAntigravity\u002FOpenCode limit % left, or icon-only.\n- **Floating Bubble** — collapse the widget into a draggable mini-window, reopen it by click or hover preview, and choose bubble content from icon, tokens, cost, or AI Tool Limit bars.\n- **Shortcut** — record a global shortcut to show or hide the window.\n- **Appearance** — system glass, live dot, tool icons, Discord Rich Presence, glass opacity, and glass blur.\n- **Advanced** — opens the underlying `settings.json` for less-common options like `allTimeSince`.\n\nThe pin button in the widget header toggles \"always on top\".\n\n### Headless agent and hub (`.env`)\n\nThe agent and hub have no UI. Configure them with a `.env` file at the project root (copy from `.env.example`):\n\n```env\nTOKEN_MONITOR_HUB_URL=               # required for sync mode — Worker URL or http:\u002F\u002F\u003Clan-ip>:17321\nTOKEN_MONITOR_SECRET=                # shared secret, must match the hub\nTOKEN_MONITOR_DEVICE_ID=             # optional — defaults to hostname\nTOKEN_MONITOR_CLIENTS=               # optional — defaults to all supported tools; set empty to disable tracking\nTOKEN_MONITOR_HISTORY_ENABLED=       # optional — defaults to disabled; set to 1 to collect Trends history\nTOKEN_MONITOR_LIMITS_ENABLED=        # optional — defaults to enabled; set to 0 to skip CLI probing\nTOKEN_MONITOR_LIMIT_PROVIDERS=       # optional — defaults to all supported (claude, codex, cursor, antigravity, opencode, deepseek)\n```\n\nThe widget reads the same env vars as first-run defaults, then takes over with its own GUI-managed settings.\n\nEvery value can also be passed as a CLI flag (`--hub=`, `--secret=`, `--device=`, `--clients=`, `--history=`, `--limits=`, `--limitProviders=`) — flags win over env. Less-common knobs (`TOKEN_MONITOR_INTERVAL_MS`, `TOKEN_MONITOR_PORT`, `TOKEN_MONITOR_STALE_AFTER_MS`, `TOKEN_MONITOR_HISTORY_INTERVAL_MS`, `TOKEN_MONITOR_LIMITS_REFRESH_MS`, …) are also accepted via env \u002F flag but kept out of `.env.example` to reduce noise.\n\nExample one-off run:\n\n```bash\nnpm run agent -- --clients=claude,codex,opencode --once\n```\n\n## Privacy\n\nThe hub and agent only transmit summary fields:\n\n- device id, hostname, platform\n- total tokens per period (today \u002F month \u002F all-time)\n- cost totals (when `tokscale` returns cost data)\n- per-client and per-model breakdowns\n- normalized Claude Code\u002FCodex\u002FCursor\u002FAntigravity\u002FOpenCode limit status when AI Tool Limits is enabled\n\nThey do not transmit raw AI logs, prompts, source code, or conversation\ncontent. They also do not transmit OAuth credentials, access tokens, refresh\ntokens, emails, or raw provider responses. `.env`, `data\u002F`, and `node_modules\u002F`\nare gitignored.\n\n## Requirements\n\n- macOS or Windows\n- Node.js 18.17+\n- For sync mode only: network reachability from each agent\u002Fwidget to the hub\n\n## Acknowledgments\n\n- [tokscale](https:\u002F\u002Fgithub.com\u002Fjunhoyeo\u002Ftokscale) for log parsing and token accounting.\n- [CodexBar](https:\u002F\u002Fgithub.com\u002Fsteipete\u002FCodexBar) for AI Tool Limits research.\n\n## License\n\n[MIT](LICENSE) © [@Javis](https:\u002F\u002Fgithub.com\u002FJavis603)\n",2,"2026-06-11 04:11:38","CREATED_QUERY"]