
Token Meter
io.github.whdrnr2583-cmd由 GitHub 帳號 whdrnr2583-cmd 發布v0.1.17更新於 Oct 28, 2026
Local-first dashboard + MCP for Claude Code and Codex token usage. Per-MCP/tool breakdown.
概覽
本地優先的 MCP 伺服器,彙整 Claude Code 與 Codex 的 token 用量和估算 API 費用,可依日期、模型、專案與 MCP 工具細分。
- 可以做什麼
- 依日期與模型彙整每日 token 數、美元等值費用與呼叫次數
- 列出最近工作階段,並附可直接貼上的續接指令
- 依工具拆解單一工作階段:呼叫次數、token 總量、平均延遲與回應大小
- 重新掃描本機 JSONL 日誌並回傳最新彙整
- 適用情境
- 想知道 Claude Code 或 Codex 工作階段花了多少 token 與費用、把月費方案與等效 API 費用做比較,或找出哪個 MCP 伺服器或工具最耗 token 時適用。也可用來找出最近要續接的工作階段。
- 執行需求
- 透過 npm 套件以 stdio 在本機執行,通常以 npx 啟動,因此需要 Node.js。它會讀取 Claude Code 與 Codex 已寫入磁碟的 JSONL 日誌,結果存於本機 SQLite 資料庫。未宣告需要帳號、API 金鑰或環境變數。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Token Meter,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
Token Meter
Track Claude Code, Codex & Cursor token usage and cost locally — no account, no cloud.
One local dashboard for your Claude Code and Codex token usage. Free, MCP-aware, MIT-licensed core.
npm:
@whdrnr2583/token-meter· GitHub:whdrnr2583-cmd/token-meter· Site: token-meter.dev
Token Meter parses the JSONL files that Claude Code and Codex already write to disk and turns them into a real dashboard: cost per project, per model, per MCP tool, per hour. Your data never leaves your machine.
Run your first audit
Scans your ingested Claude Code + Codex history for expensive sessions,
oversized tool responses, slow tools, repeated calls, and cache waste, ranked
by cost and confidence. Runs entirely against your local SQLite database —
same local-first, no-cloud processing as the rest of Token Meter. Add
--json for machine-readable output; see docs/audit.md for
the full flag list and JSON schema.
When to use this
Use Token Meter if you:
- want to know how many tokens and dollars your Claude Code or Codex sessions are costing — broken down by project, model, and MCP tool
- are on a flat-fee plan (Claude Max, etc.) and want to see what the equivalent API cost would be
- want to find which MCP server or tool is eating the most tokens, or which hour of the day is most expensive
- want to resume a recent session and need the
claude --resume/codex resumecommand handy - want all of the above offline, with no account and nothing uploaded
Not a fit if you need billing-grade numbers validated against your Anthropic or OpenAI invoice — Token Meter computes estimates from local JSONL files only.
MCP tools
When Token Meter is wired as an MCP server (install-mcp all), four tools become available to your AI assistant:
All four are read-only. No data leaves your machine.
Example prompts
Copy-paste any of these into Claude Code or Cursor after installing the MCP server:
Quick start
The package is published under an npm scope (
@whdrnr2583/) because the baretoken-metername collides with an existing similar name on npm. The CLI binary is still calledtoken-meterafter install.
Connect Token Meter to your AI tool (MCP)
One command registers Token Meter with every supported client on your machine:
Handles Claude Code, Cursor, and Claude Desktop — idempotent, backs up existing
config, preserves other MCP servers. Single-client variants:
install-mcp claude-code | cursor | claude-desktop. Add --dry-run to preview.
Or have your LLM do it. Open Claude Code / Cursor / Claude Desktop and ask: "Read https://raw.githubusercontent.com/whdrnr2583-cmd/token-meter/main/docs/mcp-server.md and set up token-meter as my MCP server."
Manual one-liners (if you'd rather not run our installer):
Then ask: "Use token-meter to show my recent sessions" or "Use token-meter usage_summary for this week".
Claude Code shortcut: run
npx -y @whdrnr2583/token-meter install-command claude-codeonce to register the/token-meterslash command. After reopening your session, type/token-meterfor a one-shot summary without natural language.
Full setup + verification + troubleshooting: docs/mcp-server.md.
Storage: ~/.tokenpulse/usage.db (SQLite). Remove the folder to start over.
The folder name will become ~/.tokenmeter/ in a future release with an
automatic migration; until then the v0.1 directory keeps its original name.
What you see
- USD-equivalent cost per day, model, project. Useful if you're on a Max plan and want to know what the API would have cost.
- MCP and tool breakdown: which MCP server is eating tokens, how slow each tool is on average, response sizes per call.
- Hourly distribution of output tokens.
- Claude Code + Codex side-by-side, in one view.
A note on the dollar figures
Costs are estimates computed locally from the token counts that Claude Code and Codex already write to their JSONL files, multiplied by the model's published per-million-token rate. They are not validated against your actual Anthropic / OpenAI invoice and may diverge for several reasons:
- Vendors change pricing; the table in
src/pricing.tsis a snapshot - Subscription plans (Pro / Max) bill a flat fee — the on-screen $ is what the API would have cost, not what you pay
- Some token categories (server-side tool use, cache write variants) are approximated
Treat the numbers as relative signal for spotting waste, not as billing-grade accounting. Token Meter ships a regression test that the calculation is reproducible, and an audit script that checks invariants; neither verifies the rates against vendor invoices.
Why local-first
- Your JSONL contains source code, prompts, and tool results. Token Meter never uploads any of it. Heuristics, regex, and SQL aggregation only.
- No SDK to integrate, no proxy to configure for the free tier.
- The CLI and dashboard core are MIT licensed.
Pricing
Pro is the difference between glancing at last week's number and reviewing where the month's spend leaked. Pro is live — Subscribe at token-meter.dev.
Pro+ ships once Pro sign-ups + community demand confirm the segment.
Roadmap
- M1 ✅ Claude Code parsing, MCP/tool breakdown, hourly stats
- M2 ✅ Codex integration
- M3 ✅ Pro tier ($5), Polar.sh billing, license activation
- M4+ Pro+ (local LLM proxy, GPU tracking), conditional on demand
Privacy & security
- Tokens are counted from the JSONL files Claude Code and Codex already write. Token Meter does not touch network APIs of either vendor.
- No prompt or response bodies are stored by default — only metadata (timestamps, token counts, tool names, response lengths).
- The database lives under
~/.tokenpulse/; delete it to wipe. (Renamed to~/.tokenmeter/in a future release with an automatic migration.)
Changelog
See CHANGELOG.md for release notes and breaking changes.
License
MIT for the CLI, dashboard, and parsers. Pro-tier features ship in a separate package under a closed source license.
來源:README.md,提交 36c01be
工具
0版本歷史
1- v0.1.17最新Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分
