How the admin Analytics page gets its data, the exact endpoints behind it,
and copy-pasteable curl examples to test them. For internal testing.
Source: Scicom-AI-Enterprise-Organization/GPUPlatform @ main ·
page: web/src/app/(app)/admin/analytics/
The platform runs on two separate prod hostnames. The Analytics page itself is a web UI page; the data behind it comes from the gateway API.
Web UI browser
Open this in a browser to see the page. Admin-only — any non-admin login is
redirected to /serverless, so your account needs the admin role.
Gateway API curl / clients
Serves all the /v1/... and /admin/... endpoints. Auth with an
sgpu_… API key as a Bearer token. Also admin-scoped.
This trips people up:serverless.aies.scicom.dev= the web UI,serverlessgpu.aies.scicom.dev= the gateway API (note the extragpu). Point curl / any OpenAI-style client at the gateway.
The page (page.tsx, admin-gated) renders a client component
(analytics-view.tsx). On load it fires 4 parallel fetches to local
Next.js API routes (/api/analytics/*). Those routes are server-side
proxies: they inject auth and fan out to the real backends, so the browser never
sees the gateway token or the SlurmUI secret.
Two data planes are kept deliberately separate: GPU Platform history (carries $ cost
= cost_per_hr × duration) and SlurmUI reports (no cost — contributes job
counts + GPU-hours).
| Proxy route | Proxies to | Purpose |
|---|---|---|
GET /api/analytics/gpuplatform | gateway /v1/history/{kind} + /summary | GPU Platform usage & spend (the main data) |
GET /api/analytics/slurm | SlurmUI /api/reports | Slurm jobs + GPU-hours + per-day history |
GET /api/analytics/aliases · PUT | gateway /v1/global-env | GPU-source → label alias map |
GET /api/analytics/worker-events | gateway /admin/worker-events | Worker on/off lifecycle (GPU Timeline tab) |
These are what you test directly with curl. All are admin-scoped
admin only — a non-admin key gets 403 and an empty result.
Base URL = https://serverlessgpu.aies.scicom.dev.
| Endpoint | Query params | Returns |
|---|---|---|
GET /v1/history | — | list of available history kinds |
GET /v1/history/benchmarks | since, until (ISO),order=desc, limit≤1000, offset | { jobs: [...], has_more: bool }page through with offset until has_more=false |
GET /v1/history/training | ||
GET /v1/history/compute | ||
GET /v1/history/inference | ||
GET /v1/history/endpoints | ||
GET /v1/history/summary | since, until, tz | { rows: [...] } — exact per-day inference counts/tokens used by the charts |
GET /admin/worker-events | since, until, limit | { count, events: [...] } — durable worker lifecycle events |
GET /v1/global-env | — | [{ key, value }] — alias map lives under ANALYTICS_SOURCE_ALIASES |
# gateway host + an ADMIN sgpu API key (create one in the web UI → Settings → API keys)
export GW=https://serverlessgpu.aies.scicom.dev
export TOKEN=sgpu_your_admin_api_key_here
# the window you want to query — ISO 8601, UTC
export SINCE=2026-06-01T00:00:00.000Z
export UNTIL=2026-06-15T23:59:59.000Z
# sanity check: list the available history kinds
curl -s "$GW/v1/history" -H "Authorization: Bearer $TOKEN" | jq
# newest-first, max 1000 per page; bump offset to page through
curl -s "$GW/v1/history/benchmarks?since=$SINCE&until=$UNTIL&order=desc&limit=1000&offset=0" \
-H "Authorization: Bearer $TOKEN" | jq '{count: (.jobs|length), has_more}'
# same shape for the other kinds
for kind in training compute inference endpoints; do
echo "== $kind =="
curl -s "$GW/v1/history/$kind?since=$SINCE&until=$UNTIL&order=desc&limit=1000" \
-H "Authorization: Bearer $TOKEN" | jq '{count: (.jobs|length), has_more}'
done
# exact per-day counts/tokens — tz controls day bucketing
curl -s "$GW/v1/history/summary?since=$SINCE&until=$UNTIL&tz=Asia/Kuala_Lumpur" \
-H "Authorization: Bearer $TOKEN" | jq '.rows[:3]'
curl -s "$GW/admin/worker-events?since=$SINCE&until=$UNTIL&limit=20000" \
-H "Authorization: Bearer $TOKEN" | jq '{count, sample: .events[:2]}'
curl -s "$GW/v1/global-env" -H "Authorization: Bearer $TOKEN" \
| jq '.[] | select(.key=="ANALYTICS_SOURCE_ALIASES")'
SlurmUI data is not directly testable by you. The/api/analytics/slurmproxy authenticates to SlurmUI with a server-onlyaura_…admin token that the browser never sees. You can only reach Slurm numbers through the web page (logged in as admin), not via the gateway.
403 + empty result (API).truncated for high-volume kinds (inference). For exact totals the charts use
/v1/history/summary, not the raw paged list.detail.cost_per_hr × duration;
inference/proxy carry no cost (they contribute activity counts + token totals).since/until are ISO 8601. The page sends
until = end + 1s to make the range inclusive.https://serverless.aies.scicom.dev/api/analytics/... from a browser session logged in as
admin (they read your session cookie, not a Bearer token).Internal testing reference · GPU Platform analytics · generated from main.