get_api_management_v1_workspaces_slug_usage
const url = 'https://example.com/api/management/v1/workspaces/example/usage';const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url https://example.com/api/management/v1/workspaces/example/usage \ --header 'Authorization: Bearer <token>'Read usage through the authenticated management service.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Workspace management slug
Responses
Section titled “Responses”OK
GET .../usage — the usage LEDGER: what was spent and what the provider windows
measure. Deliberately free of the budget POLICY (cap, thresholds, hard stop, alerts),
which is GET .../budget under its own scope, so the two routes no longer return one
body under two names.
object
#626 Nutzung — one provider’s windows summed across its connected accounts, for the
“2 KONTEN · summiert” popover header. One summary per (provider, window_type, scope)
over the per-account [ProviderWindowStatus] list (the FE still lists the per-account
rows underneath). Computed by calculations::aggregate_windows_by_provider.
object
How many distinct accounts (credentials) contribute to this summary.
Percent of the summed window consumed, 0.0..=100.0; 0.0 when limit is None.
Sum of limit across the accounts — None when ANY account’s limit is unknown
(an unknown limit is not assumed zero; the summed gauge would mislead).
all (overall budget) or model:<id> (a per-model sub-budget) — windows are
summed only within the SAME scope (an all window is never folded into a
per-model one).
Sum of used across the accounts in this group.
'rolling_5h' | 'weekly' | 'monthly'.
ADR 0045 Stage 2a — one provider-quota window in the usage surface. Serialized by
GET /api/settings/budget and GET /workspaces/{id}/usage. The COMPUTATION (from
a [crate::services::provider_quota::QuotaState]) lives in
calculations::window_status; this is the wire shape (+ Default so callers
compile before that computation lands).
object
Human label for the credential’s account (OAuth account email), resolved in
load_budget_status. None when unresolved (e.g. an Anthropic OAuth token
whose scopes return no email — see the OAuth-email follow-up).
#626 Nutzung — 'primary' | 'overflow', DERIVED at read time (no column): per
provider, the credential with the MOST headroom in its all-scope window is the
primary (the one the quota-aware dispatcher prefers, mirroring
provider_quota::multi_key::resolve_credential_with_most_headroom); the rest are
overflow. Account-level — the same role is stamped on EVERY window of a
credential (incl. its per-model windows). None when the provider has a single
account (no overflow concept).
The credential this window belongs to. Lets the FE list per-account windows distinctly when one provider has several connected accounts (#555).
'oauth_subscription' | 'api_key' — drives the FE capability detection
(saturation gauges show only for subscription credentials).
Percent of the window consumed, 0.0..=100.0. 0.0 when the limit is unknown —
a renderer must key a percentage on limit.is_some(), never on this value alone.
#1160 — is what this snapshot says still true NOW?
'current' (the measured window is still open — these ARE the current
figures) · 'outdated' (the window ENDED and nothing re-measured it yet; a
last-known state, never the current utilisation) · 'unreported' (a whole
further window passed with no measurement — nobody is reporting this window
any more, so no surface may draw it).
The projection carried measured_at but no VERDICT on it, so every renderer
had to invent its own staleness rule — and all three (web reports, web
settings, chat /usage) simply drew a dead snapshot as live. Classified once
by sc_svc_foundation::provider_windows::window_freshness from the window
DEFINITION, so the answer cannot differ per surface.
None = unknown limit (a new/Unsupported credential) ⇒ no gauge, no warning. It
is ALWAYS None on the own-spend estimate rows: the provider’s allowance is
console-scoped and the key states no limit.
#1025 — WHEN this snapshot was written (provider_quota_state.updated_at, set to
now() on every upsert). The DTO carried window_start / resets_at /
minutes_to_refresh but no measurement time at all, so the surface could not say
how OLD a reading is — a two-week-stale gauge looked exactly like a fresh one.
Required (the column is NOT NULL), so the FE never has to guess.
#1026 — the PROVENANCE CLASS of this window, folded from [Self::source] by
sc_svc_foundation::provider_windows::measurement_class:
'provider' (read from the provider, its harness, or a real 429) ·
'estimate' (OUR spend arithmetic — telemetry; the provider reported nothing) ·
'pending' (seeded, never measured). The FE must NOT render an estimate as a
provider measurement: telemetry_estimate fills used from
workspace_month_spend_ledger and limit from 80 % of the configured $-cap, yet
it lands in the same subscription-saturation list as a real probe.
Whole minutes until resets_at; None if unknown.
#626 Nutzung — the subscription plan/tier badge (“Max 20x”, “ChatGPT Pro”, …)
read off the credential’s agent_oauth_tokens.plan_label (migration 263), resolved
in load_budget_status. None for an API key, a legacy row, or any provider whose
OAuth profile body exposed no plan at connect.
#1644 S8 - the limits the vendor PUBLISHES for this window and model, one per plan
(plan_catalog.json, each with its source page and the day it was read). Only an
own-spend ESTIMATE row carries any: the credential does not state its plan, so the
row lists every published plan and sets neither limit nor fill_pct. Empty =
no vendor publishes a figure, drawn as “unknown”. Never gate input.
One vendor-published limit of one plan for one window and model.
object
The allowance of this window in the vendor’s unit, derived as the published monthly limit times the published window share.
The plan’s stable key (go, go_plus).
The plan’s name as the vendor writes it (Go, Go Plus).
The day it was read (YYYY-MM-DD).
The vendor page the figure was read from.
The unit of limit (usd_list_price).
#626 D4.3 — the count of REDEEMABLE rate-limit-reset credits the provider
advertises for this credential window (Codex
rateLimitResetCredits.availableCount, migration 270). None = no reset-credit
surface (every non-Codex window, and a Codex window probed before the spine read
it). The FE renders it as a chip; the redeem/consume action is a follow-up.
When the window resets; None if unknown.
#626 H2 — the window’s scope: all (the credential’s overall budget) or
model:<id> (a per-model sub-budget, e.g. a Codex Spark or Claude Sonnet
window). ALWAYS present (the DB enforces NOT NULL DEFAULT 'all' and the
projection clones it verbatim), so it is a REQUIRED string in the contract —
no #[serde(default)] (this DTO is serialize-only; the attribute would only
drop it from the OpenAPI required set). The FE renders per-model windows
distinctly and sums per-account windows under one provider. The own-spend
estimate list uses the one extra value unattributed_model for rows whose model
cannot be spelled into a scope.
'real_limit_hit' | 'status_probe' | 'telemetry' | 'default' | 'task_boundary'
— snapshot provenance so the FE can distinguish a hard hit from a low-confidence
estimate.
True when fill_pct is within the throttling band of fill_target — the FE
surfaces an amber “approaching limit” state.
'rolling_5h' | 'weekly' | 'monthly'.
object
object
Example generated
{ "effective_month_spend_usd": 1, "inflight_reserved_usd": 1, "measured_at": "2026-04-15T12:00:00Z", "month_spend_usd": 1, "per_provider_summary": [ { "account_count": 1, "fill_pct": 1, "limit": 1, "provider": "example", "scope": "example", "used": 1, "window_type": "example" } ], "per_provider_windows": [ { "account_email": "example", "account_role": "example", "credential_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "credential_type": "example", "fill_pct": 1, "freshness": "example", "limit": 1, "measured_at": "2026-04-15T12:00:00Z", "measurement": "example", "minutes_to_refresh": 1, "plan_label": "example", "provider": "example", "published_limits": [ { "limit": 1, "plan": "example", "plan_label": "example", "retrieved_at": "example", "source_url": "example", "unit": "example" } ], "reset_credits": 1, "resets_at": "2026-04-15T12:00:00Z", "scope": "example", "source": "example", "throttling_soon": true, "used": 1, "window_start": "2026-04-15T12:00:00Z", "window_type": "example" } ], "provider_inflight_reserved_usd": { "additionalProperty": 1 }, "provider_spend_usd": { "additionalProperty": 1 }}