Product brief | Positioning & roadmap | 定位与路线图(简体中文)
TokKit is the lightweight, local-first usage ledger for AI coding tools.
It helps individual developers track tokens, cost, models, terminals, and
clients across Codex, Warp, Kaku, CodeBuddy, and similar desktop workflows
without requiring SDK instrumentation for log-based sources. The core CLI is
tokkit, with tok as the operator shortcut and tokstat kept as a compatibility alias.
In one sentence:
- TokKit is a lightweight, local-first ledger that turns fragmented AI coding tool usage into one honest, terminal-first account of tokens and cost.
Example: tok last 7
Example: tok help
Most LLM observability products assume you own the application and can add instrumentation. TokKit starts from a different assumption: you are using several AI coding tools on one machine and need one trustworthy local ledger.
What TokKit emphasizes:
- Lightweight by design: one local SQLite ledger, one terminal workflow, no hosted dashboard requirement
- Local-first by default: data stays on your machine unless you export it
- Honest accounting:
exact,partial, andestimatedare explicit instead of being mixed together - Built for AI coding tools: terminals, desktop assistants, IDE extensions, and local proxies
- Low-friction adoption: scan local logs where possible, proxy only where exact accounting needs request/response usage
- Personal operator workflow: daily reports, trends, pricing, shell autosuggest, and fast CLI output
- Fast local diagnostics:
tok doctorexplains setup state, coverage, and likely next steps - Guided local onboarding:
tok setupinspects the current machine state and can apply common setup steps
- Codex Desktop and Codex CLI
- Warp AI / Agent Mode
- Kaku Assistant through an OpenAI-compatible local proxy
- CodeBuddy from local task-history estimation
All normalized records are stored in ~/.tokkit/usage.sqlite by default. If an
existing ~/.tokstat directory is present, TokKit will continue using it
unless you move to the new path.
exact: vendor logs or upstream responses expose concrete usage valuespartial: useful totals exist, but per-day or per-direction detail is limitedestimated: usage is reconstructed from local cached text, not provider usage
Current source behavior:
- Codex: exact for
input_tokens,output_tokens,cached_input_tokens, andreasoning_tokens - Kaku proxy: exact when the upstream response includes OpenAI-style
usage - Warp: partial for historical day-level backfill because local data is conversation-based
- CodeBuddy: estimated from locally cached task text
- One ledger across tools instead of separate vendor dashboards
- Lightweight local CLI instead of a hosted observability stack
- Honest reporting instead of pretending every number is equally precise
- Daily and multi-day summaries with grouped tables and trend charts
- Model, terminal, source, and client coverage breakdowns
- Local pricing overrides and estimated API cost views
- Budget tracking for today, last 7 days, and month-to-date
- Automatic scan and daily report support via
launchd - Fast operator UX with
tok, inline hints, autosuggest, and completion
cd "/path/to/tokkit"
python3 -m venv .venv
source .venv/bin/activate
python3 -m pip install -e .That installs:
tokkittoktokstatcompatibility alias
If you already had an older editable install, rerun python3 -m pip install -e .
to pick up the tok entry point.
- Verify the install and available commands:
tok help
tok setup
tok doctor
tok pricing
tok budget- See your first report:
tok today
tok last 7- If you prefer the lower-level CLI:
tokkit report-daily --date today --timezone Asia/Shanghai
tokkit report-range --last 7 --timezone Asia/ShanghaiUse the guided setup command if you want one place to inspect or apply the common local steps:
tok setup
tok setup --install-launchd --scan-mode codex
tok setup --enable-kaku-proxy --install-launchd --kaku-upstream-base-url https://api.vivgrid.com/v1
tok budget initScan all supported adapters explicitly:
tokkit scan-all --timezone Asia/ShanghaiTo capture Kaku usage precisely, run the local OpenAI-compatible proxy and point Kaku at it:
tokkit serve-proxy \
--host 127.0.0.1 \
--port 8765 \
--upstream-base-url https://api.vivgrid.com/v1 \
--timezone Asia/ShanghaiThen set:
base_url = "http://127.0.0.1:8765"Install the LaunchAgents if you want hourly scans and a daily report at
00:05:
./scripts/install_launchd.shRemove them with:
./scripts/uninstall_launchd.shThe operator shortcut auto-scans before rendering reports:
tok today
tok last 7Lower-level equivalents:
tokkit report-daily --date today --timezone Asia/Shanghai
tokkit report-range --last 7 --timezone Asia/Shanghai
tokkit report-clients --date today --timezone Asia/Shanghai
tokkit report-clients --last 7 --timezone Asia/ShanghaiDaily report:
- totals
- by terminal
- by model
- by source
- estimated API cost for priced exact records
Range report:
- total-token trend chart
- date-merged summary
- by terminal
- by model
- by source detail
- estimated API cost for priced exact records
Client report:
- blended totals
- by measurement method
- by date
- by client coverage
If you use the optional tok shortcut, common flows become:
tok help
tok setup
tok doctor
tok pricing
tok budget
tok today
tok last 7
tok clients month
tok scan warptok defaults to auto-scan before report commands and shows a lightweight
loading indicator while scanning. You can disable or scope that behavior with:
TOK_AUTO_SCAN_BEFORE_REPORTS=0 tok today
TOK_AUTO_SCAN_TARGET=codex tok last 7Cost notes:
Est.$is a local API cost estimate based on built-in model pricing profilestok pricingshows the current built-in price table used byEst.$- if
~/.tokkit/pricing.jsonexists, TokKit merges it over the built-in table - legacy
~/.tokstat/pricing.jsoncontinues to work if you are still on the old home directory tok pricingmarks every row asbuilt-inoroverridetok budgetcompares today, last 7 days, and month-to-date spend against your local budget filetok budget initcreates a starter~/.tokkit/budget.jsontok doctorsummarizes local setup, launchd automation, and client coverage in one reporttok setupcan apply common local steps such as home migration, Kaku proxy configuration, and launchd installCreditsremains separate for sources like Warp that expose vendor credits- partial sources may show
Input/Output/Cached/Reasoningas-andEst.$as-when only conversation-level totals are available
Override example:
{
"GPT-5.4": {
"input_per_million": 2.7,
"cached_input_per_million": 0.27,
"output_per_million": 16.0
},
"Claude Sonnet 4.6": {
"input": 3.2,
"cached_input": 0.32,
"output": 16.0
}
}Generated files:
- database:
~/.tokkit/usage.sqlite - reports:
~/.tokkit/reports/YYYY-MM-DD.txt - logs:
~/.tokkit/logs/*.log
TokKit should be presented as:
- a Mac-first local CLI alpha
- best for people using several AI coding tools on one machine
- strongest today on daily reporting, trend visibility, and usage honesty
Repository planning and release packaging notes live in:
docs/PRODUCT_BRIEF.mddocs/POSITIONING_AND_ROADMAP.mddocs/POSITIONING_AND_ROADMAP.zh-CN.mddocs/GITHUB_PUBLISH_PLAN.md
docs/PRODUCT_BRIEF.mddocs/POSITIONING_AND_ROADMAP.mddocs/POSITIONING_AND_ROADMAP.zh-CN.mddocs/GITHUB_PUBLISH_PLAN.md