v2

latestOpenAPI 3.1.02026-08-05267431678.1 KB
analytics

Get Workspace Metrics

Return KPI metrics for the monitoring page.

Aggregates inference rows over the selected window and the immediately preceding window of equal length (for trend deltas), plus an all-time count for the caption. scope selects per-user vs active-team aggregation; the service explicitly filters inferences/requests by user_id or team_id — the service_role async engine bypasses Postgres RLS, so RLS cannot be relied on for tenant isolation.

Args: window: Rolling window key driven by the monitoring page picker. scope: personal (per-user) or team (active team) aggregation. auth: Authentication result carrying the user id used to scope every aggregate.

Returns: WorkspaceMetrics populated with current / previous / all-time counts, p99 / median latency, spend, and the open-issue tally. For window='all' the previous-window aggregates run against the same unbounded all-time range, so each *_previous field equals its current counterpart.

get/analytics/workspace-metrics

Query parameters

window'24h' | '7d' | '30d' | '90d' | 'all'

Rolling window for the KPI rollup, used only when since is omitted. 24h/7d/30d/90d produce a current window of that length plus a previous window of equal length for trend deltas. all runs both the current and previous aggregates against the unbounded all-time window.

Rolling window for the KPI rollup, used only when since is omitted. 24h/7d/30d/90d produce a current window of that length plus a previous window of equal length for trend deltas. all runs both the current and previous aggregates against the unbounded all-time window.

scope'personal' | 'team'

personal aggregates the requesting user's inferences; team aggregates the user's active team (every member sees the same totals). A team request from a user with no team degrades to personal scope rather than erroring.

personal aggregates the requesting user's inferences; team aggregates the user's active team (every member sees the same totals). A team request from a user with no team degrades to personal scope rather than erroring.

sincestring date-time nullable

Inclusive start of an explicit custom window (UTC). When provided it overrides window; the previous window is the immediately preceding window of equal length.

Inclusive start of an explicit custom window (UTC). When provided it overrides window; the previous window is the immediately preceding window of equal length.

untilstring date-time nullable

Exclusive end of the explicit window (UTC). Defaults to now.

Exclusive end of the explicit window (UTC). Defaults to now.

Response

Successful Response

scope'personal' | 'team'

Echo of the scope used to compute the rollup. personal aggregates the requesting user's inferences; team aggregates the user's active team.

window'24h' | '7d' | '30d' | '90d' | 'all'

Echo of the rolling window used to compute the rollup. One of 24h, 7d, 30d, 90d, all.

inference_countinteger

Number of inference rows in the selected window for the team.

inference_count_previousinteger nullable

Inference count for the window immediately preceding the current one (equal length). For window='all' both windows are unbounded, so this equals inference_count. Drives the trend arrow.

inference_count_all_timeinteger nullable

All-time inference count for the team with no time window.

error_countinteger

Inferences in the selected window with status = 'failed'.

avg_latency_msnumber nullable

Average end-to-end latency over the selected window, or null when no latency was recorded.

avg_ttft_msnumber nullable

Average streaming time to first visible output chunk over the selected window, or null when no TTFT was recorded.

p99_latency_msnumber nullable

p99 E2E latency in milliseconds over the selected window, computed via percentile_cont(0.99) WITHIN GROUP (ORDER BY latency_ms).

median_latency_msnumber nullable

Median (p50) E2E latency in milliseconds over the selected window.

p99_ttft_msnumber nullable

p99 streaming TTFT in milliseconds over the selected window.

median_ttft_msnumber nullable

Median (p50) streaming TTFT in milliseconds over the selected window.

p99_ttft_ms_previousnumber nullable

p99 streaming TTFT for the preceding window of equal length.

p99_latency_ms_previousnumber nullable

p99 E2E latency for the preceding window of equal length. For window='all' both windows are unbounded, so this equals p99_latency_ms. Drives the E2E latency trend arrow on the KPI grid.

spend_usdnumber nullable

Workspace spend in USD over the selected window, summed across all models the team called. Null when pricing is unavailable for every called model.

spend_previous_usdnumber nullable

Workspace spend for the preceding window of equal length. For window='all' both windows are unbounded, so this equals spend_usd.

spend_per_1k_calls_usdnumber nullable

Average cost per 1,000 inferences over the selected window.

open_issue_countinteger nullable

Count of inferences in the selected window where llmaj_verdict = 'incorrect' OR human_verdict = 'incorrect'.

last_inference_atstring date-time nullable

Most recent inference created_at observed in the selected window, or null.