Query parameters
-
Start time (Unix seconds) of the query time range, inclusive.
-
End time (Unix seconds) of the query time range, exclusive.
-
Width of each time bucket in response. Currently
1m,1hand1dare supported, default to1d.Values are
1m,1h, or1d. Default value is1d. -
Return only usages for these sources. Possible values are
image.generation,image.edit,image.variationor any combination of them.Values are
image.generation,image.edit, orimage.variation. -
Return only usages for these image sizes. Possible values are
256x256,512x512,1024x1024,1792x1792,1024x1792or any combination of them.Values are
256x256,512x512,1024x1024,1792x1792, or1024x1792. -
Return only usage for these projects.
-
Return only usage for these users.
-
Return only usage for these API keys.
-
Return only usage for these models.
-
Group the usage data by the specified fields. Support fields include
project_id,user_id,api_key_id,model,size,sourceor any combination of them.Values are
project_id,user_id,api_key_id,model,size, orsource. -
Specifies the number of buckets to return.
bucket_width=1d: default: 7, max: 31bucket_width=1h: default: 24, max: 168bucket_width=1m: default: 60, max: 1440
-
A cursor for use in pagination. Corresponding to the
next_pagefield from the previous response.
curl \
--request GET 'https://api.openai.com/v1/organization/usage/images?start_time=42' \
--header "Authorization: Bearer $ACCESS_TOKEN"
{
"object": "page",
"data": [
{
"object": "bucket",
"start_time": 42,
"end_time": 42,
"result": [
{
"object": "organization.usage.completions.result",
"input_tokens": 42,
"input_cached_tokens": 42,
"output_tokens": 42,
"input_audio_tokens": 42,
"output_audio_tokens": 42,
"num_model_requests": 42,
"project_id": "string",
"user_id": "string",
"api_key_id": "string",
"model": "string",
"batch": true
}
]
}
],
"has_more": true,
"next_page": "string"
}