Get usage summary
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.
ApiKeyAuthAuthorization<token>group_by*stringcredential groups by the API key that made the request; group_key is UsageItem.credential_id, or an empty string for requests not made with an API key (console sessions, OAuth apps), and key_hint carries the key's mask. api groups by UsageItem.input_api; group_key is an empty string for records without it.
bucket?string"1d""1h""1d""7d"scope?"byok"scope=byok switches to the BYOK summary view.
"byok"since?stringRFC3339 or YYYY-MM-DD.
until?stringRFC3339 or YYYY-MM-DD.
credential_id?stringExact match on UsageItem.credential_id, the API key that made the request.
model?stringExact model match. Aliases resolve to the canonical model ID the same way as the model filter on /v1/usage.
provider?stringExact provider match, using the group_key values of group_by=provider.
auth_method?string"sk-v1""jwt-v1""oauth-v1"cost_center?stringLabel filter. Matches usage records whose labels.cost_center equals this value.
length <= 128project?stringLabel filter. Matches usage records whose labels.project equals this value.
length <= 128environment?stringLabel filter. Matches usage records whose labels.environment equals this value.
length <= 128app_url?stringLabel filter. Matches usage records whose labels.app_url equals this value.
length <= 128app_title?stringLabel filter. Matches usage records whose labels.app_title equals this value.
length <= 128app_categories?stringLabel filter. Matches usage records whose labels.app_categories equals this value.
length <= 128sdk_info?stringLabel filter. Matches usage records whose labels.sdk_info equals this value.
length <= 128label.{key}?stringCustom label filter pattern. Replace {key} with a custom label name, for example label.team=core.
length <= 128Usage summary. scope=byok returns the BYOK summary schema.
- response
bucket*UsageTimeBucket"1d""1h""1d""7d"data*array<>group_by*stringperiod*curl -X GET 'https://api.ohmygpt.com/v1/usage/summary?group_by=string'{ "bucket": "1h", "data": [ { "cost": { "listed_charged_credits": 0, "listed_credits": 0, "total_credits": 0 }, "error_rate": 0.1, "group_key": "string", "key_hint": "string", "latency": { "avg_ms": 0, "p50_ms": 0, "p95_ms": 0, "p99_ms": 0, "ttft_avg_ms": 0 }, "request_count": 0, "success_count": 0, "time_bucket": "string", "tokens": { "cache_creation": 0, "cache_read": 0, "completion": 0, "prompt": 0, "reasoning": 0 } } ], "group_by": "string", "period": { "since": "string", "until": "string" }}Retrieve generation lookup GET
Vercel-style lookup wrapper for a generation record. The query parameter and returned data refer to the same user-scoped request ID used by /v1/generations/{id}.
Get usage top ranking GET
Ranks usage by model, provider, or label:{key}. JSON, NDJSON, and CSV are selected by the Accept header.