Get usage top ranking
Ranks usage by model, provider, or label:{key}. JSON, NDJSON, and CSV are selected by the Accept header. Requires an admin API key or the console session; other keys get 403.
ApiKeyAuthAuthorization<token>dimension*stringmodel, provider, or label:{key}, where key is cost_center, project, environment, app_url, app_title, app_categories, or sdk_info
metric?string"cost_credits""cost_credits""requests""error_rate""latency_p95""tokens"limit?integervalue <= 10010order?string"desc""desc""asc"since?stringRFC3339 or YYYY-MM-DD.
until?stringRFC3339 or YYYY-MM-DD.
Top-N usage ranking.
- response
data*array<>total*numberdoublecurl -X GET 'https://api.ohmygpt.com/v1/usage/top?dimension=string'{ "data": [ { "key": "string", "rank": 0, "share": 0.1, "unit": "string", "value": 0.1 } ], "total": 0.1}Get usage summary GET
Aggregates the current user's usage by model, provider, route, status, API key (credential), inbound API (api), or label:{key}. Filters combine, for example group_by=credential&model=X gives spend per key for one model. JSON, NDJSON, and CSV are selected by the Accept header. Requires an admin API key or the console session; other keys get 403.
List usage records GET
Returns the current user's usage records, newest first. JSON, NDJSON, and CSV are selected by the Accept header. To export a time range, pass since and until and request pages of up to 10,000 records, following X-Next-Cursor until it is absent; with CSV, keep the header row of the first page only. Requires an admin API key (turn on Admin key on the API Keys page) or the console session; other keys get 403. Limited to 120 requests per minute per account, with bursts of 20; on 429, wait for Retry-After and resend the same page.