Packs / token-management-public
build-a-token-usage-dashboard
Turn per-key usage into a usage dashboard (by user, team, day and key) as one static HTML page
Install
logicpacks pack use token-management-public/build-a-token-usage-dashboardget_pack token-management-public/build-a-token-usage-dashboardThe second line is the MCP tool call for the LogicPacks connector (Claude Code, Codex, Claude.ai and others). The first run of a pack someone else wrote asks for your yes.
Keys it needs (names only)
None.
Playbooks included
- Spec:
spec/SPEC.md(goal, steps, edge cases, don’ts) - Routes:
static-htmlmetabase - Checks: 2 in
outcome/checks.yaml - Code:
usage_dash.py - Tools: python3
Usage, last 8 weeks
New: no recorded use yet.
Purpose (from spec/SPEC.md)
Turn per-key usage into a usage dashboard (by user, team, day and key) as one static HTML page
Goal
Anyone can open one page and see where API spend goes per user, team, day and key.
Steps
- Export usage:
tokens.py --db tokens.db usage-csv > usage.csv(or LiteLLM /spend/logs). python3 code/usage_dash.py usage.csv usage.html.- Open locally (
agopen usage.html) or serve via the tunnel; never publish to a third-party host.
Edge cases
- Empty CSV -> page says 0 rows.
- Many keys: the page is sorted by spend; add pagination past ~500 rows.
Don'ts
- Don't include raw tokens or prompt text in the export.