Getting the aggregated request statistics¶
Note
The Admin API requires no token. The Admin API is typically protected at the network level.
Send the request as GET to the path /admin/v1/stats.
Description¶
Returns request counts, token usage, cost, and latency across several time windows, plus a per-tenant breakdown and recent log entries.
Request¶
The following parameters are available:
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
tenant_id |
query | string |
no | Filter statistics to a single tenant UUID. |
Example¶
Example of the response body:
{
"today": {
"requests": 0,
"cached": 0,
"blocked": 0,
"input_tokens": 0,
"output_tokens": 0,
"cost_usd": 0.0,
"saved_cost_usd": 0.0,
"avg_latency_ms": 0.0,
"avg_upstream_latency_ms": 0.0
},
"yesterday": {
"requests": 0,
"cached": 0,
"blocked": 0,
"input_tokens": 0,
"output_tokens": 0,
"cost_usd": 0.0,
"saved_cost_usd": 0.0,
"avg_latency_ms": 0.0,
"avg_upstream_latency_ms": 0.0
},
"last_7d": {
"requests": 0,
"cached": 0,
"blocked": 0,
"input_tokens": 0,
"output_tokens": 0,
"cost_usd": 0.0,
"saved_cost_usd": 0.0,
"avg_latency_ms": 0.0,
"avg_upstream_latency_ms": 0.0
},
"hour": {
"requests": 0,
"cached": 0,
"blocked": 0,
"input_tokens": 0,
"output_tokens": 0,
"cost_usd": 0.0,
"saved_cost_usd": 0.0,
"avg_latency_ms": 0.0,
"avg_upstream_latency_ms": 0.0
},
"last_min": {
"requests": 0,
"cached": 0,
"blocked": 0,
"input_tokens": 0,
"output_tokens": 0,
"cost_usd": 0.0,
"saved_cost_usd": 0.0,
"avg_latency_ms": 0.0,
"avg_upstream_latency_ms": 0.0
},
"by_tenant": [
{
"tenant_id": "string",
"tenant": "string",
"requests": 0,
"input_tokens": 0
}
],
"recent": [
{
"id": "log_abc789",
"ts": 1742547632000,
"tenant": "myapp",
"tenant_id": "ten_abc123"
}
],
"recent_blocked": [
{
"id": "log_abc789",
"ts": 1742547632000,
"tenant": "myapp",
"tenant_id": "ten_abc123"
}
]
}
Responses¶
The endpoint answers the request with the following status codes:
| Status code | Description |
|---|---|
200 |
Statistics snapshot. |