Images
Get images usage details for the organization.
ParametersExpand Collapse
query AdminOrganizationUsageImagesParams
Width of each time bucket in response. Currently 1m, 1h and 1d are supported, default to 1d.
Width of each time bucket in response. Currently 1m, 1h and 1d are supported, default to 1d.
GroupBy param.Field[[]string]OptionalGroup 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.
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.
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_page field from the previous response.
Sizes param.Field[[]string]OptionalReturn only usages for these image sizes. Possible values are 256x256, 512x512, 1024x1024, 1792x1792, 1024x1792 or any combination of them.
Return only usages for these image sizes. Possible values are 256x256, 512x512, 1024x1024, 1792x1792, 1024x1792 or any combination of them.
Sources param.Field[[]string]OptionalReturn only usages for these sources. Possible values are image.generation, image.edit, image.variation or any combination of them.
Return only usages for these sources. Possible values are image.generation, image.edit, image.variation or any combination of them.
ReturnsExpand Collapse
type AdminOrganizationUsageImagesResponse struct{…}
Data []AdminOrganizationUsageImagesResponseData
Results []AdminOrganizationUsageImagesResponseDataResultUnion
type AdminOrganizationUsageImagesResponseDataResultOrganizationUsageCompletionsResult struct{…}The aggregated completions usage details of the specific time bucket.
The aggregated completions usage details of the specific time bucket.
The aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens.
The aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens.
When group_by=api_key_id, this field provides the API key ID of the grouped usage result.
When group_by=batch, this field tells whether the grouped usage result is batch or not.
The aggregated number of audio input tokens used, including cached tokens.
The aggregated number of text input tokens that has been cached from previous requests. For customers subscribe to scale tier, this includes scale tier tokens.
When group_by=model, this field provides the model name of the grouped usage result.
When group_by=project_id, this field provides the project ID of the grouped usage result.
type AdminOrganizationUsageImagesResponseDataResultOrganizationUsageEmbeddingsResult struct{…}The aggregated embeddings usage details of the specific time bucket.
The aggregated embeddings usage details of the specific time bucket.
When group_by=api_key_id, this field provides the API key ID of the grouped usage result.
When group_by=model, this field provides the model name of the grouped usage result.
type AdminOrganizationUsageImagesResponseDataResultOrganizationUsageModerationsResult struct{…}The aggregated moderations usage details of the specific time bucket.
The aggregated moderations usage details of the specific time bucket.
When group_by=api_key_id, this field provides the API key ID of the grouped usage result.
When group_by=model, this field provides the model name of the grouped usage result.
type AdminOrganizationUsageImagesResponseDataResultOrganizationUsageImagesResult struct{…}The aggregated images usage details of the specific time bucket.
The aggregated images usage details of the specific time bucket.
When group_by=api_key_id, this field provides the API key ID of the grouped usage result.
When group_by=model, this field provides the model name of the grouped usage result.
When group_by=project_id, this field provides the project ID of the grouped usage result.
When group_by=size, this field provides the image size of the grouped usage result.
type AdminOrganizationUsageImagesResponseDataResultOrganizationUsageAudioSpeechesResult struct{…}The aggregated audio speeches usage details of the specific time bucket.
The aggregated audio speeches usage details of the specific time bucket.
When group_by=api_key_id, this field provides the API key ID of the grouped usage result.
When group_by=model, this field provides the model name of the grouped usage result.
type AdminOrganizationUsageImagesResponseDataResultOrganizationUsageAudioTranscriptionsResult struct{…}The aggregated audio transcriptions usage details of the specific time bucket.
The aggregated audio transcriptions usage details of the specific time bucket.
When group_by=api_key_id, this field provides the API key ID of the grouped usage result.
When group_by=model, this field provides the model name of the grouped usage result.
type AdminOrganizationUsageImagesResponseDataResultOrganizationUsageVectorStoresResult struct{…}The aggregated vector stores usage details of the specific time bucket.
The aggregated vector stores usage details of the specific time bucket.
type AdminOrganizationUsageImagesResponseDataResultOrganizationUsageCodeInterpreterSessionsResult struct{…}The aggregated code interpreter sessions usage details of the specific time bucket.
The aggregated code interpreter sessions usage details of the specific time bucket.
type AdminOrganizationUsageImagesResponseDataResultOrganizationUsageFileSearchesResult struct{…}The aggregated file search calls usage details of the specific time bucket.
The aggregated file search calls usage details of the specific time bucket.
When group_by=api_key_id, this field provides the API key ID of the grouped usage result.
When group_by=project_id, this field provides the project ID of the grouped usage result.
type AdminOrganizationUsageImagesResponseDataResultOrganizationUsageWebSearchesResult struct{…}The aggregated web search calls usage details of the specific time bucket.
The aggregated web search calls usage details of the specific time bucket.
When group_by=api_key_id, this field provides the API key ID of the grouped usage result.
When group_by=context_level, this field provides the search context size of the grouped usage result.
When group_by=model, this field provides the model name of the grouped usage result.
type AdminOrganizationUsageImagesResponseDataResultOrganizationCostsResult struct{…}The aggregated costs details of the specific time bucket.
The aggregated costs details of the specific time bucket.
Amount AdminOrganizationUsageImagesResponseDataResultOrganizationCostsResultAmountOptionalThe monetary value in its associated currency.
The monetary value in its associated currency.
When group_by=api_key_id, this field provides the API Key ID of the grouped costs result.
When group_by=line_item, this field provides the line item of the grouped costs result.
Images
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
response, err := client.Admin.Organization.Usage.Images(context.TODO(), openai.AdminOrganizationUsageImagesParams{
StartTime: 0,
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Data)
}
{
"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
}