tokmesh-cli 0.1.1

CLI and TUI for tokmesh — AI token usage analytics
Documentation

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
cargo install tokmesh --locked

# npm
npm install -g tokmesh

# pipx / uv / pip
pipx install tokmesh
# uv tool install tokmesh
# pip install tokmesh

# mise (prebuilt binary)
mise use -g github:xxxbrian/tokmesh

# From a clone
cargo build --release -p tokmesh
./target/release/tokmesh --help

Prebuilt binaries are also on the Releases page: download the archive for your platform, extract, and put tokmesh on your PATH.

Local usage

tokmesh              # interactive TUI (default)
tokmesh tui
tokmesh models
tokmesh monthly
tokmesh hourly
tokmesh clients
tokmesh pricing <model>
tokmesh graph --json
tokmesh time-metrics
tokmesh wrapped

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-fastgpt-5.6-sol)
Grok grok-…-build → base model (e.g. grok-4.5-buildgrok-4.5)

Leaderboards

tokmesh tokscale login
tokmesh tokscale submit
tokmesh tokscale submit --dry-run
tokmesh tokscale whoami
tokmesh tokscale logout

tokmesh tokensci login
tokmesh tokensci submit
tokmesh tokensci whoami
tokmesh tokensci logout

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 tokscale submit --dry-run          # human summary
tokmesh tokensci submit --dry-run --json   # full JSON body (no upload)

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.