Admin Dashboard
Phase 8 · Document 08 · LLM Gateways Prev: 07 — Streaming Proxy · Up: Phase 8 Index
Table of Contents
- Why This Matters
- Core Concept
- Mental Model
- Hitchhiker's Guide
- Warmup Readings
- Deep Readings and External References
- Key Terms
- Important Facts
- Observations from Real Systems
- Common Misconceptions
- Engineering Decision Framework
- Hands-On Lab
- Verification Questions
- Takeaways
- Artifact Checklist
1. Why This Matters
The admin dashboard is the human control surface for the gateway — the place where a platform owner sees what's happening (usage, cost, errors, latency, provider health) and changes what happens (manage models/routes, issue API keys, set budgets, flip a provider off). Everything you've built — registry, routing, metering, policy — needs a UI/API for operators, finance, and team leads to use it without editing config files or SQL. Without it, the gateway is a black box only its authors can run; with it, finance does chargeback, team leads self-serve keys and budgets, and on-call sees the incident. It's the difference between an internal script and a product.
2. Core Concept
Plain-English primer: read + write surfaces over the gateway's data
The dashboard is two things over the gateway's stores: a read surface (visualize the metering + observability data) and a write surface (manage the registry, routes, keys, budgets, policy). Concretely:
Read (visibility):
- Usage & cost — per user/project/key/model/provider/route, over time; the metering aggregates. The feature finance wants.
- Performance — p50/p95/p99 TTFT/TPOT, throughput, error rate, fallback rate (Phase 7.08).
- Provider health — up/down, circuit-breaker state, rate-limit headroom (Phase 7.07).
- Budget burn — spend vs budget per tenant, with alerts approaching limits (06).
Write (control):
- Models — add/edit/deprecate registry rows, prices, capability flags (04).
- Routes — define/edit aliases (
auto/coding) and routing rules/constraints (05). - API keys (virtual keys) — issue per user/team with allowed models, budgets, rate limits (02, 06).
- Providers — credentials, enable/disable, health overrides.
- Policy — guardrails, data-residency rules, RBAC (09).
The admin API (the dashboard is a client of it)
Build the API first, render the UI on top — so automation and the UI share one surface and the UI is just a client:
GET /admin/usage?group_by=project&from=...&to=... # cost/usage aggregates [06]
GET /admin/metrics # p95/p99, error/fallback rate [7.08]
GET /admin/providers # health, breaker state [7.07]
POST /admin/models /admin/models/:id (PATCH/deprecate) # registry [04]
POST /admin/routes # aliases + rules [05]
POST /admin/keys {user, models, max_budget, rpm} # virtual keys [06]
POST /admin/budgets {project, monthly_budget, alert_at} # budgets [06]
Who uses it (personas → views)
A dashboard is only useful if it serves its personas:
- Platform/on-call engineer — health, errors, latency, provider state, capacity; the incident view (Phase 7.10).
- Finance / FinOps — cost by team/project, trends, chargeback export, budget burn (06, Phase 15.05).
- Team lead / developer — self-serve API keys, their team's usage vs budget, available models.
- Admin / security — RBAC, audit log, policy config, key lifecycle (09).
It is itself a privileged surface (secure it)
The dashboard creates keys, sees usage, and changes routing/policy — so it's a high-value target: it needs authentication + RBAC (not everyone can issue keys or edit policy), an audit log of admin actions (who changed what), and protection of the master/admin key (09, Phase 14). Don't reinvent metrics visualization — many teams point Grafana at the gateway's metrics/DB for the read dashboards and build a small custom admin app for the write operations.
3. Mental Model
┌──────────────── ADMIN DASHBOARD (over the gateway's stores) ────────────────┐
READ │ usage/cost by tenant [06] · p95/p99 + error/fallback [7.08] · provider health │
│ [7.07] · budget burn [06] │
WRITE│ models/prices/caps [04] · routes/aliases [05] · virtual keys+budgets+limits │
│ [06] · providers (enable/health) · policy/RBAC [09] │
└───────────────────────────────┬───────────────────────────────────────────────┘
build the ADMIN API first → UI is a client of it (automation + UI share one surface)
personas: on-call · finance/FinOps · team lead · admin/security
it's PRIVILEGED → auth + RBAC + audit log + protect the master key [09, Phase 14]
reuse Grafana for READ dashboards; small custom app for WRITE ops
Mnemonic: the dashboard is read (usage/cost/health) + write (models/routes/keys/budgets/policy) over the gateway's stores — API-first, persona-driven, and itself a privileged, audited surface.
4. Hitchhiker's Guide
What to look for first: the cost-by-tenant view and key + budget management — they deliver the gateway's day-one operational value (visibility + self-serve control).
What to ignore at first: a beautiful bespoke analytics UI. Reuse Grafana for read dashboards over your metrics/DB; build only the write admin (keys/routes/budgets) that tools don't give you.
What misleads beginners:
- UI-first instead of API-first. Build the admin API first so automation and the UI share one surface (02 exposes such APIs).
- Forgetting the dashboard is privileged. It mints keys and edits policy — without RBAC + audit, it's a breach waiting to happen (09, Phase 14).
- No personas. A dashboard that serves no specific user (finance vs on-call vs team lead) serves none well.
- Reinventing metrics viz. Grafana already does p95/p99 + cost panels (Phase 7.08).
- Stale data. If usage/cost lags, finance and budget alerts are wrong — drive it from the live metering store.
How experts reason: they build an admin API over the gateway's stores, render persona-specific views (on-call/finance/lead/admin), reuse Grafana for reads and a small app for writes, and treat the dashboard as a secured, audited, RBAC'd surface. They make key/budget self-service to remove themselves as a bottleneck.
What matters in production: accurate, fresh cost/usage (finance trusts it), working key/budget/route management, RBAC + audit on admin actions, and an incident view tied to the runbook.
How to debug/verify: confirm dashboard cost matches metering totals (and invoices, 06); test that a non-admin can't mint keys/edit policy (RBAC); verify admin actions appear in the audit log.
Questions to ask: is there an admin API behind the UI? RBAC + audit on admin actions? cost-by-tenant + chargeback export? self-serve keys/budgets? does it reuse existing metrics tooling?
What silently gets expensive/unreliable: an un-RBAC'd dashboard (anyone mints keys), stale cost data (bad chargeback), and a hand-built metrics UI that diverges from the real observability (Phase 7.08).
5. Warmup Readings
| Title | Why to read it | What to extract | Difficulty | Time |
|---|---|---|---|---|
| 06 — Usage Metering | The data it visualizes | usage events, budgets | Beginner | 25 min |
| Phase 7.08 — Observability | Reuse for read dashboards | p95/p99, Grafana | Beginner | 25 min |
| 04 — Model Registry | What write ops manage | models/routes | Beginner | 20 min |
| 09 — Enterprise Policy Engine | Why it's privileged | RBAC, audit | Intermediate | 20 min |
6. Deep Readings and External References
| Title | URL | Why it matters | Read first | Lab connection |
|---|---|---|---|---|
| LiteLLM admin UI | https://docs.litellm.ai/docs/proxy/ui | A real gateway admin | keys, usage, models | Reuse vs build |
| LiteLLM admin API | https://docs.litellm.ai/docs/proxy/management_cli | Admin endpoints | key/budget mgmt | Admin API |
| Grafana | https://grafana.com/docs/ | Read dashboards | panels, alerting | Cost/latency views |
| OpenRouter activity/credits | https://openrouter.ai/docs | Hosted usage views | usage/credits | Reference UI |
| Phase 7.10 — Runbook | (curriculum) | Incident view link | dashboards | On-call view |
7. Key Terms
| Term | Simple meaning | Technical meaning | Why it matters | Where it appears | How to use it |
|---|---|---|---|---|---|
| Admin dashboard | Operator UI | Read+write over gateway stores | Run the gateway | gateway | Persona views |
| Admin API | The control endpoints | /admin/* CRUD + queries | UI + automation | gateway | Build first |
| Cost view | Spend visibility | Usage aggregated by dim | Finance/chargeback | metering [06] | By tenant |
| Key management | Issue/revoke keys | Virtual keys + limits | Self-serve control | [06] | RBAC-gated |
| Provider health view | Backend status | Up/down + breaker | Incident response | [7.07] | On-call |
| RBAC | Role-based access | Who can do what | Security | [09] | Gate admin ops |
| Audit log | Who changed what | Admin action trail | Compliance | [09] | Record all writes |
| Persona view | Role-specific UI | Tailored dashboards | Usefulness | design | On-call/finance/lead |
8. Important Facts
- The dashboard is read (usage/cost/health/latency) + write (models/routes/keys/budgets/policy) over the gateway's stores.
- Build the admin API first; the UI is a client so automation and UI share one surface.
- Cost-by-tenant + chargeback export is the headline value for finance (06, Phase 15).
- It's a privileged surface (mints keys, edits policy) → needs auth + RBAC + audit log + master-key protection (09, Phase 14).
- Reuse Grafana for read dashboards over metrics/DB; build a small custom app for write ops (Phase 7.08).
- Serve specific personas (on-call, finance, team lead, admin) — generic dashboards help no one.
- Drive it from live metering so cost/budget data is fresh and matches invoices.
- LiteLLM ships an admin UI + API — reuse rather than rebuild the basics (02).
9. Observations from Real Systems
- LiteLLM's admin UI/API manages virtual keys, budgets, models, and shows spend — the reference self-hosted gateway admin (02).
- OpenRouter's activity/credits views are the hosted-aggregator equivalent (01).
- Most teams pair Grafana (reads) with a small custom admin app (writes) rather than building analytics from scratch (Phase 7.08).
- Enterprises require RBAC + audit on the admin surface for SOC2/compliance — admin actions are logged (09, Phase 14).
- Self-serve keys/budgets are what let a platform team support many product teams without becoming a ticket queue.
10. Common Misconceptions
| Misconception | Reality |
|---|---|
| "Build the UI first" | API-first; UI is a client (shared with automation) |
| "It's just dashboards" | It's also the write/control surface (keys/routes/policy) |
| "Build the metrics viz yourself" | Reuse Grafana; build only custom write ops |
| "Anyone on the team can use it" | It's privileged — RBAC + audit required |
| "One dashboard fits all" | Serve personas (on-call/finance/lead/admin) |
| "Cost view can lag" | Stale cost = wrong chargeback/alerts — keep it live |
11. Engineering Decision Framework
BUILD the admin surface:
1. API FIRST: /admin/* for usage/metrics/providers (read) + models/routes/keys/budgets/policy (write).
2. READS: reuse Grafana over metering DB + metrics (cost-by-tenant, p95/p99, fallback, health). [06,7.08]
3. WRITES: small custom app for keys/budgets/routes/models/policy management. [04,05,06,09]
4. PERSONAS: on-call (health/errors/capacity) · finance (cost/chargeback) · lead (self-serve keys) · admin (RBAC/audit).
5. SECURE IT: auth + RBAC on every admin op; AUDIT LOG all writes; protect the master key. [09, Phase 14]
6. FRESHNESS: drive cost/budget from live metering; reconcile with invoices. [06]
| Persona | Primary view |
|---|---|
| On-call engineer | Health, errors, latency, capacity, breaker state |
| Finance / FinOps | Cost by team/project, trend, chargeback export, budget burn |
| Team lead / dev | Self-serve keys, team usage vs budget, available models |
| Admin / security | RBAC, audit log, policy config, key lifecycle |
12. Hands-On Lab
Goal
Stand up the gateway's admin surface: Grafana for cost/latency reads + a small admin API/app for keys, budgets, and routes — secured with RBAC + audit.
Prerequisites
Steps
- Read dashboards (Grafana): connect Grafana to the metering DB/metrics; build panels for cost by project/user (last 30d), p95/p99 TTFT, error + fallback rate, and budget burn (Phase 7.08).
- Admin API: implement (or use LiteLLM's)
/admin/keys,/admin/budgets,/admin/routes,/admin/models; create a virtual key with a budget + allowed models and confirm it works through the gateway (06, 05). - Write app: a minimal UI (or CLI) over the admin API to issue/revoke keys and set budgets — the self-serve surface.
- RBAC: add roles (admin vs viewer vs team-lead); verify a non-admin cannot mint keys or edit policy (09).
- Audit log: record every admin write (who, what, when); display it; confirm a key creation appears.
- Reconcile: confirm the dashboard's cost totals match the metering aggregates (and a provider invoice figure).
Expected output
A working admin surface: Grafana cost/latency dashboards, an admin API + minimal write app for keys/budgets/routes, RBAC blocking unauthorized writes, and an audit log of admin actions.
Debugging tips
- Cost panel ≠ metering totals → query/timezone mismatch or stale aggregation.
- Non-admin can mint keys → RBAC not enforced on the admin endpoints.
Extension task
Add a budget-burn alert (e.g., 80% of monthly budget) surfaced in the dashboard and via notification (06).
Production extension
Put the admin app behind SSO + RBAC, ship the audit log to your SIEM, and link the on-call view from the runbook (09, Phase 14).
What to measure
Dashboard-vs-metering cost match; key/budget management correctness; RBAC enforcement; audit completeness.
Deliverables
- Grafana cost/latency/health dashboards over the gateway data.
- An admin API + write app for keys/budgets/routes.
- RBAC + an audit log of admin actions.
13. Verification Questions
Basic
- What are the read and write responsibilities of the admin dashboard?
- Why build the admin API before the UI?
- Why is the dashboard a privileged surface?
Applied 4. Design persona-specific views for on-call, finance, and team lead. 5. What do you reuse (Grafana) vs build (write ops), and why?
Debugging 6. Finance's cost view disagrees with the provider invoice. Where do you look? 7. A team lead minted an admin key they shouldn't have. What failed?
System design 8. Design an admin surface with API-first design, persona views, RBAC, and audit for a multi-tenant gateway.
Startup / product 9. How does a good admin dashboard (self-serve keys, chargeback) reduce your support load and prove enterprise-readiness?
14. Takeaways
- The dashboard is read (usage/cost/health/latency) + write (models/routes/keys/budgets/policy) over the gateway's stores.
- Build the admin API first; the UI (and automation) are clients of it.
- Cost-by-tenant + chargeback is the finance headline; self-serve keys/budgets remove the platform team as a bottleneck.
- Reuse Grafana for reads, build a small app for writes.
- It's privileged — RBAC + audit + master-key protection are mandatory (09).
15. Artifact Checklist
- Grafana dashboards: cost-by-tenant, p95/p99, error/fallback, budget burn.
- An admin API + a minimal write app (keys/budgets/routes/models).
- RBAC blocking unauthorized admin writes.
- An audit log of admin actions.
- A cost reconciliation (dashboard vs metering vs invoice).
Up: Phase 8 Index · Next: 09 — Enterprise Policy Engine