Expand description
Admin usage API (enterprise#20) — the self-hosted gateway’s spend/savings
breakdown, straight from usage_events (Doc 08 §3.3).
GET /api/admin/usage?from=<ISO>&to=<ISO> returns the person × project ×
model × provider cross-join with per-group token/cost/savings sums, plus
totals and the seat projection. Runs in the self-hosted gateway-server
(OSS, local Postgres) — “seeing your own instance” is local-free; the
multi-tenant managed console is a separate commercial surface.
Auth: the router is mounted behind the gateway’s Bearer middleware by
gateway serve (enterprise#10); this module contains no credential logic.
Structs§
- Admin
State - Shared state of the admin router: the store pool + deployment parameters (the config/identity slice the status card and dashboard need).
- Usage
Breakdown Response - Response of
GET /api/admin/usage. - Usage
Breakdown Row - One aggregated row of the person × project × model × provider cross-join.
- Usage
Query - Query parameters: ISO-8601
from/to(defaults: last 30 days up to now). - Usage
Totals - Aggregate totals + the seat projection over the queried window.
Functions§
- router
- Builds the admin API router. Mounted behind Bearer auth by
gateway serve. - usage_
breakdown - Runs the cross-join + totals queries and assembles the response.