OhMyGPT
Usage

List usage records

GET
/v1/usage

Returns the current user's usage records, newest first. JSON, NDJSON, and CSV are selected by the Accept header.

授权

ApiKeyAuth
headerAuthorization<token>

查询参数

since?string

Start time in RFC3339.

格式date-time
until?string

End time in RFC3339.

格式date-time
model?string
request_id?string

Exact request ID match.

usage_kind?string
值于"llm""embedding""tts""stt""image""video""rerank""moderation""ocr""decision"
status?string
值于"success""error"
billing_status?string
值于"final""failed"
credential_id?string

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

auth_method?string
值于"sk-v1""jwt-v1""oauth-v1"
cost_center?string

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

长度length <= 128
project?string

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

长度length <= 128
environment?string

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

长度length <= 128
app_url?string

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

长度length <= 128
app_title?string

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

长度length <= 128
app_categories?string

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

长度length <= 128
sdk_info?string

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

长度length <= 128
label.{key}?string

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

长度length <= 128
cursor?string
limit?integer
范围value <= 1000
默认100

响应主体

Usage records.

  1. response
[index: integer]?
示例请求
curl -X GET 'https://api.ohmygpt.com/v1/usage'
示例响应
[  {    "auth_method": "sk-v1",    "billing_status": "final",    "cache_creation_tokens": 0,    "cache_read_tokens": 0,    "client_ip": "string",    "completion_tokens": 0,    "cost_credits": 0,    "credential_id": "string",    "error": "string",    "first_token_ms": 0,    "image_dimensions": "string",    "image_quality": "string",    "input_api": "string",    "is_stream": true,    "key_hint": "string",    "labels": {      "property1": "string",      "property2": "string"    },    "latency_ms": 0,    "list_credits": 0,    "model": "string",    "prompt_tokens": 0,    "reasoning_tokens": 0,    "request_id": "string",    "retry_count": 0,    "route_id": "string",    "status": 0,    "time": "string",    "usage_kind": "string"  }]