OhMyGPT
Usage

Get usage summary

GET
/v1/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.

Authorization

ApiKeyAuth
headerAuthorization<token>

Query Parameters

group_by*string

credential 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
Default"1d"
Value in"1h""1d""7d"
scope?"byok"

scope=byok switches to the BYOK summary view.

Value in"byok"
since?string

RFC3339 or YYYY-MM-DD.

until?string

RFC3339 or YYYY-MM-DD.

credential_id?string

Exact match on UsageItem.credential_id, the API key that made the request.

model?string

Exact model match. Aliases resolve to the canonical model ID the same way as the model filter on /v1/usage.

provider?string

Exact provider match, using the group_key values of group_by=provider.

auth_method?string
Value in"sk-v1""jwt-v1""oauth-v1"
cost_center?string

Label filter. Matches usage records whose labels.cost_center equals this value.

Lengthlength <= 128
project?string

Label filter. Matches usage records whose labels.project equals this value.

Lengthlength <= 128
environment?string

Label filter. Matches usage records whose labels.environment equals this value.

Lengthlength <= 128
app_url?string

Label filter. Matches usage records whose labels.app_url equals this value.

Lengthlength <= 128
app_title?string

Label filter. Matches usage records whose labels.app_title equals this value.

Lengthlength <= 128
app_categories?string

Label filter. Matches usage records whose labels.app_categories equals this value.

Lengthlength <= 128
sdk_info?string

Label filter. Matches usage records whose labels.sdk_info equals this value.

Lengthlength <= 128
label.{key}?string

Custom label filter pattern. Replace {key} with a custom label name, for example label.team=core.

Lengthlength <= 128

Response Body

Usage summary. scope=byok returns the BYOK summary schema.

  1. response
bucket*UsageTimeBucket
Default"1d"
Value in"1h""1d""7d"
data*array<>
group_by*string
period*
Example Request
curl -X GET 'https://api.ohmygpt.com/v1/usage/summary?group_by=string'
Example Response
{  "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"  }}