@ipv9/tokentracker-cli 0.39.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (192) hide show
  1. package/LICENSE +21 -0
  2. package/README.ja.md +464 -0
  3. package/README.ko.md +464 -0
  4. package/README.md +476 -0
  5. package/README.zh-CN.md +469 -0
  6. package/bin/tracker.js +52 -0
  7. package/dashboard/dist/app-icon.png +0 -0
  8. package/dashboard/dist/apple-touch-icon.png +0 -0
  9. package/dashboard/dist/assets/ActivityHeatmap-BxBGHY1z.js +42 -0
  10. package/dashboard/dist/assets/Card-GROxUc_6.js +1 -0
  11. package/dashboard/dist/assets/DashboardPage-BZ5VFoBk.js +19 -0
  12. package/dashboard/dist/assets/DevicePage-CQts7ivB.js +1 -0
  13. package/dashboard/dist/assets/DialogTitle-DqFsk26U.js +1 -0
  14. package/dashboard/dist/assets/FadeIn-HBBXW_3q.js +1 -0
  15. package/dashboard/dist/assets/HeaderGithubStar-COD2HfaF.js +1 -0
  16. package/dashboard/dist/assets/IpCheckPage-Cn0l8-BQ.js +15 -0
  17. package/dashboard/dist/assets/LandingPage-CmV1BMU4.js +4356 -0
  18. package/dashboard/dist/assets/LeaderboardAvatar-CiIpWZwb.js +1 -0
  19. package/dashboard/dist/assets/LeaderboardPage-BU0mlR3g.js +6 -0
  20. package/dashboard/dist/assets/LeaderboardProfileModal-C49_3Xm9.js +72 -0
  21. package/dashboard/dist/assets/LeaderboardProfilePage-Bh1n0BAM.js +1 -0
  22. package/dashboard/dist/assets/LimitsPage-fZAmwLWT.js +2 -0
  23. package/dashboard/dist/assets/LocalOnlyNotice-D3rQdA-P.js +1 -0
  24. package/dashboard/dist/assets/LoginPage-enO4XP-c.js +1 -0
  25. package/dashboard/dist/assets/PopoverPopup-pitJEpN1.js +1 -0
  26. package/dashboard/dist/assets/Select-tT9x4ntD.js +1 -0
  27. package/dashboard/dist/assets/SelectItemText-C7F7eIm0.js +1 -0
  28. package/dashboard/dist/assets/SettingsPage-pDasZNU2.js +1 -0
  29. package/dashboard/dist/assets/SkillsPage-DEu7FY-2.js +1 -0
  30. package/dashboard/dist/assets/WidgetsPage-DGcO7rbp.js +1 -0
  31. package/dashboard/dist/assets/WrappedPage-D_1ID213.js +1 -0
  32. package/dashboard/dist/assets/agent-logos-DXQVg1xy.js +1 -0
  33. package/dashboard/dist/assets/arrow-up-right-DNLo92Ba.js +1 -0
  34. package/dashboard/dist/assets/download-DbBBBpJF.js +1 -0
  35. package/dashboard/dist/assets/geist-mono-cyrillic-400-normal-BPBWmzPh.woff +0 -0
  36. package/dashboard/dist/assets/geist-mono-cyrillic-400-normal-Ce5q_31Z.woff2 +0 -0
  37. package/dashboard/dist/assets/geist-mono-cyrillic-500-normal-CJBLNVQT.woff2 +0 -0
  38. package/dashboard/dist/assets/geist-mono-cyrillic-500-normal-mNhfPmgl.woff +0 -0
  39. package/dashboard/dist/assets/geist-mono-cyrillic-700-normal-DH5Q319x.woff +0 -0
  40. package/dashboard/dist/assets/geist-mono-cyrillic-700-normal-VCNRadI3.woff2 +0 -0
  41. package/dashboard/dist/assets/geist-mono-cyrillic-900-normal-BKC3PZkM.woff +0 -0
  42. package/dashboard/dist/assets/geist-mono-cyrillic-900-normal-DdrQ8KBw.woff2 +0 -0
  43. package/dashboard/dist/assets/geist-mono-latin-400-normal-CoULgQGM.woff +0 -0
  44. package/dashboard/dist/assets/geist-mono-latin-400-normal-LC9RFr9I.woff2 +0 -0
  45. package/dashboard/dist/assets/geist-mono-latin-500-normal-D3o2eNa9.woff2 +0 -0
  46. package/dashboard/dist/assets/geist-mono-latin-500-normal-DOxI7kZ4.woff +0 -0
  47. package/dashboard/dist/assets/geist-mono-latin-700-normal-D6izGJRP.woff2 +0 -0
  48. package/dashboard/dist/assets/geist-mono-latin-700-normal-QGw08Lff.woff +0 -0
  49. package/dashboard/dist/assets/geist-mono-latin-900-normal-CmoKXrdK.woff +0 -0
  50. package/dashboard/dist/assets/geist-mono-latin-900-normal-Cu5MFKsu.woff2 +0 -0
  51. package/dashboard/dist/assets/geist-mono-latin-ext-400-normal-Cgks_Qgx.woff2 +0 -0
  52. package/dashboard/dist/assets/geist-mono-latin-ext-400-normal-CxNRRMGd.woff +0 -0
  53. package/dashboard/dist/assets/geist-mono-latin-ext-500-normal-CQcGuCNt.woff2 +0 -0
  54. package/dashboard/dist/assets/geist-mono-latin-ext-500-normal-diTenJ8L.woff +0 -0
  55. package/dashboard/dist/assets/geist-mono-latin-ext-700-normal-BX9f1BHp.woff +0 -0
  56. package/dashboard/dist/assets/geist-mono-latin-ext-700-normal-YOllDaLV.woff2 +0 -0
  57. package/dashboard/dist/assets/geist-mono-latin-ext-900-normal-Br6WNUGb.woff +0 -0
  58. package/dashboard/dist/assets/geist-mono-latin-ext-900-normal-CrmBTzU2.woff2 +0 -0
  59. package/dashboard/dist/assets/index-BeoRn2gJ.js +2 -0
  60. package/dashboard/dist/assets/info-Bh5qTz6k.js +1 -0
  61. package/dashboard/dist/assets/main-BIY3Nj6I.js +969 -0
  62. package/dashboard/dist/assets/main-G_F9Iu_x.css +1 -0
  63. package/dashboard/dist/assets/use-limits-display-prefs-B4iJ-bBc.js +1 -0
  64. package/dashboard/dist/assets/use-native-settings-DHjPFDv8.js +1 -0
  65. package/dashboard/dist/assets/use-usage-limits-odqe9OY7.js +1 -0
  66. package/dashboard/dist/assets/useCurrency-BsSZiZMP.js +1 -0
  67. package/dashboard/dist/assets/useOpenInteractionType-BQhgq4rv.js +12 -0
  68. package/dashboard/dist/brand-logos/antigravity.svg +1 -0
  69. package/dashboard/dist/brand-logos/claude-code.svg +1 -0
  70. package/dashboard/dist/brand-logos/codebuddy.svg +1 -0
  71. package/dashboard/dist/brand-logos/codex.svg +15 -0
  72. package/dashboard/dist/brand-logos/copilot.svg +1 -0
  73. package/dashboard/dist/brand-logos/cursor.svg +1 -0
  74. package/dashboard/dist/brand-logos/gemini.svg +1 -0
  75. package/dashboard/dist/brand-logos/grok.svg +1 -0
  76. package/dashboard/dist/brand-logos/hermes.svg +1 -0
  77. package/dashboard/dist/brand-logos/kilo.svg +4 -0
  78. package/dashboard/dist/brand-logos/kimi.svg +1 -0
  79. package/dashboard/dist/brand-logos/kiro.svg +1 -0
  80. package/dashboard/dist/brand-logos/openclaw.svg +22 -0
  81. package/dashboard/dist/brand-logos/opencode.svg +3 -0
  82. package/dashboard/dist/clawd/happy.svg +161 -0
  83. package/dashboard/dist/clawd/idle/collapse.svg +101 -0
  84. package/dashboard/dist/clawd/idle/doze.svg +72 -0
  85. package/dashboard/dist/clawd/idle/follow.svg +64 -0
  86. package/dashboard/dist/clawd/idle/living.svg +196 -0
  87. package/dashboard/dist/clawd/idle/look.svg +115 -0
  88. package/dashboard/dist/clawd/idle/yawn.svg +158 -0
  89. package/dashboard/dist/clawd/mini/alert.svg +129 -0
  90. package/dashboard/dist/clawd/mini/crabwalk.svg +76 -0
  91. package/dashboard/dist/clawd/mini/enter-sleep.svg +65 -0
  92. package/dashboard/dist/clawd/mini/enter.svg +115 -0
  93. package/dashboard/dist/clawd/mini/happy.svg +124 -0
  94. package/dashboard/dist/clawd/mini/idle-tight.svg +15 -0
  95. package/dashboard/dist/clawd/mini/idle.svg +83 -0
  96. package/dashboard/dist/clawd/mini/peek.svg +82 -0
  97. package/dashboard/dist/clawd/mini/sleep.svg +112 -0
  98. package/dashboard/dist/clawd/react/double.svg +108 -0
  99. package/dashboard/dist/clawd/react/drag.svg +102 -0
  100. package/dashboard/dist/clawd/react/left.svg +102 -0
  101. package/dashboard/dist/clawd/react/right.svg +102 -0
  102. package/dashboard/dist/clawd/sleep/collapse-sleep.svg +247 -0
  103. package/dashboard/dist/clawd/sleep/sleeping.svg +118 -0
  104. package/dashboard/dist/clawd/sleep/wake.svg +277 -0
  105. package/dashboard/dist/clawd/static-base.svg +21 -0
  106. package/dashboard/dist/clawd/status/disconnected.svg +136 -0
  107. package/dashboard/dist/clawd/status/error.svg +94 -0
  108. package/dashboard/dist/clawd/status/notification.svg +134 -0
  109. package/dashboard/dist/clawd/working/building.svg +231 -0
  110. package/dashboard/dist/clawd/working/carrying.svg +107 -0
  111. package/dashboard/dist/clawd/working/conducting.svg +118 -0
  112. package/dashboard/dist/clawd/working/confused.svg +113 -0
  113. package/dashboard/dist/clawd/working/debugger.svg +91 -0
  114. package/dashboard/dist/clawd/working/juggling.svg +82 -0
  115. package/dashboard/dist/clawd/working/overheated.svg +75 -0
  116. package/dashboard/dist/clawd/working/pushing.svg +125 -0
  117. package/dashboard/dist/clawd/working/sweeping.svg +79 -0
  118. package/dashboard/dist/clawd/working/thinking.svg +119 -0
  119. package/dashboard/dist/clawd/working/typing.svg +153 -0
  120. package/dashboard/dist/clawd/working/ultrathink.svg +166 -0
  121. package/dashboard/dist/clawd/working/wizard.svg +98 -0
  122. package/dashboard/dist/dashboard-dark.png +0 -0
  123. package/dashboard/dist/favicon-16.png +0 -0
  124. package/dashboard/dist/favicon-32.png +0 -0
  125. package/dashboard/dist/favicon.ico +0 -0
  126. package/dashboard/dist/feed.xml +34 -0
  127. package/dashboard/dist/icon-192.png +0 -0
  128. package/dashboard/dist/icon-512.png +0 -0
  129. package/dashboard/dist/index.html +355 -0
  130. package/dashboard/dist/llms.txt +53 -0
  131. package/dashboard/dist/neon_bg.png +0 -0
  132. package/dashboard/dist/robots.txt +7 -0
  133. package/dashboard/dist/share.html +140 -0
  134. package/dashboard/dist/sitemap.xml +27 -0
  135. package/dashboard/dist/widgets-overview.png +0 -0
  136. package/package.json +78 -0
  137. package/scripts/install-local-service.sh +140 -0
  138. package/scripts/uninstall-local-service.sh +21 -0
  139. package/src/cli.js +95 -0
  140. package/src/commands/device-login.js +161 -0
  141. package/src/commands/diagnostics.js +38 -0
  142. package/src/commands/doctor.js +96 -0
  143. package/src/commands/init.js +1195 -0
  144. package/src/commands/serve.js +351 -0
  145. package/src/commands/status.js +609 -0
  146. package/src/commands/sync.js +2285 -0
  147. package/src/commands/uninstall.js +189 -0
  148. package/src/commands/wrapped.js +150 -0
  149. package/src/lib/antigravity-paths.js +48 -0
  150. package/src/lib/browser-auth.js +281 -0
  151. package/src/lib/categorizer-utils.js +232 -0
  152. package/src/lib/claude-categorizer.js +1319 -0
  153. package/src/lib/claude-config.js +204 -0
  154. package/src/lib/cli-ui.js +179 -0
  155. package/src/lib/codex-config.js +350 -0
  156. package/src/lib/codex-context-breakdown.js +400 -0
  157. package/src/lib/codex-rollout-parser.js +623 -0
  158. package/src/lib/codex-token-refresh.js +112 -0
  159. package/src/lib/cursor-config.js +425 -0
  160. package/src/lib/debug-flags.js +7 -0
  161. package/src/lib/diagnostics.js +272 -0
  162. package/src/lib/doctor.js +338 -0
  163. package/src/lib/fs.js +91 -0
  164. package/src/lib/gemini-config.js +288 -0
  165. package/src/lib/grok-hook.js +351 -0
  166. package/src/lib/init-flow.js +42 -0
  167. package/src/lib/local-api.js +1861 -0
  168. package/src/lib/openclaw-hook.js +420 -0
  169. package/src/lib/openclaw-session-plugin.js +520 -0
  170. package/src/lib/opencode-config.js +99 -0
  171. package/src/lib/passive-mode.js +185 -0
  172. package/src/lib/pricing/curated-overrides.json +79 -0
  173. package/src/lib/pricing/index.js +143 -0
  174. package/src/lib/pricing/litellm-fetcher.js +172 -0
  175. package/src/lib/pricing/matcher.js +255 -0
  176. package/src/lib/pricing/seed-snapshot.json +1 -0
  177. package/src/lib/progress.js +76 -0
  178. package/src/lib/project-usage-purge.js +106 -0
  179. package/src/lib/prompt.js +24 -0
  180. package/src/lib/proxy-env.js +131 -0
  181. package/src/lib/rollout.js +8442 -0
  182. package/src/lib/runtime-config.js +122 -0
  183. package/src/lib/skill-usage.js +267 -0
  184. package/src/lib/skills-manager.js +1127 -0
  185. package/src/lib/source-metadata.js +48 -0
  186. package/src/lib/sqlite-reader.js +136 -0
  187. package/src/lib/static-server.js +59 -0
  188. package/src/lib/subscriptions.js +453 -0
  189. package/src/lib/tracker-paths.js +16 -0
  190. package/src/lib/upload-throttle.js +148 -0
  191. package/src/lib/usage-limits.js +1806 -0
  192. package/src/lib/wrapped-aggregator.js +225 -0
