Query Usage
GET /api/v1/obs/usage
Aggregated usage and spend for your organization, grouped by day / model / team / key.
Auth: this endpoint belongs to the console backend API (base URL
https://portal.aiin1.ai— note, notapi.portal.aiin1.ai). It requires anaccess_tokenobtained by logging in with a console account (valid 15 minutes); thesk-nex-API token does not work here. See Billing Reconciliation & Automated Usage Sync for the login flow and a full reconciliation recipe.
Request parameters
| Param | In | Type | Required | Description |
|---|---|---|---|---|
start / end |
query | date | no | Date range (YYYY-MM-DD, inclusive). Must be provided together, span ≤ 365 days, end must not be a future date. Falls back to range_days when omitted |
range_days |
query | integer | no | Last N days (default 7) |
group |
query | string | no | Aggregation: date (default) / model / team / key / owner; comma-combine for a multi-dimension cross-tab (e.g. group=model,key) — group_key / group_name compose with | in the given order |
team_id |
query | string(uuid) | no | Filter by team |
apikey_id |
query | string(uuid) | no | Filter by API key |
model |
query | string | no | Filter by model name |
Example
curl "https://portal.aiin1.ai/api/v1/obs/usage?start=2026-07-01&end=2026-07-31&group=model" \
-H "Authorization: Bearer $ACCESS_TOKEN"Response
An array, one row per aggregation group:
| Field | Type | Description |
|---|---|---|
group_key |
string | Aggregation key (date / model name / team or key ID) |
group_name |
string | null | Display name for the key |
request_count |
integer | Request count |
prompt_tokens |
integer | Input tokens |
completion_tokens |
integer | Output tokens |
cache_creation_input_tokens |
integer | Cache-write tokens |
cache_read_input_tokens |
integer | Cache-hit tokens |
total_tokens |
integer | Total tokens |
cost_usd |
string(decimal) | Spend (USD) |
avg_latency_ms |
integer | null | Average latency (ms) |
error_count |
integer | Error count |
Related: per-request detail export
The same prefix also offers per-request detail exports (start / end required, optional model / apikey_id / team_id filters):
GET /api/v1/obs/usage/export— CSV (each row carries the unit prices and discount factor in effect, socost_usdcan be recomputed independently)GET /api/v1/obs/usage/export.xlsx— Excel detailsGET /api/v1/obs/usage/stats.xlsx— Excel statistics
Column reference: Billing Reconciliation & Automated Usage Sync.