View Source OpenAi.Usage (OpenAI REST API Client v1.0.0)
Provides API endpoints related to usage
Summary
Functions
Get audio speeches usage details for the organization.
Get audio transcriptions usage details for the organization.
Get code interpreter sessions usage details for the organization.
Get completions usage details for the organization.
Get costs details for the organization.
Get embeddings usage details for the organization.
Get images usage details for the organization.
Get moderations usage details for the organization.
Get vector stores usage details for the organization.
Functions
@spec usage_audio_speeches(opts :: keyword()) :: {:ok, OpenAi.Usage.Response.t()} | {:error, OpenAi.Error.error()}
Get audio speeches usage details for the organization.
Options
start_time: Start time (Unix seconds) of the query time range, inclusive.end_time: End time (Unix seconds) of the query time range, exclusive.bucket_width: Width of each time bucket in response. Currently1m,1hand1dare supported, default to1d.project_ids: Return only usage for these projects.user_ids: Return only usage for these users.api_key_ids: Return only usage for these API keys.models: Return only usage for these models.group_by: Group the usage data by the specified fields. Support fields includeproject_id,user_id,api_key_id,modelor any combination of them.limit: 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
page: A cursor for use in pagination. Corresponding to thenext_pagefield from the previous response.
@spec usage_audio_transcriptions(opts :: keyword()) :: {:ok, OpenAi.Usage.Response.t()} | {:error, OpenAi.Error.error()}
Get audio transcriptions usage details for the organization.
Options
start_time: Start time (Unix seconds) of the query time range, inclusive.end_time: End time (Unix seconds) of the query time range, exclusive.bucket_width: Width of each time bucket in response. Currently1m,1hand1dare supported, default to1d.project_ids: Return only usage for these projects.user_ids: Return only usage for these users.api_key_ids: Return only usage for these API keys.models: Return only usage for these models.group_by: Group the usage data by the specified fields. Support fields includeproject_id,user_id,api_key_id,modelor any combination of them.limit: 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
page: A cursor for use in pagination. Corresponding to thenext_pagefield from the previous response.
@spec usage_code_interpreter_sessions(opts :: keyword()) :: {:ok, OpenAi.Usage.Response.t()} | {:error, OpenAi.Error.error()}
Get code interpreter sessions usage details for the organization.
Options
start_time: Start time (Unix seconds) of the query time range, inclusive.end_time: End time (Unix seconds) of the query time range, exclusive.bucket_width: Width of each time bucket in response. Currently1m,1hand1dare supported, default to1d.project_ids: Return only usage for these projects.group_by: Group the usage data by the specified fields. Support fields includeproject_id.limit: 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
page: A cursor for use in pagination. Corresponding to thenext_pagefield from the previous response.
@spec usage_completions(opts :: keyword()) :: {:ok, OpenAi.Usage.Response.t()} | {:error, OpenAi.Error.error()}
Get completions usage details for the organization.
Options
start_time: Start time (Unix seconds) of the query time range, inclusive.end_time: End time (Unix seconds) of the query time range, exclusive.bucket_width: Width of each time bucket in response. Currently1m,1hand1dare supported, default to1d.project_ids: Return only usage for these projects.user_ids: Return only usage for these users.api_key_ids: Return only usage for these API keys.models: Return only usage for these models.batch: Iftrue, return batch jobs only. Iffalse, return non-batch jobs only. By default, return both.group_by: Group the usage data by the specified fields. Support fields includeproject_id,user_id,api_key_id,model,batchor any combination of them.limit: 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
page: A cursor for use in pagination. Corresponding to thenext_pagefield from the previous response.
@spec usage_costs(opts :: keyword()) :: {:ok, OpenAi.Usage.Response.t()} | {:error, OpenAi.Error.error()}
Get costs details for the organization.
Options
start_time: Start time (Unix seconds) of the query time range, inclusive.end_time: End time (Unix seconds) of the query time range, exclusive.bucket_width: Width of each time bucket in response. Currently only1dis supported, default to1d.project_ids: Return only costs for these projects.group_by: Group the costs by the specified fields. Support fields includeproject_id,line_itemand any combination of them.limit: A limit on the number of buckets to be returned. Limit can range between 1 and 180, and the default is 7.page: A cursor for use in pagination. Corresponding to thenext_pagefield from the previous response.
@spec usage_embeddings(opts :: keyword()) :: {:ok, OpenAi.Usage.Response.t()} | {:error, OpenAi.Error.error()}
Get embeddings usage details for the organization.
Options
start_time: Start time (Unix seconds) of the query time range, inclusive.end_time: End time (Unix seconds) of the query time range, exclusive.bucket_width: Width of each time bucket in response. Currently1m,1hand1dare supported, default to1d.project_ids: Return only usage for these projects.user_ids: Return only usage for these users.api_key_ids: Return only usage for these API keys.models: Return only usage for these models.group_by: Group the usage data by the specified fields. Support fields includeproject_id,user_id,api_key_id,modelor any combination of them.limit: 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
page: A cursor for use in pagination. Corresponding to thenext_pagefield from the previous response.
@spec usage_images(opts :: keyword()) :: {:ok, OpenAi.Usage.Response.t()} | {:error, OpenAi.Error.error()}
Get images usage details for the organization.
Options
start_time: Start time (Unix seconds) of the query time range, inclusive.end_time: End time (Unix seconds) of the query time range, exclusive.bucket_width: Width of each time bucket in response. Currently1m,1hand1dare supported, default to1d.sources: Return only usages for these sources. Possible values areimage.generation,image.edit,image.variationor any combination of them.sizes: Return only usages for these image sizes. Possible values are256x256,512x512,1024x1024,1792x1792,1024x1792or any combination of them.project_ids: Return only usage for these projects.user_ids: Return only usage for these users.api_key_ids: Return only usage for these API keys.models: Return only usage for these models.group_by: Group the usage data by the specified fields. Support fields includeproject_id,user_id,api_key_id,model,size,sourceor any combination of them.limit: 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
page: A cursor for use in pagination. Corresponding to thenext_pagefield from the previous response.
@spec usage_moderations(opts :: keyword()) :: {:ok, OpenAi.Usage.Response.t()} | {:error, OpenAi.Error.error()}
Get moderations usage details for the organization.
Options
start_time: Start time (Unix seconds) of the query time range, inclusive.end_time: End time (Unix seconds) of the query time range, exclusive.bucket_width: Width of each time bucket in response. Currently1m,1hand1dare supported, default to1d.project_ids: Return only usage for these projects.user_ids: Return only usage for these users.api_key_ids: Return only usage for these API keys.models: Return only usage for these models.group_by: Group the usage data by the specified fields. Support fields includeproject_id,user_id,api_key_id,modelor any combination of them.limit: 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
page: A cursor for use in pagination. Corresponding to thenext_pagefield from the previous response.
@spec usage_vector_stores(opts :: keyword()) :: {:ok, OpenAi.Usage.Response.t()} | {:error, OpenAi.Error.error()}
Get vector stores usage details for the organization.
Options
start_time: Start time (Unix seconds) of the query time range, inclusive.end_time: End time (Unix seconds) of the query time range, exclusive.bucket_width: Width of each time bucket in response. Currently1m,1hand1dare supported, default to1d.project_ids: Return only usage for these projects.group_by: Group the usage data by the specified fields. Support fields includeproject_id.limit: 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
page: A cursor for use in pagination. Corresponding to thenext_pagefield from the previous response.