openai
Version:
The official TypeScript library for the OpenAI API
1,341 lines • 131 kB
text/typescript
import { APIResource } from "../../../core/resource.mjs";
import { APIPromise } from "../../../core/api-promise.mjs";
import { RequestOptions } from "../../../internal/request-options.mjs";
export declare 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>;
/**
* 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>;
/**
* 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>;
/**
* 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>;
/**
* 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>;
/**
* 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>;
/**
* 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>;
/**
* 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>;
/**
* 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>;
}
export interface UsageAudioSpeechesResponse {
data: Array<UsageAudioSpeechesResponse.Data>;
has_more: boolean;
next_page: string | null;
object: 'page';
}
export declare namespace UsageAudioSpeechesResponse {
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;
}
namespace Data {
/**
* The aggregated completions usage details of the specific time bucket.
*/
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.
*/
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.
*/
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.
*/
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.
*/
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.
*/
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.
*/
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.
*/
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.
*/
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;
}
namespace OrganizationCostsResult {
/**
* The monetary value in its associated currency.
*/
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 declare namespace UsageAudioTranscriptionsResponse {
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;
}
namespace Data {
/**
* The aggregated completions usage details of the specific time bucket.
*/
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.
*/
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.
*/
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.
*/
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.
*/
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.
*/
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.
*/
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.
*/
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.
*/
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;
}
namespace OrganizationCostsResult {
/**
* The monetary value in its associated currency.
*/
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 declare namespace UsageCodeInterpreterSessionsResponse {
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;
}
namespace Data {
/**
* The aggregated completions usage details of the specific time bucket.
*/
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.
*/
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.
*/
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.
*/
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.
*/
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.
*/
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.
*/
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.
*/
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.
*/
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;
}
namespace OrganizationCostsResult {
/**
* The monetary value in its associated currency.
*/
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 declare namespace UsageCompletionsResponse {
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;
}
namespace Data {
/**
* The aggregated completions usage details of the specific time bucket.
*/
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.
*/
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.
*/
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.
*/
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.
*/
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 provi