Skip to main content

Module admin_api

Module admin_api 

Source
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§

AdminState
Shared state of the admin router: the store pool + deployment parameters (the config/identity slice the status card and dashboard need).
UsageBreakdownResponse
Response of GET /api/admin/usage.
UsageBreakdownRow
One aggregated row of the person × project × model × provider cross-join.
UsageQuery
Query parameters: ISO-8601 from/to (defaults: last 30 days up to now).
UsageTotals
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.