Tokmesh
Local analytics for AI coding token usage: scan session logs, price models, run reports, and explore everything in a full TUI.
Tokmesh is a hard fork of tokscale. It keeps the local scanner, pricing system, reports, and terminal UI, and can submit daily aggregates to either public leaderboard:
Install
Pick one:
# Cargo
# npm
# pipx / uv / pip
# uv tool install tokmesh
# pip install tokmesh
# mise (prebuilt binary)
# From a clone
Prebuilt binaries are also on the Releases page: download the archive for your platform, extract, and put tokmesh on your PATH.
Local usage
Config and caches live under ~/.config/tokmesh/ (override with TOKMESH_CONFIG_DIR for an isolated profile).
Usage is derived from local client logs and databases (Claude Code, Codex, OpenCode, Grok Build, Cursor cache, and many others). The TUI may also fetch public leaderboard statistics.
Model identity
Local reports and leaderboard submit share one model-id path. Two narrow suffix rewrites:
| Source | Rule |
|---|---|
| OpenCode | gpt-…-fast → base model (e.g. gpt-5.6-sol-fast → gpt-5.6-sol) |
| Grok | grok-…-build → base model (e.g. grok-4.5-build → grok-4.5) |
Leaderboards
Credentials are stored separately and never mixed:
~/.config/tokmesh/tokscale/credentials.json~/.config/tokmesh/tokensci/credentials.json
Environment overrides (optional):
| Variable | Purpose |
|---|---|
TOKMESH_TOKSCALE_API_TOKEN |
tokscale.ai API token |
TOKMESH_TOKENSCI_API_TOKEN |
tokens.ci API token |
TOKMESH_TOKSCALE_API_URL |
Override tokscale API base URL |
TOKMESH_TOKENSCI_API_URL |
Override tokens.ci API base URL |
Submit sends daily usage aggregates and a stable device identifier. It never sends prompts, completions, file contents, or local paths.
tokmesh tokensci submit --replace --client <id> --since YYYY-MM-DD --until YYYY-MM-DD
authoritatively replaces that client's bounded date range; missing local days are removed remotely.
TODO
- Optional self-hosted private cloud for detailed personal history (not started)
License
MIT. Includes work from tokscale (Copyright (c) 2025 Junho Yeo) and tokens.ci (Copyright (c) 2026 Vincent Yang). See LICENSE.