token-calc is a local dashboard for seeing how many tokens your AI coding tools are using and what that usage roughly costs.
It reads usage data already stored on your machine by tools like Claude Code, Codex, Gemini, OpenCode, Amp, and Pi-Agent. It then normalizes those records into one view with daily spend, source breakdowns, top models, token mix, and recent usage.
Nothing needs to be uploaded anywhere. The web app and CLI both run locally.
- token-calc scans the usual local data folders for supported AI coding tools.
- Each loader turns tool-specific records into a shared token event format.
- Missing costs are estimated from LiteLLM model pricing, with a small offline fallback.
- Events are aggregated by day, source, model, project, and token type.
- The result is shown in either the browser dashboard or the terminal UI.
The numbers are meant for visibility and budgeting, not billing reconciliation. If a tool already records cost, token-calc uses that value. Otherwise it estimates cost from model pricing.
Install dependencies and start the local web app:
pnpm install
pnpm devOpen http://127.0.0.1:6767.
The dashboard refreshes automatically and includes range filters for 7 days, 30 days, 90 days, 180 days, 1 year, and all time.
The OpenTUI CLI runs with Bun:
pnpm --filter @token-calc/cli dev -- --range 30Supported ranges are 7, 30, 90, 180, 365, and all.
Press q or Ctrl+C to exit.
token-calc currently scans:
- Claude Code
- Codex
- Gemini
- OpenCode
- Amp
- Pi-Agent
You can point token-calc at custom data locations with these environment variables:
CLAUDE_CONFIG_DIRCODEX_HOMEGEMINI_DIROPENCODE_DATA_DIRAMP_DATA_DIRPI_AGENT_DIR
pnpm dev
pnpm build
pnpm typecheck
pnpm --filter @token-calc/cli dev -- --range allpnpm dev starts the web dashboard. pnpm build and pnpm typecheck run across the workspace.