openai
Version:
The official TypeScript library for the OpenAI API
1,909 lines (1,601 loc) • 117 kB
text/typescript
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from '../../../core/resource';
import { APIPromise } from '../../../core/api-promise';
import { RequestOptions } from '../../../internal/request-options';
export class Usage extends APIResource {
/**
* Get audio speeches usage details for the organization.
*
* @example
* ```ts
* const response =
* await client.admin.organization.usage.audioSpeeches({
* start_time: 0,
* });
* ```
*/
audioSpeeches(
query: UsageAudioSpeechesParams,
options?: RequestOptions,
): APIPromise<UsageAudioSpeechesResponse> {
return this._client.get('/organization/usage/audio_speeches', {
query,
...options,
__security: { adminAPIKeyAuth: true },
});
}
/**
* Get audio transcriptions usage details for the organization.
*
* @example
* ```ts
* const response =
* await client.admin.organization.usage.audioTranscriptions(
* { start_time: 0 },
* );
* ```
*/
audioTranscriptions(
query: UsageAudioTranscriptionsParams,
options?: RequestOptions,
): APIPromise<UsageAudioTranscriptionsResponse> {
return this._client.get('/organization/usage/audio_transcriptions', {
query,
...options,
__security: { adminAPIKeyAuth: true },
});
}
/**
* Get code interpreter sessions usage details for the organization.
*
* @example
* ```ts
* const response =
* await client.admin.organization.usage.codeInterpreterSessions(
* { start_time: 0 },
* );
* ```
*/
codeInterpreterSessions(
query: UsageCodeInterpreterSessionsParams,
options?: RequestOptions,
): APIPromise<UsageCodeInterpreterSessionsResponse> {
return this._client.get('/organization/usage/code_interpreter_sessions', {
query,
...options,
__security: { adminAPIKeyAuth: true },
});
}
/**
* Get completions usage details for the organization.
*
* @example
* ```ts
* const response =
* await client.admin.organization.usage.completions({
* start_time: 0,
* });
* ```
*/
completions(query: UsageCompletionsParams, options?: RequestOptions): APIPromise<UsageCompletionsResponse> {
return this._client.get('/organization/usage/completions', {
query,
...options,
__security: { adminAPIKeyAuth: true },
});
}
/**
* Get costs details for the organization.
*
* @example
* ```ts
* const response =
* await client.admin.organization.usage.costs({
* start_time: 0,
* });
* ```
*/
costs(query: UsageCostsParams, options?: RequestOptions): APIPromise<UsageCostsResponse> {
return this._client.get('/organization/costs', {
query,
...options,
__security: { adminAPIKeyAuth: true },
});
}
/**
* Get embeddings usage details for the organization.
*
* @example
* ```ts
* const response =
* await client.admin.organization.usage.embeddings({
* start_time: 0,
* });
* ```
*/
embeddings(query: UsageEmbeddingsParams, options?: RequestOptions): APIPromise<UsageEmbeddingsResponse> {
return this._client.get('/organization/usage/embeddings', {
query,
...options,
__security: { adminAPIKeyAuth: true },
});
}
/**
* Get images usage details for the organization.
*
* @example
* ```ts
* const response =
* await client.admin.organization.usage.images({
* start_time: 0,
* });
* ```
*/
images(query: UsageImagesParams, options?: RequestOptions): APIPromise<UsageImagesResponse> {
return this._client.get('/organization/usage/images', {
query,
...options,
__security: { adminAPIKeyAuth: true },
});
}
/**
* Get moderations usage details for the organization.
*
* @example
* ```ts
* const response =
* await client.admin.organization.usage.moderations({
* start_time: 0,
* });
* ```
*/
moderations(query: UsageModerationsParams, options?: RequestOptions): APIPromise<UsageModerationsResponse> {
return this._client.get('/organization/usage/moderations', {
query,
...options,
__security: { adminAPIKeyAuth: true },
});
}
/**
* Get vector stores usage details for the organization.
*
* @example
* ```ts
* const response =
* await client.admin.organization.usage.vectorStores({
* start_time: 0,
* });
* ```
*/
vectorStores(
query: UsageVectorStoresParams,
options?: RequestOptions,
): APIPromise<UsageVectorStoresResponse> {
return this._client.get('/organization/usage/vector_stores', {
query,
...options,
__security: { adminAPIKeyAuth: true },
});
}
}
export interface UsageAudioSpeechesResponse {
data: Array<UsageAudioSpeechesResponse.Data>;
has_more: boolean;
next_page: string | null;
object: 'page';
}
export namespace UsageAudioSpeechesResponse {
export interface Data {
end_time: number;
object: 'bucket';
results: Array<
| Data.OrganizationUsageCompletionsResult
| Data.OrganizationUsageEmbeddingsResult
| Data.OrganizationUsageModerationsResult
| Data.OrganizationUsageImagesResult
| Data.OrganizationUsageAudioSpeechesResult
| Data.OrganizationUsageAudioTranscriptionsResult
| Data.OrganizationUsageVectorStoresResult
| Data.OrganizationUsageCodeInterpreterSessionsResult
| Data.OrganizationCostsResult
>;
start_time: number;
}
export namespace Data {
/**
* The aggregated completions usage details of the specific time bucket.
*/
export interface OrganizationUsageCompletionsResult {
/**
* The aggregated number of text input tokens used, including cached tokens. For
* customers subscribe to scale tier, this includes scale tier tokens.
*/
input_tokens: number;
/**
* The count of requests made to the model.
*/
num_model_requests: number;
object: 'organization.usage.completions.result';
/**
* The aggregated number of text output tokens used. For customers subscribe to
* scale tier, this includes scale tier tokens.
*/
output_tokens: number;
/**
* When `group_by=api_key_id`, this field provides the API key ID of the grouped
* usage result.
*/
api_key_id?: string | null;
/**
* When `group_by=batch`, this field tells whether the grouped usage result is
* batch or not.
*/
batch?: boolean | null;
/**
* The aggregated number of audio input tokens used, including cached tokens.
*/
input_audio_tokens?: number;
/**
* 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.
*/
input_cached_tokens?: number;
/**
* When `group_by=model`, this field provides the model name of the grouped usage
* result.
*/
model?: string | null;
/**
* The aggregated number of audio output tokens used.
*/
output_audio_tokens?: number;
/**
* When `group_by=project_id`, this field provides the project ID of the grouped
* usage result.
*/
project_id?: string | null;
/**
* When `group_by=service_tier`, this field provides the service tier of the
* grouped usage result.
*/
service_tier?: string | null;
/**
* When `group_by=user_id`, this field provides the user ID of the grouped usage
* result.
*/
user_id?: string | null;
}
/**
* The aggregated embeddings usage details of the specific time bucket.
*/
export interface OrganizationUsageEmbeddingsResult {
/**
* The aggregated number of input tokens used.
*/
input_tokens: number;
/**
* The count of requests made to the model.
*/
num_model_requests: number;
object: 'organization.usage.embeddings.result';
/**
* When `group_by=api_key_id`, this field provides the API key ID of the grouped
* usage result.
*/
api_key_id?: string | null;
/**
* When `group_by=model`, this field provides the model name of the grouped usage
* result.
*/
model?: string | null;
/**
* When `group_by=project_id`, this field provides the project ID of the grouped
* usage result.
*/
project_id?: string | null;
/**
* When `group_by=user_id`, this field provides the user ID of the grouped usage
* result.
*/
user_id?: string | null;
}
/**
* The aggregated moderations usage details of the specific time bucket.
*/
export interface OrganizationUsageModerationsResult {
/**
* The aggregated number of input tokens used.
*/
input_tokens: number;
/**
* The count of requests made to the model.
*/
num_model_requests: number;
object: 'organization.usage.moderations.result';
/**
* When `group_by=api_key_id`, this field provides the API key ID of the grouped
* usage result.
*/
api_key_id?: string | null;
/**
* When `group_by=model`, this field provides the model name of the grouped usage
* result.
*/
model?: string | null;
/**
* When `group_by=project_id`, this field provides the project ID of the grouped
* usage result.
*/
project_id?: string | null;
/**
* When `group_by=user_id`, this field provides the user ID of the grouped usage
* result.
*/
user_id?: string | null;
}
/**
* The aggregated images usage details of the specific time bucket.
*/
export interface OrganizationUsageImagesResult {
/**
* The number of images processed.
*/
images: number;
/**
* The count of requests made to the model.
*/
num_model_requests: number;
object: 'organization.usage.images.result';
/**
* When `group_by=api_key_id`, this field provides the API key ID of the grouped
* usage result.
*/
api_key_id?: string | null;
/**
* When `group_by=model`, this field provides the model name of the grouped usage
* result.
*/
model?: string | null;
/**
* When `group_by=project_id`, this field provides the project ID of the grouped
* usage result.
*/
project_id?: string | null;
/**
* When `group_by=size`, this field provides the image size of the grouped usage
* result.
*/
size?: string | null;
/**
* When `group_by=source`, this field provides the source of the grouped usage
* result, possible values are `image.generation`, `image.edit`, `image.variation`.
*/
source?: string | null;
/**
* When `group_by=user_id`, this field provides the user ID of the grouped usage
* result.
*/
user_id?: string | null;
}
/**
* The aggregated audio speeches usage details of the specific time bucket.
*/
export interface OrganizationUsageAudioSpeechesResult {
/**
* The number of characters processed.
*/
characters: number;
/**
* The count of requests made to the model.
*/
num_model_requests: number;
object: 'organization.usage.audio_speeches.result';
/**
* When `group_by=api_key_id`, this field provides the API key ID of the grouped
* usage result.
*/
api_key_id?: string | null;
/**
* When `group_by=model`, this field provides the model name of the grouped usage
* result.
*/
model?: string | null;
/**
* When `group_by=project_id`, this field provides the project ID of the grouped
* usage result.
*/
project_id?: string | null;
/**
* When `group_by=user_id`, this field provides the user ID of the grouped usage
* result.
*/
user_id?: string | null;
}
/**
* The aggregated audio transcriptions usage details of the specific time bucket.
*/
export interface OrganizationUsageAudioTranscriptionsResult {
/**
* The count of requests made to the model.
*/
num_model_requests: number;
object: 'organization.usage.audio_transcriptions.result';
/**
* The number of seconds processed.
*/
seconds: number;
/**
* When `group_by=api_key_id`, this field provides the API key ID of the grouped
* usage result.
*/
api_key_id?: string | null;
/**
* When `group_by=model`, this field provides the model name of the grouped usage
* result.
*/
model?: string | null;
/**
* When `group_by=project_id`, this field provides the project ID of the grouped
* usage result.
*/
project_id?: string | null;
/**
* When `group_by=user_id`, this field provides the user ID of the grouped usage
* result.
*/
user_id?: string | null;
}
/**
* The aggregated vector stores usage details of the specific time bucket.
*/
export interface OrganizationUsageVectorStoresResult {
object: 'organization.usage.vector_stores.result';
/**
* The vector stores usage in bytes.
*/
usage_bytes: number;
/**
* When `group_by=project_id`, this field provides the project ID of the grouped
* usage result.
*/
project_id?: string | null;
}
/**
* The aggregated code interpreter sessions usage details of the specific time
* bucket.
*/
export interface OrganizationUsageCodeInterpreterSessionsResult {
/**
* The number of code interpreter sessions.
*/
num_sessions: number;
object: 'organization.usage.code_interpreter_sessions.result';
/**
* When `group_by=project_id`, this field provides the project ID of the grouped
* usage result.
*/
project_id?: string | null;
}
/**
* The aggregated costs details of the specific time bucket.
*/
export interface OrganizationCostsResult {
object: 'organization.costs.result';
/**
* The monetary value in its associated currency.
*/
amount?: OrganizationCostsResult.Amount;
/**
* When `group_by=api_key_id`, this field provides the API Key ID of the grouped
* costs result.
*/
api_key_id?: string | null;
/**
* When `group_by=line_item`, this field provides the line item of the grouped
* costs result.
*/
line_item?: string | null;
/**
* When `group_by=project_id`, this field provides the project ID of the grouped
* costs result.
*/
project_id?: string | null;
/**
* When `group_by=line_item`, this field provides the quantity of the grouped costs
* result.
*/
quantity?: number | null;
}
export namespace OrganizationCostsResult {
/**
* The monetary value in its associated currency.
*/
export interface Amount {
/**
* Lowercase ISO-4217 currency e.g. "usd"
*/
currency?: string;
/**
* The numeric value of the cost.
*/
value?: number;
}
}
}
}
export interface UsageAudioTranscriptionsResponse {
data: Array<UsageAudioTranscriptionsResponse.Data>;
has_more: boolean;
next_page: string | null;
object: 'page';
}
export namespace UsageAudioTranscriptionsResponse {
export interface Data {
end_time: number;
object: 'bucket';
results: Array<
| Data.OrganizationUsageCompletionsResult
| Data.OrganizationUsageEmbeddingsResult
| Data.OrganizationUsageModerationsResult
| Data.OrganizationUsageImagesResult
| Data.OrganizationUsageAudioSpeechesResult
| Data.OrganizationUsageAudioTranscriptionsResult
| Data.OrganizationUsageVectorStoresResult
| Data.OrganizationUsageCodeInterpreterSessionsResult
| Data.OrganizationCostsResult
>;
start_time: number;
}
export namespace Data {
/**
* The aggregated completions usage details of the specific time bucket.
*/
export interface OrganizationUsageCompletionsResult {
/**
* The aggregated number of text input tokens used, including cached tokens. For
* customers subscribe to scale tier, this includes scale tier tokens.
*/
input_tokens: number;
/**
* The count of requests made to the model.
*/
num_model_requests: number;
object: 'organization.usage.completions.result';
/**
* The aggregated number of text output tokens used. For customers subscribe to
* scale tier, this includes scale tier tokens.
*/
output_tokens: number;
/**
* When `group_by=api_key_id`, this field provides the API key ID of the grouped
* usage result.
*/
api_key_id?: string | null;
/**
* When `group_by=batch`, this field tells whether the grouped usage result is
* batch or not.
*/
batch?: boolean | null;
/**
* The aggregated number of audio input tokens used, including cached tokens.
*/
input_audio_tokens?: number;
/**
* 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.
*/
input_cached_tokens?: number;
/**
* When `group_by=model`, this field provides the model name of the grouped usage
* result.
*/
model?: string | null;
/**
* The aggregated number of audio output tokens used.
*/
output_audio_tokens?: number;
/**
* When `group_by=project_id`, this field provides the project ID of the grouped
* usage result.
*/
project_id?: string | null;
/**
* When `group_by=service_tier`, this field provides the service tier of the
* grouped usage result.
*/
service_tier?: string | null;
/**
* When `group_by=user_id`, this field provides the user ID of the grouped usage
* result.
*/
user_id?: string | null;
}
/**
* The aggregated embeddings usage details of the specific time bucket.
*/
export interface OrganizationUsageEmbeddingsResult {
/**
* The aggregated number of input tokens used.
*/
input_tokens: number;
/**
* The count of requests made to the model.
*/
num_model_requests: number;
object: 'organization.usage.embeddings.result';
/**
* When `group_by=api_key_id`, this field provides the API key ID of the grouped
* usage result.
*/
api_key_id?: string | null;
/**
* When `group_by=model`, this field provides the model name of the grouped usage
* result.
*/
model?: string | null;
/**
* When `group_by=project_id`, this field provides the project ID of the grouped
* usage result.
*/
project_id?: string | null;
/**
* When `group_by=user_id`, this field provides the user ID of the grouped usage
* result.
*/
user_id?: string | null;
}
/**
* The aggregated moderations usage details of the specific time bucket.
*/
export interface OrganizationUsageModerationsResult {
/**
* The aggregated number of input tokens used.
*/
input_tokens: number;
/**
* The count of requests made to the model.
*/
num_model_requests: number;
object: 'organization.usage.moderations.result';
/**
* When `group_by=api_key_id`, this field provides the API key ID of the grouped
* usage result.
*/
api_key_id?: string | null;
/**
* When `group_by=model`, this field provides the model name of the grouped usage
* result.
*/
model?: string | null;
/**
* When `group_by=project_id`, this field provides the project ID of the grouped
* usage result.
*/
project_id?: string | null;
/**
* When `group_by=user_id`, this field provides the user ID of the grouped usage
* result.
*/
user_id?: string | null;
}
/**
* The aggregated images usage details of the specific time bucket.
*/
export interface OrganizationUsageImagesResult {
/**
* The number of images processed.
*/
images: number;
/**
* The count of requests made to the model.
*/
num_model_requests: number;
object: 'organization.usage.images.result';
/**
* When `group_by=api_key_id`, this field provides the API key ID of the grouped
* usage result.
*/
api_key_id?: string | null;
/**
* When `group_by=model`, this field provides the model name of the grouped usage
* result.
*/
model?: string | null;
/**
* When `group_by=project_id`, this field provides the project ID of the grouped
* usage result.
*/
project_id?: string | null;
/**
* When `group_by=size`, this field provides the image size of the grouped usage
* result.
*/
size?: string | null;
/**
* When `group_by=source`, this field provides the source of the grouped usage
* result, possible values are `image.generation`, `image.edit`, `image.variation`.
*/
source?: string | null;
/**
* When `group_by=user_id`, this field provides the user ID of the grouped usage
* result.
*/
user_id?: string | null;
}
/**
* The aggregated audio speeches usage details of the specific time bucket.
*/
export interface OrganizationUsageAudioSpeechesResult {
/**
* The number of characters processed.
*/
characters: number;
/**
* The count of requests made to the model.
*/
num_model_requests: number;
object: 'organization.usage.audio_speeches.result';
/**
* When `group_by=api_key_id`, this field provides the API key ID of the grouped
* usage result.
*/
api_key_id?: string | null;
/**
* When `group_by=model`, this field provides the model name of the grouped usage
* result.
*/
model?: string | null;
/**
* When `group_by=project_id`, this field provides the project ID of the grouped
* usage result.
*/
project_id?: string | null;
/**
* When `group_by=user_id`, this field provides the user ID of the grouped usage
* result.
*/
user_id?: string | null;
}
/**
* The aggregated audio transcriptions usage details of the specific time bucket.
*/
export interface OrganizationUsageAudioTranscriptionsResult {
/**
* The count of requests made to the model.
*/
num_model_requests: number;
object: 'organization.usage.audio_transcriptions.result';
/**
* The number of seconds processed.
*/
seconds: number;
/**
* When `group_by=api_key_id`, this field provides the API key ID of the grouped
* usage result.
*/
api_key_id?: string | null;
/**
* When `group_by=model`, this field provides the model name of the grouped usage
* result.
*/
model?: string | null;
/**
* When `group_by=project_id`, this field provides the project ID of the grouped
* usage result.
*/
project_id?: string | null;
/**
* When `group_by=user_id`, this field provides the user ID of the grouped usage
* result.
*/
user_id?: string | null;
}
/**
* The aggregated vector stores usage details of the specific time bucket.
*/
export interface OrganizationUsageVectorStoresResult {
object: 'organization.usage.vector_stores.result';
/**
* The vector stores usage in bytes.
*/
usage_bytes: number;
/**
* When `group_by=project_id`, this field provides the project ID of the grouped
* usage result.
*/
project_id?: string | null;
}
/**
* The aggregated code interpreter sessions usage details of the specific time
* bucket.
*/
export interface OrganizationUsageCodeInterpreterSessionsResult {
/**
* The number of code interpreter sessions.
*/
num_sessions: number;
object: 'organization.usage.code_interpreter_sessions.result';
/**
* When `group_by=project_id`, this field provides the project ID of the grouped
* usage result.
*/
project_id?: string | null;
}
/**
* The aggregated costs details of the specific time bucket.
*/
export interface OrganizationCostsResult {
object: 'organization.costs.result';
/**
* The monetary value in its associated currency.
*/
amount?: OrganizationCostsResult.Amount;
/**
* When `group_by=api_key_id`, this field provides the API Key ID of the grouped
* costs result.
*/
api_key_id?: string | null;
/**
* When `group_by=line_item`, this field provides the line item of the grouped
* costs result.
*/
line_item?: string | null;
/**
* When `group_by=project_id`, this field provides the project ID of the grouped
* costs result.
*/
project_id?: string | null;
/**
* When `group_by=line_item`, this field provides the quantity of the grouped costs
* result.
*/
quantity?: number | null;
}
export namespace OrganizationCostsResult {
/**
* The monetary value in its associated currency.
*/
export interface Amount {
/**
* Lowercase ISO-4217 currency e.g. "usd"
*/
currency?: string;
/**
* The numeric value of the cost.
*/
value?: number;
}
}
}
}
export interface UsageCodeInterpreterSessionsResponse {
data: Array<UsageCodeInterpreterSessionsResponse.Data>;
has_more: boolean;
next_page: string | null;
object: 'page';
}
export namespace UsageCodeInterpreterSessionsResponse {
export interface Data {
end_time: number;
object: 'bucket';
results: Array<
| Data.OrganizationUsageCompletionsResult
| Data.OrganizationUsageEmbeddingsResult
| Data.OrganizationUsageModerationsResult
| Data.OrganizationUsageImagesResult
| Data.OrganizationUsageAudioSpeechesResult
| Data.OrganizationUsageAudioTranscriptionsResult
| Data.OrganizationUsageVectorStoresResult
| Data.OrganizationUsageCodeInterpreterSessionsResult
| Data.OrganizationCostsResult
>;
start_time: number;
}
export namespace Data {
/**
* The aggregated completions usage details of the specific time bucket.
*/
export interface OrganizationUsageCompletionsResult {
/**
* The aggregated number of text input tokens used, including cached tokens. For
* customers subscribe to scale tier, this includes scale tier tokens.
*/
input_tokens: number;
/**
* The count of requests made to the model.
*/
num_model_requests: number;
object: 'organization.usage.completions.result';
/**
* The aggregated number of text output tokens used. For customers subscribe to
* scale tier, this includes scale tier tokens.
*/
output_tokens: number;
/**
* When `group_by=api_key_id`, this field provides the API key ID of the grouped
* usage result.
*/
api_key_id?: string | null;
/**
* When `group_by=batch`, this field tells whether the grouped usage result is
* batch or not.
*/
batch?: boolean | null;
/**
* The aggregated number of audio input tokens used, including cached tokens.
*/
input_audio_tokens?: number;
/**
* 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.
*/
input_cached_tokens?: number;
/**
* When `group_by=model`, this field provides the model name of the grouped usage
* result.
*/
model?: string | null;
/**
* The aggregated number of audio output tokens used.
*/
output_audio_tokens?: number;
/**
* When `group_by=project_id`, this field provides the project ID of the grouped
* usage result.
*/
project_id?: string | null;
/**
* When `group_by=service_tier`, this field provides the service tier of the
* grouped usage result.
*/
service_tier?: string | null;
/**
* When `group_by=user_id`, this field provides the user ID of the grouped usage
* result.
*/
user_id?: string | null;
}
/**
* The aggregated embeddings usage details of the specific time bucket.
*/
export interface OrganizationUsageEmbeddingsResult {
/**
* The aggregated number of input tokens used.
*/
input_tokens: number;
/**
* The count of requests made to the model.
*/
num_model_requests: number;
object: 'organization.usage.embeddings.result';
/**
* When `group_by=api_key_id`, this field provides the API key ID of the grouped
* usage result.
*/
api_key_id?: string | null;
/**
* When `group_by=model`, this field provides the model name of the grouped usage
* result.
*/
model?: string | null;
/**
* When `group_by=project_id`, this field provides the project ID of the grouped
* usage result.
*/
project_id?: string | null;
/**
* When `group_by=user_id`, this field provides the user ID of the grouped usage
* result.
*/
user_id?: string | null;
}
/**
* The aggregated moderations usage details of the specific time bucket.
*/
export interface OrganizationUsageModerationsResult {
/**
* The aggregated number of input tokens used.
*/
input_tokens: number;
/**
* The count of requests made to the model.
*/
num_model_requests: number;
object: 'organization.usage.moderations.result';
/**
* When `group_by=api_key_id`, this field provides the API key ID of the grouped
* usage result.
*/
api_key_id?: string | null;
/**
* When `group_by=model`, this field provides the model name of the grouped usage
* result.
*/
model?: string | null;
/**
* When `group_by=project_id`, this field provides the project ID of the grouped
* usage result.
*/
project_id?: string | null;
/**
* When `group_by=user_id`, this field provides the user ID of the grouped usage
* result.
*/
user_id?: string | null;
}
/**
* The aggregated images usage details of the specific time bucket.
*/
export interface OrganizationUsageImagesResult {
/**
* The number of images processed.
*/
images: number;
/**
* The count of requests made to the model.
*/
num_model_requests: number;
object: 'organization.usage.images.result';
/**
* When `group_by=api_key_id`, this field provides the API key ID of the grouped
* usage result.
*/
api_key_id?: string | null;
/**
* When `group_by=model`, this field provides the model name of the grouped usage
* result.
*/
model?: string | null;
/**
* When `group_by=project_id`, this field provides the project ID of the grouped
* usage result.
*/
project_id?: string | null;
/**
* When `group_by=size`, this field provides the image size of the grouped usage
* result.
*/
size?: string | null;
/**
* When `group_by=source`, this field provides the source of the grouped usage
* result, possible values are `image.generation`, `image.edit`, `image.variation`.
*/
source?: string | null;
/**
* When `group_by=user_id`, this field provides the user ID of the grouped usage
* result.
*/
user_id?: string | null;
}
/**
* The aggregated audio speeches usage details of the specific time bucket.
*/
export interface OrganizationUsageAudioSpeechesResult {
/**
* The number of characters processed.
*/
characters: number;
/**
* The count of requests made to the model.
*/
num_model_requests: number;
object: 'organization.usage.audio_speeches.result';
/**
* When `group_by=api_key_id`, this field provides the API key ID of the grouped
* usage result.
*/
api_key_id?: string | null;
/**
* When `group_by=model`, this field provides the model name of the grouped usage
* result.
*/
model?: string | null;
/**
* When `group_by=project_id`, this field provides the project ID of the grouped
* usage result.
*/
project_id?: string | null;
/**
* When `group_by=user_id`, this field provides the user ID of the grouped usage
* result.
*/
user_id?: string | null;
}
/**
* The aggregated audio transcriptions usage details of the specific time bucket.
*/
export interface OrganizationUsageAudioTranscriptionsResult {
/**
* The count of requests made to the model.
*/
num_model_requests: number;
object: 'organization.usage.audio_transcriptions.result';
/**
* The number of seconds processed.
*/
seconds: number;
/**
* When `group_by=api_key_id`, this field provides the API key ID of the grouped
* usage result.
*/
api_key_id?: string | null;
/**
* When `group_by=model`, this field provides the model name of the grouped usage
* result.
*/
model?: string | null;
/**
* When `group_by=project_id`, this field provides the project ID of the grouped
* usage result.
*/
project_id?: string | null;
/**
* When `group_by=user_id`, this field provides the user ID of the grouped usage
* result.
*/
user_id?: string | null;
}
/**
* The aggregated vector stores usage details of the specific time bucket.
*/
export interface OrganizationUsageVectorStoresResult {
object: 'organization.usage.vector_stores.result';
/**
* The vector stores usage in bytes.
*/
usage_bytes: number;
/**
* When `group_by=project_id`, this field provides the project ID of the grouped
* usage result.
*/
project_id?: string | null;
}
/**
* The aggregated code interpreter sessions usage details of the specific time
* bucket.
*/
export interface OrganizationUsageCodeInterpreterSessionsResult {
/**
* The number of code interpreter sessions.
*/
num_sessions: number;
object: 'organization.usage.code_interpreter_sessions.result';
/**
* When `group_by=project_id`, this field provides the project ID of the grouped
* usage result.
*/
project_id?: string | null;
}
/**
* The aggregated costs details of the specific time bucket.
*/
export interface OrganizationCostsResult {
object: 'organization.costs.result';
/**
* The monetary value in its associated currency.
*/
amount?: OrganizationCostsResult.Amount;
/**
* When `group_by=api_key_id`, this field provides the API Key ID of the grouped
* costs result.
*/
api_key_id?: string | null;
/**
* When `group_by=line_item`, this field provides the line item of the grouped
* costs result.
*/
line_item?: string | null;
/**
* When `group_by=project_id`, this field provides the project ID of the grouped
* costs result.
*/
project_id?: string | null;
/**
* When `group_by=line_item`, this field provides the quantity of the grouped costs
* result.
*/
quantity?: number | null;
}
export namespace OrganizationCostsResult {
/**
* The monetary value in its associated currency.
*/
export interface Amount {
/**
* Lowercase ISO-4217 currency e.g. "usd"
*/
currency?: string;
/**
* The numeric value of the cost.
*/
value?: number;
}
}
}
}
export interface UsageCompletionsResponse {
data: Array<UsageCompletionsResponse.Data>;
has_more: boolean;
next_page: string | null;
object: 'page';
}
export namespace UsageCompletionsResponse {
export interface Data {
end_time: number;
object: 'bucket';
results: Array<
| Data.OrganizationUsageCompletionsResult
| Data.OrganizationUsageEmbeddingsResult
| Data.OrganizationUsageModerationsResult
| Data.OrganizationUsageImagesResult
| Data.OrganizationUsageAudioSpeechesResult
| Data.OrganizationUsageAudioTranscriptionsResult
| Data.OrganizationUsageVectorStoresResult
| Data.OrganizationUsageCodeInterpreterSessionsResult
| Data.OrganizationCostsResult
>;
start_time: number;
}
export namespace Data {
/**
* The aggregated completions usage details of the specific time bucket.
*/
export interface OrganizationUsageCompletionsResult {
/**
* The aggregated number of text input tokens used, including cached tokens. For
* customers subscribe to scale tier, this includes scale tier tokens.
*/
input_tokens: number;
/**
* The count of requests made to the model.
*/
num_model_requests: number;
object: 'organization.usage.completions.result';
/**
* The aggregated number of text output tokens used. For customers subscribe to
* scale tier, this includes scale tier tokens.
*/
output_tokens: number;
/**
* When `group_by=api_key_id`, this field provides the API key ID of the grouped
* usage result.
*/
api_key_id?: string | null;
/**
* When `group_by=batch`, this field tells whether the grouped usage result is
* batch or not.
*/
batch?: boolean | null;
/**
* The aggregated number of audio input tokens used, including cached tokens.
*/
input_audio_tokens?: number;
/**
* 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.
*/
input_cached_tokens?: number;
/**
* When `group_by=model`, this field provides the model name of the grouped usage
* result.
*/
model?: string | null;
/**
* The aggregated number of audio output tokens used.
*/
output_audio_tokens?: number;
/**
* When `group_by=project_id`, this field provides the project ID of the grouped
* usage result.
*/
project_id?: string | null;
/**
* When `group_by=service_tier`, this field provides the service tier of the
* grouped usage result.
*/
service_tier?: string | null;
/**
* When `group_by=user_id`, this field provides the user ID of the grouped usage
* result.
*/
user_id?: string | null;
}
/**
* The aggregated embeddings usage details of the specific time bucket.
*/
export interface OrganizationUsageEmbeddingsResult {
/**
* The aggregated number of input tokens used.
*/
input_tokens: number;
/**
* The count of requests made to the model.
*/
num_model_requests: number;
object: 'organization.usage.embeddings.result';
/**
* When `group_by=api_key_id`, this field provides the API key ID of the grouped
* usage result.
*/
api_key_id?: string | null;
/**
* When `group_by=model`, this field provides the model name of the grouped usage
* result.
*/
model?: string | null;
/**
* When `group_by=project_id`, this field provides the project ID of the grouped
* usage result.
*/
project_id?: string | null;
/**
* When `group_by=user_id`, this field provides the user ID of the grouped usage
* result.
*/
user_id?: string | null;
}
/**
* The aggregated moderations usage details of the specific time bucket.
*/
export interface OrganizationUsageModerationsResult {
/**
* The aggregated number of input tokens used.
*/
input_tokens: number;
/**
* The count of requests made to the model.
*/
num_model_requests: number;
object: 'organization.usage.moderations.result';
/**
* When `group_by=api_key_id`, this field provides the API key ID of the grouped
* usage result.
*/
api_key_id?: string | null;
/**
* When `group_by=model`, this field provides the model name of the grouped usage
* result.
*/
model?: string | null;
/**
* When `group_by=project_id`, this field provides the project ID of the grouped
* usage result.
*/
project_id?: string | null;
/**
* When `group_by=user_id`, this field provides the user ID of the grouped usage
* result.
*/
user_id?: string | null;
}
/**
* The aggregated images usage details of the specific time bucket.
*/
export interface OrganizationUsageImagesResult {
/**
* The number of images processed.
*/
images: number;
/**
* The count of requests made to the model.
*/
num_model_requests: number;
object: 'organization.usage.images.result';
/**
* When `group_by=api_key_id`, this field provides the API key ID of the grouped
* usage result.
*/
api_key_id?: string | null;
/**
* When `group_by=model`, this field provides the model name of the grouped usage
* result.
*/
model?: string | null;
/**
* When `group_by=project_id`, this field provides the project ID of the grouped
* usage result.
*/
project_id?: string | null;
/**
* When `group_by=size`, this field provides the image size of the grouped usage
* result.
*/
size?: string | null;
/**
* When `group_by=source`, this field provides the source of the grouped usage
* result, possible values are `image.generation`, `image.edit`, `image.variation`.
*/
source?: string | null;
/**
* When `group_by=user_id`, this field provides the user ID of the grouped usage
* result.
*/
user_id?: string | null;
}
/**
* The aggregated audio speeches usage details of the specific time bucket.
*/
export interface OrganizationUsageAudioSpeechesResult {
/**
* The number of characters processed.
*/
characters: number;
/**
* The count of requests made to the model.
*/
num_model_requests: number;
object: 'organization.usage.audio_speeches.result';
/**
* When `group_by=api_key_id`, this field provides the API key ID of the grouped
* usage result.
*/
api_key_id?: string | null;
/**
* When `group_by=model`, this field provides the model name of the grouped usage
* result.
*/
model?: string | null;
/**
* When `group_by=project_id`, this field provides the project ID of the grouped
* usage result.
*/
project_id?: string | null;
/**
* When `group_by=user_id`, this field provides the user ID of the grouped usage
* result.
*/
user_id?: string | null;
}
/**
* The aggregated audio transcriptions usage details of the specific time bucket.
*/
export interface OrganizationUsageAudioTranscriptionsResult {
/**
* The count of requests made to the model.
*/
num_model_requests: number;
object: 'organization.usage.audio_transcriptions.result';
/**
* The number of seconds processed.
*/
seconds: number;
/**
* When `group_by=api_key_id`, this field provides the API key ID of the grouped
* usage result.
*/
api_key_id?: string | null;
/**
* When `group_by=model`, this field provides the model name of the grouped usage
* result.
*/
model?: string | null;
/**
* When `group_by=project_id`, this field provides the project ID of the grouped
* usage result.
*/
project_id?: string | null;
/**
* When `group_by=user_id`, this field provides the user ID of the grouped usage
* result.
*/
user_id?: string | null;
}
/**
* The aggregated vector stores usage details of the specific time bucket.
*/
export interface OrganizationUsageVectorStoresResult {
object: 'organization.usage.vector_stores.result';
/**
* The vector stores usage in bytes.
*/
usage_bytes: number;
/**
* When `group_by=project_id`, this field provides the project ID of the grouped
* usage result.
*/
project_id?: string | null;
}
/**
* The aggregated code interpreter sessions usage details of the specific time
* bucket.
*/
export interface OrganizationUsageCodeInterpreterSessionsResult {
/**
* The number of code interpreter sessions.
*/
num_sessions: number;
object: 'organization.usage.code_interpreter_sessions.result';
/**
* When `group_by=project_id`, this field provides the project ID of the grouped
* usage result.
*/
project_id?: string | null;
}
/**
* The aggregated costs details of the specific time bucket.
*/
export interface OrganizationCostsResult {
object: 'organization.costs.result';
/**
* The monetary value in its associated currency.
*/
amount?: OrganizationCostsResult.Amount;
/**
* When `group_by=api_key_id`, this field provides the API Key ID of the grouped
* costs result.
*/
api_key_id?: string | null;
/**
* When `group_by=line_item`, this field provides the line item of the grouped
* costs result.
*/
line_item?: string | null;
/**
* When `group_by=project_id`, this field provides the project ID of the grouped
* costs result.
*/
project_id?: string | null;
/**
* When `group_by=line_item`, this field provides the quantity of the grouped costs
* result.
*/
quantity?: number | null;
}
export namespace OrganizationCostsResult {
/**
* The monetary value in its associated currency.
*/
export interface Amount {
/**
* Lowercase ISO-4217 currency e.g. "usd"
*/
currency?: string;
/**
* The numeric value of the cost.
*/
value?: number;
}
}
}
}
export interface UsageCostsResponse {
data: Array<UsageCostsResponse.Data>;
has_more: boolean;
next_page: string | null;
object: 'page';
}
export namespace UsageCostsResponse {
export interface Data {
end_time: number;
object: 'bucket';
results: Array<
| Data.OrganizationUsageCompletionsResult
| Data.OrganizationUsageEmbeddingsResult
| Data.OrganizationUsageModerationsResult
| Data.OrganizationUsageImagesResult
| Data.OrganizationUsageAudioSpeechesResult
| Data.OrganizationUsageAudioTranscriptionsResult
| Data.OrganizationUsageVectorStoresResult
| Data.OrganizationUsageCodeInterpreterSessionsResult
| Data.OrganizationCostsResult
>;
start_time: number;
}
export namespace Data {
/**
* The aggregated completions usage details of the specific time bucket.
*/
export interface OrganizationUsageCompletionsResult {
/**
* The aggregated number of text input tokens used, including cached tokens. For
* customers subscribe to scale tier, this includes scale tier tokens.
*/
input_tokens: number;
/**
* The count of requests made to the model.
*/
num_m