Skip to main content

images

Creates, updates, deletes, gets or lists an images resource.

Overview

Nameimages
TypeResource
Idopenai_admin.usage.images

Fields

The following fields are returned by SELECT queries:

Usage data retrieved successfully.

NameDatatypeDescription
end_timeinteger
objectstring (bucket)
resultsarray
start_timeinteger

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
listselectstart_timeend_time, bucket_width, sources, sizes, project_ids, user_ids, api_key_ids, models, group_by, limit, page

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
start_timeintegerStart time (Unix seconds) of the query time range, inclusive.
api_key_idsarrayReturn only usage for these API keys.
bucket_widthstringWidth of each time bucket in response. Currently 1m, 1h and 1d are supported, default to 1d.
end_timeintegerEnd time (Unix seconds) of the query time range, exclusive.
group_byarrayGroup 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.
limitintegerSpecifies 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
modelsarrayReturn only usage for these models.
pagestringA cursor for use in pagination. Corresponding to the next_page field from the previous response.
project_idsarrayReturn only usage for these projects.
sizesarrayReturn only usages for these image sizes. Possible values are 256x256, 512x512, 1024x1024, 1792x1792, 1024x1792 or any combination of them.
sourcesarrayReturn only usages for these sources. Possible values are image.generation, image.edit, image.variation or any combination of them.
user_idsarrayReturn only usage for these users.

SELECT examples

Usage data retrieved successfully.

SELECT
end_time,
object,
results,
start_time
FROM openai_admin.usage.images
WHERE start_time = '{{ start_time }}' -- required
AND end_time = '{{ end_time }}'
AND bucket_width = '{{ bucket_width }}'
AND sources = '{{ sources }}'
AND sizes = '{{ sizes }}'
AND project_ids = '{{ project_ids }}'
AND user_ids = '{{ user_ids }}'
AND api_key_ids = '{{ api_key_ids }}'
AND models = '{{ models }}'
AND group_by = '{{ group_by }}'
AND limit = '{{ limit }}'
AND page = '{{ page }}'
;