GET
/
organization
/
usage
/
images
curl --request GET \
  --url https://api.openai.com/v1/organization/usage/images \
  --header 'Authorization: Bearer <token>'
{
  "object": "page",
  "data": [
    {
      "object": "bucket",
      "start_time": 123,
      "end_time": 123,
      "result": [
        {
          "object": "organization.usage.completions.result",
          "input_tokens": 123,
          "input_cached_tokens": 123,
          "output_tokens": 123,
          "input_audio_tokens": 123,
          "output_audio_tokens": 123,
          "num_model_requests": 123,
          "project_id": "<string>",
          "user_id": "<string>",
          "api_key_id": "<string>",
          "model": "<string>",
          "batch": true
        }
      ]
    }
  ],
  "has_more": true,
  "next_page": "<string>"
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Query Parameters

start_time
integer
required

Start time (Unix seconds) of the query time range, inclusive.

end_time
integer

End time (Unix seconds) of the query time range, exclusive.

bucket_width
enum<string>
default:1d

Width of each time bucket in response. Currently 1m, 1h and 1d are supported, default to 1d.

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

Return only usages for these sources. Possible values are image.generation, image.edit, image.variation or any combination of them.

sizes
enum<string>[]

Return only usages for these image sizes. Possible values are 256x256, 512x512, 1024x1024, 1792x1792, 1024x1792 or any combination of them.

project_ids
string[]

Return only usage for these projects.

user_ids
string[]

Return only usage for these users.

api_key_ids
string[]

Return only usage for these API keys.

models
string[]

Return only usage for these models.

group_by
enum<string>[]

Group the usage data by the specified fields. Support fields include project_id, user_id, api_key_id, model, size, source or any combination of them.

limit
integer

Specifies the number of buckets to return.

  • bucket_width=1d: default: 7, max: 31
  • bucket_width=1h: default: 24, max: 168
  • bucket_width=1m: default: 60, max: 1440
page
string

A cursor for use in pagination. Corresponding to the next_page field from the previous response.

Response

200 - application/json

Usage data retrieved successfully.

The response is of type object.