Skip to content
For the complete documentation index, see llms.txt. Markdown versions of documentation pages are available by appending .md to the page URL.
Primary navigation

Images

admin.organization.usage.images(**kwargs) -> UsageImagesResponse { data, has_more, next_page, object }
GET/organization/usage/images

Get images usage details for the organization.

ParametersExpand Collapse
start_time: Integer

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

api_key_ids: Array[String]

Return only usage for these API keys.

bucket_width: :"1m" | :"1h" | :"1d"

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

end_time: Integer

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

group_by: Array[:project_id | :user_id | :api_key_id | 3 more]

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
models: Array[String]

Return only usage for these models.

page: String

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

project_ids: Array[String]

Return only usage for these projects.

sizes: Array[:"256x256" | :"512x512" | :"1024x1024" | 2 more]

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

sources: Array[:"image.generation" | :"image.edit" | :"image.variation"]

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

user_ids: Array[String]

Return only usage for these users.

ReturnsExpand Collapse
class UsageImagesResponse { data, has_more, next_page, object }
data: Array[Data{ end_time, object, results, start_time}]
has_more: bool
next_page: String
object: :page

Images

require "openai"

openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")

response = openai.admin.organization.usage.images(start_time: 0)

puts(response)
{
    "object": "page",
    "data": [
        {
            "object": "bucket",
            "start_time": 1730419200,
            "end_time": 1730505600,
            "results": [
                {
                    "object": "organization.usage.images.result",
                    "images": 2,
                    "num_model_requests": 2,
                    "size": null,
                    "source": null,
                    "project_id": null,
                    "user_id": null,
                    "api_key_id": null,
                    "model": null
                }
            ]
        }
    ],
    "has_more": false,
    "next_page": null
}
Returns Examples
{
    "object": "page",
    "data": [
        {
            "object": "bucket",
            "start_time": 1730419200,
            "end_time": 1730505600,
            "results": [
                {
                    "object": "organization.usage.images.result",
                    "images": 2,
                    "num_model_requests": 2,
                    "size": null,
                    "source": null,
                    "project_id": null,
                    "user_id": null,
                    "api_key_id": null,
                    "model": null
                }
            ]
        }
    ],
    "has_more": false,
    "next_page": null
}