Token Insight is a local-first token usage analytics stack for AI coding tools.
It scans local artifacts, normalizes usage events, stores them in SQLite, and serves a polished dashboard with deep filtering, trend analysis, and social share cards.
- Local-first by default: no cloud login, no mandatory data upload.
- Multi-source ingestion: aggregates Codex, Claude, Gemini, Cursor, LiteLLM, and more from local artifacts.
- Actionable dashboard: trend charts, model/source breakdowns, contributions heatmap, and grouped source health status.
- Dual-axis theme system: switch both dashboard layouts (
console/dock/radar) and color skins (sand/midnight/frost/signal). - Operational scripts included: start dev/prod, refresh scans, export datasets, and generate PNG social cards.
backend: Rust CLI + HTTP APIfrontend: React + Vite dashboardscripts: dev/start/export/refresh/share helpers
docker compose up --build
docker run --rm -p 8787:8787 \
-v $HOME:/host-home:ro \
-e TOKEN_INSIGHT_HOME=/host-home \
-e TOKEN_INSIGHT_SOURCE_ROOT_LITELLM=/host-home/.litellm \
mo2g/token-insight:latestOpen http://localhost:8787.
The compose stack mounts your host home directory as read-only at /host-home and sets:
TOKEN_INSIGHT_HOME=/host-homeTOKEN_INSIGHT_SOURCE_ROOT_LITELLM=/host-home/.litellm(override when LiteLLM logs are elsewhere)
Container runtime uses gcr.io/distroless/cc-debian12 to reduce image size while keeping required glibc runtime libraries.
Distroless images do not include a shell or package manager, so use logs and HTTP health endpoints for diagnostics.
- Rust stable toolchain (
cargo) - Bun runtime
bun --cwd frontend install
cargo test --manifest-path backend/Cargo.toml
bun --cwd frontend test
bun --cwd frontend build./scripts/dev.shOpen the frontend URL printed by Vite (default http://localhost:5173).
Backend defaults to http://127.0.0.1:8787.
# Production-like local startup
./scripts/start.sh
# Force a full rescan
./scripts/refresh.sh
# Export normalized events (CSV/JSON)
./scripts/export.sh --dataset events --format csv --output /tmp/token-events.csv
# Generate social image
./scripts/share-image.sh --preset summary --output /tmp/token-share.png
# Generate README layout screenshots
./scripts/capture-doc-screenshots.sh| Console | Dock | Radar |
|---|---|---|
![]() |
![]() |
![]() |
- Source roots follow local tool conventions; missing paths are skipped automatically.
- The app runs locally by default and does not upload usage data.
- Cost estimation uses a built-in pricing snapshot and can refresh remote pricing when network is available.
- Token Insight supports LiteLLM log ingestion via JSONL artifacts.
- Default LiteLLM root is
~/.litellm(or$TOKEN_INSIGHT_HOME/.litellminside containers). - Override with
TOKEN_INSIGHT_SOURCE_ROOT_LITELLM, and pass multiple roots with comma-separated paths.
See CONTRIBUTING.md for setup, verification, and contribution scope.
- Add more source adapters and richer parser fixtures.
- Add publish-ready social media visuals and demo GIFs.
- Add CI and release automation once API and UX stabilize.



