Skip to content
tokmeterGet Tokmeter

Tokmeter / Start

CLI

Every command, the filters they share, and cleanup.

tokmeter                 # overview: projects + totals, all time (add --today, --week …)
tokmeter models          # per-model cost/tokens
tokmeter projects        # per-project breakdown
tokmeter daily           # day-by-day
tokmeter stats           # summary stats
tokmeter digest          # narrative report card (--period today|week|month)
tokmeter pricing <model> # price lookup
tokmeter quota           # plan windows: Codex weekly, Claude Code 5h/7d, Grok Bot weekly; reset time, pace
tokmeter alias list      # merge, rename, tag or hide projects (set/merge/tag/hide/suggest)
tokmeter config list     # knobs in ~/.tokmeter/config.json (get/set/reset/path)

Cursor

tokmeter cursor-hook install    # record Cursor's per-turn token usage via a stop hook
tokmeter cursor-hook status     # hook state, journal path, last turn, turns today (--json)
tokmeter cursor-hook uninstall  # remove only tokmeter's entry from ~/.cursor/hooks.json
tokmeter cursor sync            # opt-in: download your billed usage from cursor.com (--since D, --dry-run, --json)

Cursor 3.11 stopped saving token counts locally, so since 1.22.0 the daemon installs the stop hook where ~/.cursor exists. Its turns are recorded but not yet counted, until they have been checked against a live Cursor turn. cursor sync is the only command that sends a credential: the session the Cursor app already holds, to cursor.com, and only when you run it.

Prices

tokmeter update          # refresh the price catalogs now; today reprices on the next scan
tokmeter routes          # today's tokens priced on every model you've used, cheapest first
tokmeter pricing-audit   # JSON: which of today's models resolved a price, and which moved over 25%
tokmeter install-cron    # macOS: run `tokmeter update` daily at 00:05 through launchd
tokmeter cron-status     # is that job installed, and when did it last run
tokmeter uninstall-cron  # remove it

update (also refresh, kosha-refresh, kosha-update), routes and pricing-audit are in tokmeter --help since 1.21.0. routes accepts --project and --json.

live, statusline, daemon, install-mcp, install-statusline and editors are forwarded to @sriinnu/tokmeter-mcp, so install that package for them; they’re also available as tokmeter-mcp <command>.

Filters

  • Scope: --today, --week, --month, --since YYYY-MM-DD --until YYYY-MM-DD, --older-than 30d|2w|1m, --year N
  • Project: --project NAME (substring)
  • Provider: --claude, --codex, --gemini, --cursor, --opencode, --amp, --muse, --cline, --augment, --copilot-cli, --deepseek-harness, --kimi, --qwen, --roocode, --kilo, --kilocode, --droid, --openclaw, --pi, --mux, --ribhu, --chitragupta, --grok, --custom, --synthetic, --antigravity, --zed, --vscode-copilot, --codex-desktop (repeatable; every provider has one since 1.23.1). An unknown option is an error (exit 2) since 1.23.1; before that it was ignored and the totals came out unfiltered.
  • Output: --json, --light (skip pricing and the catalog refresh for this command; the daemon still refreshes on its own)

Backup, snapshot & cleanup

tokmeter snapshot                 # portable backup, nothing deleted
tokmeter restore --latest         # restore most recent backup
tokmeter restore --id <id>        # restore a specific archive
tokmeter cleanup                  # interactive: pick projects -> dates -> type DELETE
tokmeter cleanup --project app --until 2026-10-04 --dry-run   # preview only
tokmeter cleanup --project app --until 2026-10-04             # prompts for DELETE

Cleanup always writes a .tar.gz backup to ~/.cache/tokmeter/backups/ before deleting (no --no-backup flag). --force skips the prompt, not the backup. --dry-run deletes nothing. Since 1.19.2, each backup has a unique ID even if two are made in the same second; the archive is validated and synced before cleanup can remove source files. Restore refuses symlinked destination parents and archives that exceed its entry, expanded-size or free-space limits. A configured external path through a symlink may therefore need a direct path before restoring. See Backup, snapshot & restore.

Scope cleanup to --until yesterday or older. Sealed past days live in the relay ledger even after raw transcripts age out, but today isn’t sealed yet — deleting today’s raw before midnight rollover loses it.

Deleting and restoring are yours to run. Over MCP an agent can preview a cleanup (tokmeter_cleanup_preview) and list backups, nothing more.

Checking history

tokmeter coverage                      # yesterday: files that changed but fed no usage
tokmeter coverage --date 2026-10-19    # any day; --json for the full report
tokmeter backfill --codex --days 30    # add one tool's missing usage to sealed days

coverage (1.17.0+) lists session files under each tool’s data folder that changed on that day, contain a real token count, and fed nothing into the ledger — the sign that a tool started writing somewhere tokmeter doesn’t read yet. It exits with code 2 when it finds any. The daemon runs the same check after every day seals and shows a warning. Since 1.22.5 it also flags a tool database that was written on a day but gave no record dated that day — the sign that the tool changed its storage format.

Something wrong or out of date? This page is generated from its source on GitHub, at the revision this site was checked against.