Multi-platform AI agent token usage statistics CLI (Rust). Reads local session logs from coding agents and IDEs, normalizes into SQLite, and reports by platform / project / model.
Repository: https://github.com/Uuclear/tokens
预编译二进制见 GitHub Releases:
| 平台 | 文件 | 说明 |
|---|---|---|
| Windows x64 | tokens-*-windows-x86_64.zip |
含 tokens.exe |
| Linux (Debian/Ubuntu glibc) | tokens-*-linux-x86_64-gnu.tar.gz |
x86_64 GNU |
| macOS | tokens-*-macos-universal.tar.gz |
Intel + Apple Silicon |
| Platform | Kind | Status |
|---|---|---|
| Claude Code | CLI | implemented |
| Codex | CLI | implemented |
| OpenCode | CLI | implemented |
| OpenClaw | CLI | implemented |
| Hermes Agent | CLI | implemented |
| Qwen Code | CLI | implemented |
| Cline | hybrid | implemented |
| Kilo CLI / Kilo IDE | CLI / IDE | implemented |
| Cursor | IDE | implemented (exact + estimate) |
| Cherry Studio | IDE | implemented |
| Chatbox | IDE | implemented |
| Qoder / Qoder CN | IDE | research (no local token log) |
| Postman | hybrid | optional API (credits) |
| Dify | server | optional API |
tokens setup --init
tokens scan
tokens overview --since 7d
tokens servetokens list-platforms
tokens probe claude_code
tokens doctor
tokens scan
tokens scan --full
tokens overview --since all
tokens report --since 7d --group surface
tokens report --since all --group platform
tokens report --since 30d --group model --json
tokens config set postman_api_key YOUR_KEY
tokens setup
tokens setup --init
tokens serve
tokens serve --pixel
tokens serve --terminal
tokens serve --ink
tokens serve --paper
tokens serve --list-themes
tokens serve --down在仓库根目录:
cargo run -- serve --dev --pixel修改 src/serve/themes/*.html、src/serve/dashboard.app.js 后浏览器刷新即可;Rust 改动仍需 cargo build。
setup stores enabled platforms in setup.enabled and optional overrides in paths.<platform_id> (semicolon-separated).
| OS | Config directory |
|---|---|
| Windows | %APPDATA%\tokens\ |
| macOS | ~/Library/Application Support/tokens/ |
| Linux | ~/.config/tokens/ |
serve runs a background daemon (default 0.0.0.0:5790), rescans every 5 minutes, and serves bundled offline logos. Listens on all interfaces for LAN access (no auth).
See docs/platforms/unix-paths.md. macOS includes IDE/desktop paths; Linux prioritizes CLI + XDG.
tokens probe cursor
tokens doctorSet NO_COLOR=1 to disable colors. Set TOKENS_ASCII=1 for ASCII boxes.
cargo build --releaseRefresh logos (optional):
# Windows
.\scripts\fetch-logos.ps1
# macOS / Linux
./scripts/fetch-logos.shgit tag v0.1.0
git push origin v0.1.0Or trigger Actions → Release → Run workflow on GitHub.
cargo build --features optional_api
tokens scan --apiKeys: postman_api_key, dify_api_url, dify_api_key, cursor_session_token
MIT — see LICENSE