package/README.md ADDED
@@ -0,0 +1,476 @@
1
+ <div align="center">
2
+
3
+ # Token Tracker
4
+
5
+ **English** · [简体中文](./README.zh-CN.md) · [日本語](./README.ja.md) · [한국어](./README.ko.md)
6
+
7
+ ### Know exactly what you're spending on AI — across every CLI
8
+
9
+ Auto-collect token counts from **22 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.
10
+
11
+ [![npm version](https://img.shields.io/npm/v/@ipv9/tokentracker-cli.svg?color=blue)](https://www.npmjs.com/package/@ipv9/tokentracker-cli)
12
+ [![npm downloads](https://img.shields.io/npm/dm/@ipv9/tokentracker-cli.svg?color=brightgreen)](https://www.npmjs.com/package/@ipv9/tokentracker-cli)
13
+ [![Homebrew](https://img.shields.io/github/v/release/mm7894215/TokenTracker?label=brew&color=F8B73E&logo=homebrew&logoColor=white)](https://github.com/mm7894215/homebrew-tokentracker)
14
+ [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)
15
+ [![CLI](https://img.shields.io/badge/CLI-macOS%20%C2%B7%20Linux%20%C2%B7%20Windows-lightgrey.svg)](https://www.npmjs.com/package/@ipv9/tokentracker-cli)
16
+ [![macOS app](https://img.shields.io/badge/macOS%20app-menu%20bar%20%2B%20widgets-lightgrey.svg?logo=apple&logoColor=white)](https://github.com/mm7894215/TokenTracker/releases/latest)
17
+ [![Windows app](https://img.shields.io/badge/Windows%20app-system%20tray-lightgrey.svg?logo=windows&logoColor=white)](https://github.com/mm7894215/TokenTracker/releases/latest)
18
+ [![GitHub stars](https://img.shields.io/github/stars/mm7894215/TokenTracker?style=social)](https://github.com/mm7894215/TokenTracker/stargazers)
19
+ [![Featured in 阮一峰周刊 #393](https://img.shields.io/badge/Featured%20in-%E9%98%AE%E4%B8%80%E5%B3%B0%E5%91%A8%E5%88%8A%20%23393-FF6B35?logo=rss&logoColor=white)](https://github.com/ruanyf/weekly/blob/master/docs/issue-393.md)
20
+ [![Author tokens](https://srctyff5.us-east.insforge.app/functions/tokentracker-badge-svg?user_id=0652839f-d19f-4f67-af85-6b7675875443&metric=tokens&compact=1&label=author%20tokens)](https://github.com/mm7894215/TokenTracker)
21
+
22
+ <br/>
23
+
24
+ <video src="https://github.com/user-attachments/assets/3275979d-bbed-4639-83e2-8b7d83bed6af" controls muted playsinline poster="https://raw.githubusercontent.com/mm7894215/tokentracker/main/docs/screenshots/dashboard-dark.png" width="820">
25
+ <img src="https://raw.githubusercontent.com/mm7894215/tokentracker/main/docs/screenshots/dashboard-dark.png" alt="Token Tracker Dashboard" width="820" />
26
+ </video>
27
+
28
+ <br/><br/>
29
+
30
+ ⭐ **If TokenTracker saves you time, please [star it on GitHub](https://github.com/mm7894215/TokenTracker) — it helps other developers find it.**
31
+
32
+ <br/>
33
+
34
+ [![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/M4M11XSNWD)
35
+
36
+ </div>
37
+
38
+ ---
39
+
40
+ ## ⚡ Quick Start
41
+
42
+ > **Requirements**: Node.js **20+** (CLI runs on macOS / Linux / Windows; native desktop app ships for both macOS (menu bar) and Windows (system tray). Cursor token reading uses the system `sqlite3` CLI when available and falls back to `node:sqlite` on supported Node releases).
43
+
44
+ ```bash
45
+ npx --yes @ipv9/tokentracker-cli
46
+ ```
47
+
48
+ That's it. First run installs hooks, syncs your data, and opens the dashboard at `http://localhost:7680`.
49
+
50
+ **What you get in 30 seconds:**
51
+ - 📊 A local dashboard at `localhost:7680` with usage trends, model breakdown, cost analysis
52
+ - 🔌 Auto-detected hooks for every supported AI tool you have installed
53
+ - 🏠 100% local — no account, no API keys, no network calls (except optional leaderboard)
54
+ - 🧩 *Optional:* a Skills tab that browses 250+ public skills and syncs them across Claude · Codex · Grok · Antigravity · Gemini · OpenCode · Hermes
55
+
56
+ > **Want a native desktop app?**
57
+ > - **macOS** — [Download `TokenTrackerBar.dmg`](https://github.com/mm7894215/TokenTracker/releases/latest/download/TokenTrackerBar.dmg) → drag to Applications. Menu bar status icon, desktop widgets, and the dashboard in a WKWebView.
58
+ > - **Windows** — [Download `TokenTracker-Setup.exe`](https://github.com/mm7894215/TokenTracker/releases/latest/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](https://github.com/mm7894215/TokenTracker/releases/latest).
59
+
60
+ Install globally for shorter commands:
61
+
62
+ ```bash
63
+ npm install -g @ipv9/tokentracker-cli
64
+
65
+ tokentracker # Open the dashboard
66
+ tokentracker sync # Manual sync
67
+ tokentracker status # Check hook status
68
+ tokentracker status --json # Machine-readable summary (pipe to jq, ingest from AI agents)
69
+ tokentracker status --light # Plain ASCII table (CI / SSH, no spinner)
70
+ tokentracker doctor # Health check
71
+ ```
72
+
73
+ ### 🍺 Homebrew (macOS)
74
+
75
+ Prefer `brew`? Install directly — no extra tap step needed:
76
+
77
+ ```bash
78
+ # macOS menu bar app (DMG)
79
+ brew install --cask mm7894215/tokentracker/tokentracker
80
+
81
+ # CLI only
82
+ brew install mm7894215/tokentracker/tokentracker
83
+ ```
84
+
85
+ Upgrade with `brew upgrade --cask mm7894215/tokentracker/tokentracker`. The tap auto-bumps within an hour of every new release.
86
+
87
+ ---
88
+
89
+
90
+ ## ✨ Features
91
+
92
+ - 🔌 **22 AI tools out of the box** — Claude Code, Codex CLI, Cursor, Gemini CLI, Antigravity, Kiro, OpenCode, OpenClaw, Every Code, Hermes Agent, GitHub Copilot, Kimi Code, CodeBuddy, Grok Build, oh-my-pi, pi, Craft Agents, Kilo CLI, Kilo Code, Roo Code, Zed Agent, Goose
93
+ - 🏠 **100% local** — Token data never leaves your machine. No account, no API keys.
94
+ - 🚀 **Zero config** — Hooks auto-install on first run. From zero to dashboard in 30 seconds.
95
+ - 📊 **Beautiful dashboard** — Usage trends, cost breakdowns by model, GitHub-style activity heatmap, project attribution
96
+ - 🖥️ **Native desktop app** — macOS menu bar (+ widgets) and Windows system tray, each with an embedded server and the dashboard in a native webview
97
+ - 🎨 **4 desktop widgets** — Pin Usage / Activity Heatmap / Top Models / Usage Limits to your desktop
98
+ - 📈 **Real-time rate limit tracking** — Claude / Codex / Cursor / Gemini / Kiro / Copilot / Antigravity quota windows with reset countdowns
99
+ - 💰 **Cost engine** — 2,200+ models priced via [LiteLLM](https://github.com/BerriAI/litellm/blob/main/model_prices_and_context_window.json) (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.
100
+ - 🌐 **Optional leaderboard** — Compare with developers worldwide; drag-to-reorder columns to focus on the providers you care about (opt-in, sign in to participate)
101
+ - 🧩 **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
102
+ - 🔒 **Privacy-first** — Only token counts and timestamps. Never prompts, responses, or file contents.
103
+
104
+ ---
105
+
106
+ ## 🖼️ Showcase
107
+
108
+ <table>
109
+ <tr>
110
+ <td width="50%">
111
+
112
+ **Dashboard** — usage trends, model breakdown, cost analysis
113
+
114
+ <img src="https://raw.githubusercontent.com/mm7894215/tokentracker/main/docs/screenshots/dashboard-light.png" alt="Dashboard" />
115
+
116
+ </td>
117
+ <td width="50%">
118
+
119
+ **Desktop Widgets** — pin usage to your desktop
120
+
121
+ <img src="https://raw.githubusercontent.com/mm7894215/tokentracker/main/docs/screenshots/widgets-overview.png" alt="Desktop Widgets" />
122
+
123
+ </td>
124
+ </tr>
125
+ <tr>
126
+ <td width="50%">
127
+
128
+ **Menu Bar App** — animated Clawd companion + native panels
129
+
130
+ <img src="https://raw.githubusercontent.com/mm7894215/tokentracker/main/docs/screenshots/menubar.gif" alt="Menu Bar App" />
131
+
132
+ </td>
133
+ <td width="50%">
134
+
135
+ **Global Leaderboard** — compare with developers worldwide
136
+
137
+ <img src="https://raw.githubusercontent.com/mm7894215/tokentracker/main/docs/screenshots/leaderboard.png" alt="Leaderboard" />
138
+
139
+ </td>
140
+ </tr>
141
+ <tr>
142
+ <td colspan="2">
143
+
144
+ **Skills Manager** — browse 250+ public skills from GitHub & `skills.sh`, install once, sync to Claude / Codex / Grok / Antigravity / Gemini / OpenCode / Hermes. Per-target toggles, one-click Undo, no manual file copying.
145
+
146
+ <img src="https://raw.githubusercontent.com/mm7894215/tokentracker/main/docs/screenshots/skills.png" alt="Skills Manager" />
147
+
148
+ </td>
149
+ </tr>
150
+ </table>
151
+
152
+ ---
153
+
154
+ ## 🔌 Supported AI Tools
155
+
156
+ | Tool | Detection | Method |
157
+ |---|---|---|
158
+ | **Claude Code** | ✅ Auto | SessionEnd hook in `settings.json` |
159
+ | **Codex CLI** | ✅ Auto | TOML notify hook in `config.toml` |
160
+ | **Cursor** | ✅ Auto | API + SQLite auth token |
161
+ | **Kiro** | ✅ Auto | SQLite + JSONL hybrid |
162
+ | **Gemini CLI** | ✅ Auto | SessionEnd hook |
163
+ | **OpenCode** | ✅ Auto | Plugin system + SQLite |
164
+ | **OpenClaw** | ✅ Auto | Session plugin |
165
+ | **Every Code** | ✅ Auto | TOML notify hook |
166
+ | **Hermes Agent** | ✅ Auto | SQLite sessions table (`~/.hermes/state.db`) |
167
+ | **GitHub Copilot** | ✅ Auto | OpenTelemetry file exporter (`COPILOT_OTEL_FILE_EXPORTER_PATH`) |
168
+ | **Kimi Code** | ✅ Auto | Passive `wire.jsonl` reader (`~/.kimi/sessions/**/wire.jsonl`) |
169
+ | **oh-my-pi (Pi Coding Agent)** | ✅ Auto | Passive reader (`~/.omp/agent/sessions/**/*.jsonl`) |
170
+ | **CodeBuddy** (Tencent) | ✅ Auto | SessionEnd hook in `~/.codebuddy/settings.json` (Claude-Code fork) |
171
+ | **Grok Build** (xAI) | ✅ Auto | SessionEnd hook + passive `updates.jsonl` / `signals.json` scan (`~/.grok/sessions/**/`) |
172
+ | **Kilo CLI** (kilo.ai) | ✅ Auto | Passive SQLite reader (`~/.local/share/kilo/kilo.db`, OpenCode-fork schema) |
173
+ | **Kilo Code** (VS Code extension) | ✅ Auto | Passive `ui_messages.json` reader (Cursor/Code/CodeBuddy/Windsurf globalStorage) |
174
+ | **Antigravity** | ✅ Auto | Passive transcript reader (`~/.gemini/{antigravity,antigravity-ide,antigravity-cli}/brain/**/transcript.jsonl`) |
175
+ | **pi** (`@mariozechner/pi-coding-agent`) | ✅ Auto | Passive reader (`~/.pi/agent/sessions/**/*.jsonl`) |
176
+ | **Craft Agents** | ✅ Auto | Passive session reader (`~/.craft-agent` + workspace session logs) |
177
+ | **Roo Code** (VS Code extension) | ✅ Auto | Passive `ui_messages.json` reader (`rooveterinaryinc.roo-cline`) |
178
+ | **Zed Agent** | ✅ Auto | Passive SQLite reader (`threads.db`, hosted `zed.dev` models only) |
179
+ | **Goose** (Block) | ✅ Auto | Passive SQLite reader (`sessions.db`, cumulative deltas) |
180
+
181
+ > **Do I need to install any plugin or hook manually?** No. `tokentracker` (or `tokentracker init`) handles everything on first run:
182
+ > - **Hook-based** tools (Claude Code, Codex, Gemini, Every Code, **CodeBuddy**, **Grok Build**) — we write a SessionEnd hook or TOML notify entry into the tool's own config.
183
+ > - **Plugin-based** tools (OpenCode, **OpenClaw**) — the plugin ships inside the npm package (`~/.tokentracker/app/openclaw-plugin/`). We link it via the tool's own CLI (`openclaw plugins install --link …` + `enable`). No download, no drag-and-drop.
184
+ > - **Passive readers** (Cursor, Kiro, Hermes, Kimi Code, Copilot, **Grok Build**, **oh-my-pi**, **pi**, **Craft Agents**, **Kilo CLI**, **Kilo Code**, **Roo Code**, **Antigravity**, **Zed Agent**, **Goose**) — nothing is installed into those tools. We only read files they already produce (SQLite DB, JSONL, OTEL export, session logs).
185
+ > - **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.
186
+ >
187
+ > 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).
188
+ >
189
+ > Deeper dives: [OpenClaw integration & troubleshooting](docs/openclaw-integration.md).
190
+
191
+ Missing your tool? [Open an issue](https://github.com/mm7894215/TokenTracker/issues/new) — adding new providers is usually one parser file away.
192
+
193
+ ---
194
+
195
+ ## 🆚 Why TokenTracker? <a id="ccusage-alternative"></a>
196
+
197
+ > **Looking for a ccusage alternative with a GUI?** TokenTracker covers 22 tools (not just Claude Code), adds a native macOS menu bar app + desktop widgets, and de-duplicates token records correctly across providers — so your numbers match the providers' own billing.
198
+
199
+ | | **TokenTracker** | ccusage | Cursor stats |
200
+ |--------------------------|:---:|:---:|:---:|
201
+ | **AI tools supported** | **22** | 1 (Claude) | 1 (Cursor) |
202
+ | **Local-first, no account** | ✅ | ✅ | ❌ |
203
+ | **Native desktop app** | ✅ macOS + Windows | ❌ | ❌ |
204
+ | **Desktop widgets** | ✅ 4 widgets | ❌ | ❌ |
205
+ | **Rate-limit tracking** | ✅ 7 providers | ❌ | Cursor only |
206
+ | **Accurate multi-provider dedup** | ✅ | ❌ ¹ | — |
207
+
208
+ <sub>¹ `reqId`-based deduplication over-counts providers that omit a request ID (DeepSeek / Kimi / MiniMax / Claude sub-agents) by 1.6–3.7×. TokenTracker dedups on a composite key, so totals match each provider's own billing dashboard.</sub>
209
+
210
+ ---
211
+
212
+ ## 🏗️ How It Works
213
+
214
+ ```mermaid
215
+ flowchart LR
216
+ A["AI CLI Tools<br/>Claude · Codex · Cursor · Gemini · Kiro<br/>OpenCode · OpenClaw · Every Code · Hermes · Copilot · Kimi Code · CodeBuddy · Grok Build · oh-my-pi · pi · Craft · Roo Code · Zed · Goose"]
217
+ A -->|hooks trigger| B[Token Tracker]
218
+ B -->|parse logs<br/>30-min UTC buckets| C[(Local SQLite)]
219
+ C --> D[Web Dashboard]
220
+ C --> E[Menu Bar App]
221
+ C --> F[Desktop Widgets]
222
+ C -.->|opt-in| G[(Cloud Leaderboard)]
223
+ ```
224
+
225
+ 1. AI CLI tools generate logs during normal use
226
+ 2. Lightweight hooks detect changes and trigger sync (Cursor uses API instead of hooks)
227
+ 3. Token counts parsed locally — never any prompt or response content
228
+ 4. Aggregated into 30-minute UTC buckets
229
+ 5. Dashboard, menu bar app, and widgets all read from the same local snapshot
230
+
231
+ ---
232
+
233
+ ## 🛡️ Privacy
234
+
235
+ | Protection | Description |
236
+ |---|---|
237
+ | **No content upload** | Only token counts and timestamps. Never prompts, responses, or file contents. |
238
+ | **Local-only by default** | All data stays on your machine. The leaderboard is fully opt-in. |
239
+ | **Auditable** | Open source. Read [`src/lib/rollout.js`](src/lib/rollout.js) — only numbers and timestamps. |
240
+ | **No telemetry** | No analytics, no crash reporting, no phone-home. |
241
+
242
+ ---
243
+
244
+ ## 📦 Configuration
245
+
246
+ Most users never need this — defaults are sensible. For advanced setups:
247
+
248
+ | Variable | Description | Default |
249
+ |---|---|---|
250
+ | `TOKENTRACKER_DEBUG` | Enable debug output (`1` to enable) | — |
251
+ | `TOKENTRACKER_HTTP_TIMEOUT_MS` | HTTP timeout in milliseconds | `20000` |
252
+ | `CODEX_HOME` | Override Codex CLI directory | `~/.codex` |
253
+ | `GEMINI_HOME` | Override Gemini CLI directory | `~/.gemini` |
254
+ | `TOKENTRACKER_GROK_HOME` | Override Grok Build directory for the Grok integration and Skills Manager | `~/.grok` |
255
+ | `GROK_HOME` | Legacy Grok Build directory override, used when `TOKENTRACKER_GROK_HOME` is unset | `~/.grok` |
256
+ | `TOKENTRACKER_ANTIGRAVITY_HOME` | Force a single Antigravity Skills directory (auto-detects `~/.gemini/antigravity` + `~/.gemini/antigravity-ide` otherwise) | auto |
257
+
258
+ ---
259
+
260
+ ## 🛠️ Development
261
+
262
+ ```bash
263
+ git clone https://github.com/pitimon/TokenTracker.git
264
+ cd TokenTracker
265
+ npm install
266
+
267
+ # Build dashboard + run CLI
268
+ cd dashboard && npm install && npm run build && cd ..
269
+ node bin/tracker.js
270
+
271
+ # Tests
272
+ npm test
273
+ ```
274
+
275
+ ### Building the macOS App
276
+
277
+ ```bash
278
+ cd TokenTrackerBar
279
+ npm run dashboard:build # Build the dashboard bundle
280
+ ./scripts/bundle-node.sh # Bundle Node.js + tokentracker source
281
+ xcodegen generate # Generate the Xcode project
282
+ ruby scripts/patch-pbxproj-icon.rb # Patch in the Icon Composer asset
283
+ xcodebuild -scheme TokenTrackerBar -configuration Release clean build
284
+ ./scripts/create-dmg.sh # Package the .app into a DMG
285
+ ```
286
+
287
+ Requires **Xcode 16+** and [XcodeGen](https://github.com/yonaskolb/XcodeGen).
288
+
289
+ ---
290
+
291
+ ## 🔧 Troubleshooting
292
+
293
+ ### CLI
294
+
295
+ <details>
296
+ <summary><b>"engines.node" or unsupported version error</b></summary>
297
+
298
+ <br/>
299
+
300
+ TokenTracker requires **Node 20+**. Check your version:
301
+
302
+ ```bash
303
+ node --version
304
+ ```
305
+
306
+ If lower, upgrade via [nvm](https://github.com/nvm-sh/nvm), [fnm](https://github.com/Schniz/fnm), or your package manager (`brew upgrade node`, `apt install nodejs`).
307
+
308
+ </details>
309
+
310
+ <details>
311
+ <summary><b>Port 7680 already in use</b></summary>
312
+
313
+ <br/>
314
+
315
+ 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:
316
+
317
+ ```bash
318
+ PORT=7700 tokentracker serve
319
+ ```
320
+
321
+ To find what's holding `7680`:
322
+
323
+ ```bash
324
+ lsof -i :7680
325
+ ```
326
+
327
+ </details>
328
+
329
+ <details>
330
+ <summary><b>A provider isn't being detected</b></summary>
331
+
332
+ <br/>
333
+
334
+ Check the integration status:
335
+
336
+ ```bash
337
+ tokentracker status
338
+ ```
339
+
340
+ Then run the doctor for a deeper health check:
341
+
342
+ ```bash
343
+ tokentracker doctor
344
+ ```
345
+
346
+ 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](https://github.com/mm7894215/TokenTracker/issues/new) with the `doctor` output attached.
347
+
348
+ </details>
349
+
350
+ <details>
351
+ <summary><b>How to uninstall hooks and remove all config</b></summary>
352
+
353
+ <br/>
354
+
355
+ ```bash
356
+ tokentracker uninstall
357
+ ```
358
+
359
+ This removes every hook TokenTracker installed across all detected AI tools, plus the local config and data. Safe to re-run.
360
+
361
+ </details>
362
+
363
+ ### macOS App
364
+
365
+ <details>
366
+ <summary><b>"TokenTrackerBar can't be opened" — unidentified developer</b></summary>
367
+
368
+ <br/>
369
+
370
+ TokenTrackerBar is **ad-hoc signed** (not notarized with an Apple Developer ID — that requires a paid developer account). Gatekeeper blocks it on first launch.
371
+
372
+ 1. Open **System Settings → Privacy & Security**
373
+ 2. Scroll to the **Security** section — you'll see *"TokenTrackerBar was blocked to protect your Mac."*
374
+ 3. Click **Open Anyway**
375
+ 4. Confirm with **Open** in the follow-up dialog (you'll need to authenticate)
376
+
377
+ You only need to do this once. Older macOS alternative: right-click the app in Finder → **Open** → **Open** in the confirmation dialog.
378
+
379
+ </details>
380
+
381
+ <details>
382
+ <summary><b>"TokenTrackerBar is damaged and can't be opened"</b></summary>
383
+
384
+ <br/>
385
+
386
+ This is Gatekeeper reacting to the `com.apple.quarantine` attribute macOS attaches to every downloaded file — not an actual problem. Clear it once with:
387
+
388
+ ```bash
389
+ xattr -cr /Applications/TokenTrackerBar.app
390
+ ```
391
+
392
+ After that the app opens normally.
393
+
394
+ </details>
395
+
396
+ <details>
397
+ <summary><b>"TokenTrackerBar wants to access data from other apps"</b></summary>
398
+
399
+ <br/>
400
+
401
+ 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.
402
+
403
+ - ✅ Click **Allow** if you use Cursor or Kiro
404
+ - ❌ Click **Don't Allow** if you don't — those providers will be silently skipped, everything else keeps working
405
+
406
+ 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.
407
+
408
+ </details>
409
+
410
+ ---
411
+
412
+ ## 🪪 README Badges
413
+
414
+ Show off your token usage on your GitHub profile or project README.
415
+
416
+ To get `YOUR_USER_ID`:
417
+ 1. Run `tokentracker`, open the dashboard, and sign in to the leaderboard.
418
+ 2. Go to **Settings → Account**.
419
+ 3. Use the **User ID** shown there. On headless machines, `tokentracker device-login` also writes the same `user_id` to `~/.tokentracker/tracker/config.json`.
420
+
421
+ Then drop one of these in:
422
+
423
+ ```markdown
424
+ [![tokens](https://srctyff5.us-east.insforge.app/functions/tokentracker-badge-svg?user_id=YOUR_USER_ID&metric=tokens)](https://github.com/mm7894215/TokenTracker)
425
+ [![cost](https://srctyff5.us-east.insforge.app/functions/tokentracker-badge-svg?user_id=YOUR_USER_ID&metric=cost)](https://github.com/mm7894215/TokenTracker)
426
+ [![rank](https://srctyff5.us-east.insforge.app/functions/tokentracker-badge-svg?user_id=YOUR_USER_ID&metric=rank)](https://github.com/mm7894215/TokenTracker)
427
+ ```
428
+
429
+ > 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.
430
+
431
+ Renders shields.io-compatible badges with your current totals (60s cache):
432
+
433
+ | Param | Values | Default |
434
+ |---|---|---|
435
+ | `metric` | `tokens` / `cost` / `rank` | `tokens` |
436
+ | `period` | `week` / `month` / `total` | `total` |
437
+ | `style` | `flat` / `flat-square` | `flat` |
438
+ | `label` | any short string | metric name |
439
+ | `color` | hex, e.g. `ff6b35` | brand green |
440
+
441
+ > **Privacy**: badges only resolve for profiles where leaderboard sharing is **on** (`Settings → Account → Public profile`). Private profiles get a "private" placeholder.
442
+
443
+ ---
444
+
445
+ ## ⭐ Star History
446
+
447
+ <a href="https://star-history.com/#mm7894215/TokenTracker&Date">
448
+ <img src="https://api.star-history.com/svg?repos=mm7894215/TokenTracker&type=Date" alt="Star History Chart" width="600" />
449
+ </a>
450
+
451
+ ---
452
+
453
+ ## 🤝 Contributing & Support
454
+
455
+ - **Bugs / feature requests**: [open an issue](https://github.com/mm7894215/TokenTracker/issues/new)
456
+ - **Security**: see [SECURITY.md](SECURITY.md) — please don't open public issues for security reports
457
+ - **Pull requests**: see [CONTRIBUTING.md](CONTRIBUTING.md) for setup, tests, and how to add a new AI tool integration
458
+ - **Questions / showcase**: [GitHub Discussions](https://github.com/mm7894215/TokenTracker/discussions)
459
+
460
+ ## 🙏 Credits
461
+
462
+ The Clawd character design belongs to Anthropic. This is a community project with no official affiliation with Anthropic.
463
+
464
+ ## License
465
+
466
+ [MIT](LICENSE)
467
+
468
+ ---
469
+
470
+ <div align="center">
471
+
472
+ **Token Tracker** — Quantify your AI output.
473
+
474
+ <a href="https://www.tokentracker.cc">tokentracker.cc</a> · <a href="https://www.npmjs.com/package/@ipv9/tokentracker-cli">npm</a> · <a href="https://github.com/mm7894215/TokenTracker">GitHub</a>
475
+
476
+ </div>