Usage
Get usage top ranking
GET
Ranks usage by model, provider, or label:{key}. JSON, NDJSON, and CSV are selected by the Accept header.
ApiKeyAuthheader
Authorization<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?integer范围
value <= 100默认
10order?string默认
"desc"值于
"desc""asc"since?stringRFC3339 or YYYY-MM-DD.
until?stringRFC3339 or YYYY-MM-DD.
Top-N usage ranking.
- response
data*array<>total*number格式
doublecurl -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.
List usage records GET
Returns the current user's usage records, newest first. JSON, NDJSON, and CSV are selected by the Accept header.