Skip to content

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

L2 Checks passed 3 of 3 runsv1.0.0Tech-Realm/space-token-management-public

Install

logicpacks pack use token-management-public/build-a-token-usage-dashboard
get_pack token-management-public/build-a-token-usage-dashboard

The 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

  1. Export usage: tokens.py --db tokens.db usage-csv > usage.csv (or LiteLLM /spend/logs).
  2. python3 code/usage_dash.py usage.csv usage.html.
  3. 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.