Skip to main content
GET
cURL

Authorizations

Authorization
string
header
required

Send Authorization: Bearer <api_key>. The legacy Authorization: Api-Key <api_key> scheme is also accepted.

Query Parameters

start_time
string<date-time>
required

Start of the query range (ISO 8601, UTC), inclusive. Snapped down to the start of its bucket. Ignored when you pass a cursor.

end_time
string<date-time> | null

End of the query range (ISO 8601, UTC), exclusive. Defaults to the current time.

bucket_width
enum<string>
default:1d

Width of each time bucket: 1m, 1h, or 1d. Defaults to 1d.

Available options:
1m,
1h,
1d
group_by
enum<string>[]

Dimensions to break usage down by, repeated once per dimension: api_key, model, service_tier. Defaults to api_key.

Available options:
api_key,
model,
service_tier
api_keys
string[]

Return only usage for these API key prefixes, repeated once per prefix.

models
string[]

Return only usage for these models, repeated once per model.

service_tiers
string[]

Return only usage for these service tiers, repeated once per tier.

limit
integer | null

Number of time buckets to return. Defaults and maximums depend on bucket_width: 1d defaults to 7 and allows 31, 1h defaults to 24 and allows 168, 1m defaults to 60 and allows 1440.

cursor
string | null

Opaque cursor from the pagination.cursor field of a previous response. Pass the same query parameters alongside it, apart from start_time, which the cursor supplies.

Response

200 - application/json

A page of Model APIs token usage: contiguous time buckets, ordered oldest first.

items
ModelApisUsageBucketV1 · object[]
required

Items in this page.

pagination
PaginationResponseV1 · object
required

Pagination metadata for the page.