openai
Version:
The official TypeScript library for the OpenAI API
224 lines • 6.69 kB
JavaScript
// File generated from our OpenAPI spec by Castiron. See CONTRIBUTING.md for details.
import { APIResource } from "../../../core/resource.mjs";
function resolveResourceRequestOptions(options, buildOptions) {
return Promise.resolve(options).then(buildOptions);
}
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, options) {
return this._client.get('/organization/usage/audio_speeches', resolveResourceRequestOptions(options, (options) => ({
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, options) {
return this._client.get('/organization/usage/audio_transcriptions', resolveResourceRequestOptions(options, (options) => ({
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, options) {
return this._client.get('/organization/usage/code_interpreter_sessions', resolveResourceRequestOptions(options, (options) => ({
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, options) {
return this._client.get('/organization/usage/completions', resolveResourceRequestOptions(options, (options) => ({
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, options) {
return this._client.get('/organization/costs', resolveResourceRequestOptions(options, (options) => ({
query,
...options,
__security: { adminAPIKeyAuth: true },
})));
}
/**
* Get Decisions API usage details for the organization.
*
* @example
* ```ts
* const response =
* await client.admin.organization.usage.decisions({
* start_time: 0,
* });
* ```
*/
decisions(query, options) {
return this._client.get('/organization/usage/decisions', resolveResourceRequestOptions(options, (options) => ({
query: Object.fromEntries(Object.entries(query).filter(([, value]) => value !== null)),
...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, options) {
return this._client.get('/organization/usage/embeddings', resolveResourceRequestOptions(options, (options) => ({
query,
...options,
__security: { adminAPIKeyAuth: true },
})));
}
/**
* Get file search calls usage details for the organization.
*
* @example
* ```ts
* const response =
* await client.admin.organization.usage.fileSearchCalls({
* start_time: 0,
* });
* ```
*/
fileSearchCalls(query, options) {
return this._client.get('/organization/usage/file_search_calls', resolveResourceRequestOptions(options, (options) => ({
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, options) {
return this._client.get('/organization/usage/images', resolveResourceRequestOptions(options, (options) => ({
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, options) {
return this._client.get('/organization/usage/moderations', resolveResourceRequestOptions(options, (options) => ({
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, options) {
return this._client.get('/organization/usage/vector_stores', resolveResourceRequestOptions(options, (options) => ({
query,
...options,
__security: { adminAPIKeyAuth: true },
})));
}
/**
* Get web search calls usage details for the organization.
*
* @example
* ```ts
* const response =
* await client.admin.organization.usage.webSearchCalls({
* start_time: 0,
* });
* ```
*/
webSearchCalls(query, options) {
return this._client.get('/organization/usage/web_search_calls', resolveResourceRequestOptions(options, (options) => ({
query,
...options,
__security: { adminAPIKeyAuth: true },
})));
}
}
//# sourceMappingURL=usage.mjs.map