Admin
Organization
Audit Logs
List audit logs
admin.organization.audit_logs.list(**kwargs) -> ConversationCursorPage<AuditLogListResponse>
get /organization/audit_logs
List user actions and configuration changes within this organization.
Parameters
-
actor_emails: Array[String]Return only events performed by users with these emails.
-
actor_ids: Array[String]Return only events performed by these actors. Can be a user ID, a service account ID, or an api key tracking ID.
-
after: StringA cursor for use in pagination.
afteris an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. -
before: StringA cursor for use in pagination.
beforeis an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. -
effective_at: EffectiveAt{ gt, gte, lt, lte}Return only events whose
effective_at(Unix seconds) is in this range.-
gt: IntegerReturn only events whose
effective_at(Unix seconds) is greater than this value. -
gte: IntegerReturn only events whose
effective_at(Unix seconds) is greater than or equal to this value. -
lt: IntegerReturn only events whose
effective_at(Unix seconds) is less than this value. -
lte: IntegerReturn only events whose
effective_at(Unix seconds) is less than or equal to this value.
-
-
event_types: Array[:"api_key.created" | :"api_key.updated" | :"api_key.deleted" | 54 more]Return only events with a
typein one of these values. For example,project.created. For all options, see the documentation for the audit log object.-
:"api_key.created" -
:"api_key.updated" -
:"api_key.deleted" -
:"certificate.created" -
:"certificate.updated" -
:"certificate.deleted" -
:"certificates.activated" -
:"certificates.deactivated" -
:"checkpoint.permission.created" -
:"checkpoint.permission.deleted" -
:"external_key.registered" -
:"external_key.removed" -
:"group.created" -
:"group.updated" -
:"group.deleted" -
:"invite.sent" -
:"invite.accepted" -
:"invite.deleted" -
:"ip_allowlist.created" -
:"ip_allowlist.updated" -
:"ip_allowlist.deleted" -
:"ip_allowlist.config.activated" -
:"ip_allowlist.config.deactivated" -
:"login.succeeded" -
:"login.failed" -
:"logout.succeeded" -
:"logout.failed" -
:"organization.updated" -
:"project.created" -
:"project.updated" -
:"project.archived" -
:"project.deleted" -
:"rate_limit.updated" -
:"rate_limit.deleted" -
:"resource.deleted" -
:"tunnel.created" -
:"tunnel.updated" -
:"tunnel.deleted" -
:"workload_identity_provider.created" -
:"workload_identity_provider.updated" -
:"workload_identity_provider.deleted" -
:"workload_identity_provider_mapping.created" -
:"workload_identity_provider_mapping.updated" -
:"workload_identity_provider_mapping.deleted" -
:"role.created" -
:"role.updated" -
:"role.deleted" -
:"role.assignment.created" -
:"role.assignment.deleted" -
:"scim.enabled" -
:"scim.disabled" -
:"service_account.created" -
:"service_account.updated" -
:"service_account.deleted" -
:"user.added" -
:"user.updated" -
:"user.deleted"
-
-
limit: IntegerA limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
-
project_ids: Array[String]Return only events for these projects.
-
resource_ids: Array[String]Return only events performed on these targets. For example, a project ID updated.
Returns
-
class AuditLogListResponseA log of a user action or configuration change within this organization.
-
id: StringThe ID of this log.
-
effective_at: IntegerThe Unix timestamp (in seconds) of the event.
-
type: :"api_key.created" | :"api_key.updated" | :"api_key.deleted" | 54 moreThe event type.
-
:"api_key.created" -
:"api_key.updated" -
:"api_key.deleted" -
:"certificate.created" -
:"certificate.updated" -
:"certificate.deleted" -
:"certificates.activated" -
:"certificates.deactivated" -
:"checkpoint.permission.created" -
:"checkpoint.permission.deleted" -
:"external_key.registered" -
:"external_key.removed" -
:"group.created" -
:"group.updated" -
:"group.deleted" -
:"invite.sent" -
:"invite.accepted" -
:"invite.deleted" -
:"ip_allowlist.created" -
:"ip_allowlist.updated" -
:"ip_allowlist.deleted" -
:"ip_allowlist.config.activated" -
:"ip_allowlist.config.deactivated" -
:"login.succeeded" -
:"login.failed" -
:"logout.succeeded" -
:"logout.failed" -
:"organization.updated" -
:"project.created" -
:"project.updated" -
:"project.archived" -
:"project.deleted" -
:"rate_limit.updated" -
:"rate_limit.deleted" -
:"resource.deleted" -
:"tunnel.created" -
:"tunnel.updated" -
:"tunnel.deleted" -
:"workload_identity_provider.created" -
:"workload_identity_provider.updated" -
:"workload_identity_provider.deleted" -
:"workload_identity_provider_mapping.created" -
:"workload_identity_provider_mapping.updated" -
:"workload_identity_provider_mapping.deleted" -
:"role.created" -
:"role.updated" -
:"role.deleted" -
:"role.assignment.created" -
:"role.assignment.deleted" -
:"scim.enabled" -
:"scim.disabled" -
:"service_account.created" -
:"service_account.updated" -
:"service_account.deleted" -
:"user.added" -
:"user.updated" -
:"user.deleted"
-
-
actor: Actor{ api_key, session, type}The actor who performed the audit logged action.
-
api_key: APIKey{ id, service_account, type, user}The API Key used to perform the audit logged action.
-
id: StringThe tracking id of the API key.
-
service_account: ServiceAccount{ id}The service account that performed the audit logged action.
-
id: StringThe service account id.
-
-
type: :user | :service_accountThe type of API key. Can be either
userorservice_account.-
:user -
:service_account
-
-
user: User{ id, email}The user who performed the audit logged action.
-
id: StringThe user id.
-
email: StringThe user email.
-
-
-
session: Session{ ip_address, user}The session in which the audit logged action was performed.
-
ip_address: StringThe IP address from which the action was performed.
-
user: User{ id, email}The user who performed the audit logged action.
-
id: StringThe user id.
-
email: StringThe user email.
-
-
-
type: :session | :api_keyThe type of actor. Is either
sessionorapi_key.-
:session -
:api_key
-
-
-
api_key_created: APIKeyCreated{ id, data}The details for events with this
type.-
id: StringThe tracking ID of the API key.
-
data: Data{ scopes}The payload used to create the API key.
-
scopes: Array[String]A list of scopes allowed for the API key, e.g.
["api.model.request"]
-
-
-
api_key_deleted: APIKeyDeleted{ id}The details for events with this
type.-
id: StringThe tracking ID of the API key.
-
-
api_key_updated: APIKeyUpdated{ id, changes_requested}The details for events with this
type.-
id: StringThe tracking ID of the API key.
-
changes_requested: ChangesRequested{ scopes}The payload used to update the API key.
-
scopes: Array[String]A list of scopes allowed for the API key, e.g.
["api.model.request"]
-
-
-
certificate_created: CertificateCreated{ id, name}The details for events with this
type.-
id: StringThe certificate ID.
-
name: StringThe name of the certificate.
-
-
certificate_deleted: CertificateDeleted{ id, certificate, name}The details for events with this
type.-
id: StringThe certificate ID.
-
certificate: StringThe certificate content in PEM format.
-
name: StringThe name of the certificate.
-
-
certificate_updated: CertificateUpdated{ id, name}The details for events with this
type.-
id: StringThe certificate ID.
-
name: StringThe name of the certificate.
-
-
certificates_activated: CertificatesActivated{ certificates}The details for events with this
type.-
certificates: Array[Certificate{ id, name}]-
id: StringThe certificate ID.
-
name: StringThe name of the certificate.
-
-
-
certificates_deactivated: CertificatesDeactivated{ certificates}The details for events with this
type.-
certificates: Array[Certificate{ id, name}]-
id: StringThe certificate ID.
-
name: StringThe name of the certificate.
-
-
-
checkpoint_permission_created: CheckpointPermissionCreated{ id, data}The project and fine-tuned model checkpoint that the checkpoint permission was created for.
-
id: StringThe ID of the checkpoint permission.
-
data: Data{ fine_tuned_model_checkpoint, project_id}The payload used to create the checkpoint permission.
-
fine_tuned_model_checkpoint: StringThe ID of the fine-tuned model checkpoint.
-
project_id: StringThe ID of the project that the checkpoint permission was created for.
-
-
-
checkpoint_permission_deleted: CheckpointPermissionDeleted{ id}The details for events with this
type.-
id: StringThe ID of the checkpoint permission.
-
-
external_key_registered: ExternalKeyRegistered{ id, data}The details for events with this
type.-
id: StringThe ID of the external key configuration.
-
data: untypedThe configuration for the external key.
-
-
external_key_removed: ExternalKeyRemoved{ id}The details for events with this
type.-
id: StringThe ID of the external key configuration.
-
-
group_created: GroupCreated{ id, data}The details for events with this
type.-
id: StringThe ID of the group.
-
data: Data{ group_name}Information about the created group.
-
group_name: StringThe group name.
-
-
-
group_deleted: GroupDeleted{ id}The details for events with this
type.-
id: StringThe ID of the group.
-
-
group_updated: GroupUpdated{ id, changes_requested}The details for events with this
type.-
id: StringThe ID of the group.
-
changes_requested: ChangesRequested{ group_name}The payload used to update the group.
-
group_name: StringThe updated group name.
-
-
-
invite_accepted: InviteAccepted{ id}The details for events with this
type.-
id: StringThe ID of the invite.
-
-
invite_deleted: InviteDeleted{ id}The details for events with this
type.-
id: StringThe ID of the invite.
-
-
invite_sent: InviteSent{ id, data}The details for events with this
type.-
id: StringThe ID of the invite.
-
data: Data{ email, role}The payload used to create the invite.
-
email: StringThe email invited to the organization.
-
role: StringThe role the email was invited to be. Is either
ownerormember.
-
-
-
ip_allowlist_config_activated: IPAllowlistConfigActivated{ configs}The details for events with this
type.-
configs: Array[Config{ id, name}]The configurations that were activated.
-
id: StringThe ID of the IP allowlist configuration.
-
name: StringThe name of the IP allowlist configuration.
-
-
-
ip_allowlist_config_deactivated: IPAllowlistConfigDeactivated{ configs}The details for events with this
type.-
configs: Array[Config{ id, name}]The configurations that were deactivated.
-
id: StringThe ID of the IP allowlist configuration.
-
name: StringThe name of the IP allowlist configuration.
-
-
-
ip_allowlist_created: IPAllowlistCreated{ id, allowed_ips, name}The details for events with this
type.-
id: StringThe ID of the IP allowlist configuration.
-
allowed_ips: Array[String]The IP addresses or CIDR ranges included in the configuration.
-
name: StringThe name of the IP allowlist configuration.
-
-
ip_allowlist_deleted: IPAllowlistDeleted{ id, allowed_ips, name}The details for events with this
type.-
id: StringThe ID of the IP allowlist configuration.
-
allowed_ips: Array[String]The IP addresses or CIDR ranges that were in the configuration.
-
name: StringThe name of the IP allowlist configuration.
-
-
ip_allowlist_updated: IPAllowlistUpdated{ id, allowed_ips}The details for events with this
type.-
id: StringThe ID of the IP allowlist configuration.
-
allowed_ips: Array[String]The updated set of IP addresses or CIDR ranges in the configuration.
-
-
login_failed: LoginFailed{ error_code, error_message}The details for events with this
type.-
error_code: StringThe error code of the failure.
-
error_message: StringThe error message of the failure.
-
-
login_succeeded: untypedThis event has no additional fields beyond the standard audit log attributes.
-
logout_failed: LogoutFailed{ error_code, error_message}The details for events with this
type.-
error_code: StringThe error code of the failure.
-
error_message: StringThe error message of the failure.
-
-
logout_succeeded: untypedThis event has no additional fields beyond the standard audit log attributes.
-
organization_updated: OrganizationUpdated{ id, changes_requested}The details for events with this
type.-
id: StringThe organization ID.
-
changes_requested: ChangesRequested{ api_call_logging, api_call_logging_project_ids, description, 4 more}The payload used to update the organization settings.
-
api_call_logging: StringHow your organization logs data from supported API calls. One of
disabled,enabled_per_call,enabled_for_all_projects, orenabled_for_selected_projects -
api_call_logging_project_ids: StringThe list of project ids if api_call_logging is set to
enabled_for_selected_projects -
description: StringThe organization description.
-
name: StringThe organization name.
-
threads_ui_visibility: StringVisibility of the threads page which shows messages created with the Assistants API and Playground. One of
ANY_ROLE,OWNERS, orNONE. -
title: StringThe organization title.
-
usage_dashboard_visibility: StringVisibility of the usage dashboard which shows activity and costs for your organization. One of
ANY_ROLEorOWNERS.
-
-
-
project: Project{ id, name}The project that the action was scoped to. Absent for actions not scoped to projects. Note that any admin actions taken via Admin API keys are associated with the default project.
-
id: StringThe project ID.
-
name: StringThe project title.
-
-
project_archived: ProjectArchived{ id}The details for events with this
type.-
id: StringThe project ID.
-
-
project_created: ProjectCreated{ id, data}The details for events with this
type.-
id: StringThe project ID.
-
data: Data{ name, title}The payload used to create the project.
-
name: StringThe project name.
-
title: StringThe title of the project as seen on the dashboard.
-
-
-
project_deleted: ProjectDeleted{ id}The details for events with this
type.-
id: StringThe project ID.
-
-
project_updated: ProjectUpdated{ id, changes_requested}The details for events with this
type.-
id: StringThe project ID.
-
changes_requested: ChangesRequested{ title}The payload used to update the project.
-
title: StringThe title of the project as seen on the dashboard.
-
-
-
rate_limit_deleted: RateLimitDeleted{ id}The details for events with this
type.-
id: StringThe rate limit ID
-
-
rate_limit_updated: RateLimitUpdated{ id, changes_requested}The details for events with this
type.-
id: StringThe rate limit ID
-
changes_requested: ChangesRequested{ batch_1_day_max_input_tokens, max_audio_megabytes_per_1_minute, max_images_per_1_minute, 3 more}The payload used to update the rate limits.
-
batch_1_day_max_input_tokens: IntegerThe maximum batch input tokens per day. Only relevant for certain models.
-
max_audio_megabytes_per_1_minute: IntegerThe maximum audio megabytes per minute. Only relevant for certain models.
-
max_images_per_1_minute: IntegerThe maximum images per minute. Only relevant for certain models.
-
max_requests_per_1_day: IntegerThe maximum requests per day. Only relevant for certain models.
-
max_requests_per_1_minute: IntegerThe maximum requests per minute.
-
max_tokens_per_1_minute: IntegerThe maximum tokens per minute.
-
-
-
role_assignment_created: RoleAssignmentCreated{ id, principal_id, principal_type, 2 more}The details for events with this
type.-
id: StringThe identifier of the role assignment.
-
principal_id: StringThe principal (user or group) that received the role.
-
principal_type: StringThe type of principal (user or group) that received the role.
-
resource_id: StringThe resource the role assignment is scoped to.
-
resource_type: StringThe type of resource the role assignment is scoped to.
-
-
role_assignment_deleted: RoleAssignmentDeleted{ id, principal_id, principal_type, 2 more}The details for events with this
type.-
id: StringThe identifier of the role assignment.
-
principal_id: StringThe principal (user or group) that had the role removed.
-
principal_type: StringThe type of principal (user or group) that had the role removed.
-
resource_id: StringThe resource the role assignment was scoped to.
-
resource_type: StringThe type of resource the role assignment was scoped to.
-
-
role_created: RoleCreated{ id, permissions, resource_id, 2 more}The details for events with this
type.-
id: StringThe role ID.
-
permissions: Array[String]The permissions granted by the role.
-
resource_id: StringThe resource the role is scoped to.
-
resource_type: StringThe type of resource the role belongs to.
-
role_name: StringThe name of the role.
-
-
role_deleted: RoleDeleted{ id}The details for events with this
type.-
id: StringThe role ID.
-
-
role_updated: RoleUpdated{ id, changes_requested}The details for events with this
type.-
id: StringThe role ID.
-
changes_requested: ChangesRequested{ description, metadata, permissions_added, 4 more}The payload used to update the role.
-
description: StringThe updated role description, when provided.
-
metadata: untypedAdditional metadata stored on the role.
-
permissions_added: Array[String]The permissions added to the role.
-
permissions_removed: Array[String]The permissions removed from the role.
-
resource_id: StringThe resource the role is scoped to.
-
resource_type: StringThe type of resource the role belongs to.
-
role_name: StringThe updated role name, when provided.
-
-
-
scim_disabled: ScimDisabled{ id}The details for events with this
type.-
id: StringThe ID of the SCIM was disabled for.
-
-
scim_enabled: ScimEnabled{ id}The details for events with this
type.-
id: StringThe ID of the SCIM was enabled for.
-
-
service_account_created: ServiceAccountCreated{ id, data}The details for events with this
type.-
id: StringThe service account ID.
-
data: Data{ role}The payload used to create the service account.
-
role: StringThe role of the service account. Is either
ownerormember.
-
-
-
service_account_deleted: ServiceAccountDeleted{ id}The details for events with this
type.-
id: StringThe service account ID.
-
-
service_account_updated: ServiceAccountUpdated{ id, changes_requested}The details for events with this
type.-
id: StringThe service account ID.
-
changes_requested: ChangesRequested{ role}The payload used to updated the service account.
-
role: StringThe role of the service account. Is either
ownerormember.
-
-
-
user_added: UserAdded{ id, data}The details for events with this
type.-
id: StringThe user ID.
-
data: Data{ role}The payload used to add the user to the project.
-
role: StringThe role of the user. Is either
ownerormember.
-
-
-
user_deleted: UserDeleted{ id}The details for events with this
type.-
id: StringThe user ID.
-
-
user_updated: UserUpdated{ id, changes_requested}The details for events with this
type.-
id: StringThe project ID.
-
changes_requested: ChangesRequested{ role}The payload used to update the user.
-
role: StringThe role of the user. Is either
ownerormember.
-
-
-
workload_identity_provider_mapping_created: WorkloadIdentityProviderMappingCreated{ id, data, identity_provider_id}The details for events with this
type.-
id: StringThe workload identity provider mapping ID.
-
data: untypedThe payload used to create the workload identity provider mapping.
-
identity_provider_id: StringThe workload identity provider ID.
-
-
workload_identity_provider_mapping_deleted: WorkloadIdentityProviderMappingDeleted{ id, identity_provider_id, project_id, service_account_id}The details for events with this
type.-
id: StringThe workload identity provider mapping ID.
-
identity_provider_id: StringThe workload identity provider ID.
-
project_id: StringThe project ID.
-
service_account_id: StringThe mapped service account ID.
-
-
workload_identity_provider_mapping_updated: WorkloadIdentityProviderMappingUpdated{ id, changes_requested, identity_provider_id}The details for events with this
type.-
id: StringThe workload identity provider mapping ID.
-
changes_requested: untypedThe payload used to update the workload identity provider mapping.
-
identity_provider_id: StringThe workload identity provider ID.
-
-
workload_identity_provider_created: WorkloadIdentityProviderCreated{ id, data}The details for events with this
type.-
id: StringThe workload identity provider ID.
-
data: untypedThe payload used to create the workload identity provider.
-
-
workload_identity_provider_deleted: WorkloadIdentityProviderDeleted{ id, name}The details for events with this
type.-
id: StringThe workload identity provider ID.
-
name: StringThe workload identity provider name.
-
-
workload_identity_provider_updated: WorkloadIdentityProviderUpdated{ id, changes_requested}The details for events with this
type.-
id: StringThe workload identity provider ID.
-
changes_requested: untypedThe payload used to update the workload identity provider.
-
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
page = openai.admin.organization.audit_logs.list
puts(page)
Response
{
"data": [
{
"id": "id",
"effective_at": 0,
"type": "api_key.created",
"actor": {
"api_key": {
"id": "id",
"service_account": {
"id": "id"
},
"type": "user",
"user": {
"id": "id",
"email": "email"
}
},
"session": {
"ip_address": "ip_address",
"user": {
"id": "id",
"email": "email"
}
},
"type": "session"
},
"api_key.created": {
"id": "id",
"data": {
"scopes": [
"string"
]
}
},
"api_key.deleted": {
"id": "id"
},
"api_key.updated": {
"id": "id",
"changes_requested": {
"scopes": [
"string"
]
}
},
"certificate.created": {
"id": "id",
"name": "name"
},
"certificate.deleted": {
"id": "id",
"certificate": "certificate",
"name": "name"
},
"certificate.updated": {
"id": "id",
"name": "name"
},
"certificates.activated": {
"certificates": [
{
"id": "id",
"name": "name"
}
]
},
"certificates.deactivated": {
"certificates": [
{
"id": "id",
"name": "name"
}
]
},
"checkpoint.permission.created": {
"id": "id",
"data": {
"fine_tuned_model_checkpoint": "fine_tuned_model_checkpoint",
"project_id": "project_id"
}
},
"checkpoint.permission.deleted": {
"id": "id"
},
"external_key.registered": {
"id": "id",
"data": {}
},
"external_key.removed": {
"id": "id"
},
"group.created": {
"id": "id",
"data": {
"group_name": "group_name"
}
},
"group.deleted": {
"id": "id"
},
"group.updated": {
"id": "id",
"changes_requested": {
"group_name": "group_name"
}
},
"invite.accepted": {
"id": "id"
},
"invite.deleted": {
"id": "id"
},
"invite.sent": {
"id": "id",
"data": {
"email": "email",
"role": "role"
}
},
"ip_allowlist.config.activated": {
"configs": [
{
"id": "id",
"name": "name"
}
]
},
"ip_allowlist.config.deactivated": {
"configs": [
{
"id": "id",
"name": "name"
}
]
},
"ip_allowlist.created": {
"id": "id",
"allowed_ips": [
"string"
],
"name": "name"
},
"ip_allowlist.deleted": {
"id": "id",
"allowed_ips": [
"string"
],
"name": "name"
},
"ip_allowlist.updated": {
"id": "id",
"allowed_ips": [
"string"
]
},
"login.failed": {
"error_code": "error_code",
"error_message": "error_message"
},
"login.succeeded": {},
"logout.failed": {
"error_code": "error_code",
"error_message": "error_message"
},
"logout.succeeded": {},
"organization.updated": {
"id": "id",
"changes_requested": {
"api_call_logging": "api_call_logging",
"api_call_logging_project_ids": "api_call_logging_project_ids",
"description": "description",
"name": "name",
"threads_ui_visibility": "threads_ui_visibility",
"title": "title",
"usage_dashboard_visibility": "usage_dashboard_visibility"
}
},
"project": {
"id": "id",
"name": "name"
},
"project.archived": {
"id": "id"
},
"project.created": {
"id": "id",
"data": {
"name": "name",
"title": "title"
}
},
"project.deleted": {
"id": "id"
},
"project.updated": {
"id": "id",
"changes_requested": {
"title": "title"
}
},
"rate_limit.deleted": {
"id": "id"
},
"rate_limit.updated": {
"id": "id",
"changes_requested": {
"batch_1_day_max_input_tokens": 0,
"max_audio_megabytes_per_1_minute": 0,
"max_images_per_1_minute": 0,
"max_requests_per_1_day": 0,
"max_requests_per_1_minute": 0,
"max_tokens_per_1_minute": 0
}
},
"role.assignment.created": {
"id": "id",
"principal_id": "principal_id",
"principal_type": "principal_type",
"resource_id": "resource_id",
"resource_type": "resource_type"
},
"role.assignment.deleted": {
"id": "id",
"principal_id": "principal_id",
"principal_type": "principal_type",
"resource_id": "resource_id",
"resource_type": "resource_type"
},
"role.created": {
"id": "id",
"permissions": [
"string"
],
"resource_id": "resource_id",
"resource_type": "resource_type",
"role_name": "role_name"
},
"role.deleted": {
"id": "id"
},
"role.updated": {
"id": "id",
"changes_requested": {
"description": "description",
"metadata": {},
"permissions_added": [
"string"
],
"permissions_removed": [
"string"
],
"resource_id": "resource_id",
"resource_type": "resource_type",
"role_name": "role_name"
}
},
"scim.disabled": {
"id": "id"
},
"scim.enabled": {
"id": "id"
},
"service_account.created": {
"id": "id",
"data": {
"role": "role"
}
},
"service_account.deleted": {
"id": "id"
},
"service_account.updated": {
"id": "id",
"changes_requested": {
"role": "role"
}
},
"user.added": {
"id": "id",
"data": {
"role": "role"
}
},
"user.deleted": {
"id": "id"
},
"user.updated": {
"id": "id",
"changes_requested": {
"role": "role"
}
},
"workload_identity_provider_mapping.created": {
"id": "id",
"data": {},
"identity_provider_id": "identity_provider_id"
},
"workload_identity_provider_mapping.deleted": {
"id": "id",
"identity_provider_id": "identity_provider_id",
"project_id": "project_id",
"service_account_id": "service_account_id"
},
"workload_identity_provider_mapping.updated": {
"id": "id",
"changes_requested": {},
"identity_provider_id": "identity_provider_id"
},
"workload_identity_provider.created": {
"id": "id",
"data": {}
},
"workload_identity_provider.deleted": {
"id": "id",
"name": "name"
},
"workload_identity_provider.updated": {
"id": "id",
"changes_requested": {}
}
}
],
"has_more": true,
"object": "list",
"first_id": "audit_log-defb456h8dks",
"last_id": "audit_log-hnbkd8s93s"
}
Domain Types
Audit Log List Response
-
class AuditLogListResponseA log of a user action or configuration change within this organization.
-
id: StringThe ID of this log.
-
effective_at: IntegerThe Unix timestamp (in seconds) of the event.
-
type: :"api_key.created" | :"api_key.updated" | :"api_key.deleted" | 54 moreThe event type.
-
:"api_key.created" -
:"api_key.updated" -
:"api_key.deleted" -
:"certificate.created" -
:"certificate.updated" -
:"certificate.deleted" -
:"certificates.activated" -
:"certificates.deactivated" -
:"checkpoint.permission.created" -
:"checkpoint.permission.deleted" -
:"external_key.registered" -
:"external_key.removed" -
:"group.created" -
:"group.updated" -
:"group.deleted" -
:"invite.sent" -
:"invite.accepted" -
:"invite.deleted" -
:"ip_allowlist.created" -
:"ip_allowlist.updated" -
:"ip_allowlist.deleted" -
:"ip_allowlist.config.activated" -
:"ip_allowlist.config.deactivated" -
:"login.succeeded" -
:"login.failed" -
:"logout.succeeded" -
:"logout.failed" -
:"organization.updated" -
:"project.created" -
:"project.updated" -
:"project.archived" -
:"project.deleted" -
:"rate_limit.updated" -
:"rate_limit.deleted" -
:"resource.deleted" -
:"tunnel.created" -
:"tunnel.updated" -
:"tunnel.deleted" -
:"workload_identity_provider.created" -
:"workload_identity_provider.updated" -
:"workload_identity_provider.deleted" -
:"workload_identity_provider_mapping.created" -
:"workload_identity_provider_mapping.updated" -
:"workload_identity_provider_mapping.deleted" -
:"role.created" -
:"role.updated" -
:"role.deleted" -
:"role.assignment.created" -
:"role.assignment.deleted" -
:"scim.enabled" -
:"scim.disabled" -
:"service_account.created" -
:"service_account.updated" -
:"service_account.deleted" -
:"user.added" -
:"user.updated" -
:"user.deleted"
-
-
actor: Actor{ api_key, session, type}The actor who performed the audit logged action.
-
api_key: APIKey{ id, service_account, type, user}The API Key used to perform the audit logged action.
-
id: StringThe tracking id of the API key.
-
service_account: ServiceAccount{ id}The service account that performed the audit logged action.
-
id: StringThe service account id.
-
-
type: :user | :service_accountThe type of API key. Can be either
userorservice_account.-
:user -
:service_account
-
-
user: User{ id, email}The user who performed the audit logged action.
-
id: StringThe user id.
-
email: StringThe user email.
-
-
-
session: Session{ ip_address, user}The session in which the audit logged action was performed.
-
ip_address: StringThe IP address from which the action was performed.
-
user: User{ id, email}The user who performed the audit logged action.
-
id: StringThe user id.
-
email: StringThe user email.
-
-
-
type: :session | :api_keyThe type of actor. Is either
sessionorapi_key.-
:session -
:api_key
-
-
-
api_key_created: APIKeyCreated{ id, data}The details for events with this
type.-
id: StringThe tracking ID of the API key.
-
data: Data{ scopes}The payload used to create the API key.
-
scopes: Array[String]A list of scopes allowed for the API key, e.g.
["api.model.request"]
-
-
-
api_key_deleted: APIKeyDeleted{ id}The details for events with this
type.-
id: StringThe tracking ID of the API key.
-
-
api_key_updated: APIKeyUpdated{ id, changes_requested}The details for events with this
type.-
id: StringThe tracking ID of the API key.
-
changes_requested: ChangesRequested{ scopes}The payload used to update the API key.
-
scopes: Array[String]A list of scopes allowed for the API key, e.g.
["api.model.request"]
-
-
-
certificate_created: CertificateCreated{ id, name}The details for events with this
type.-
id: StringThe certificate ID.
-
name: StringThe name of the certificate.
-
-
certificate_deleted: CertificateDeleted{ id, certificate, name}The details for events with this
type.-
id: StringThe certificate ID.
-
certificate: StringThe certificate content in PEM format.
-
name: StringThe name of the certificate.
-
-
certificate_updated: CertificateUpdated{ id, name}The details for events with this
type.-
id: StringThe certificate ID.
-
name: StringThe name of the certificate.
-
-
certificates_activated: CertificatesActivated{ certificates}The details for events with this
type.-
certificates: Array[Certificate{ id, name}]-
id: StringThe certificate ID.
-
name: StringThe name of the certificate.
-
-
-
certificates_deactivated: CertificatesDeactivated{ certificates}The details for events with this
type.-
certificates: Array[Certificate{ id, name}]-
id: StringThe certificate ID.
-
name: StringThe name of the certificate.
-
-
-
checkpoint_permission_created: CheckpointPermissionCreated{ id, data}The project and fine-tuned model checkpoint that the checkpoint permission was created for.
-
id: StringThe ID of the checkpoint permission.
-
data: Data{ fine_tuned_model_checkpoint, project_id}The payload used to create the checkpoint permission.
-
fine_tuned_model_checkpoint: StringThe ID of the fine-tuned model checkpoint.
-
project_id: StringThe ID of the project that the checkpoint permission was created for.
-
-
-
checkpoint_permission_deleted: CheckpointPermissionDeleted{ id}The details for events with this
type.-
id: StringThe ID of the checkpoint permission.
-
-
external_key_registered: ExternalKeyRegistered{ id, data}The details for events with this
type.-
id: StringThe ID of the external key configuration.
-
data: untypedThe configuration for the external key.
-
-
external_key_removed: ExternalKeyRemoved{ id}The details for events with this
type.-
id: StringThe ID of the external key configuration.
-
-
group_created: GroupCreated{ id, data}The details for events with this
type.-
id: StringThe ID of the group.
-
data: Data{ group_name}Information about the created group.
-
group_name: StringThe group name.
-
-
-
group_deleted: GroupDeleted{ id}The details for events with this
type.-
id: StringThe ID of the group.
-
-
group_updated: GroupUpdated{ id, changes_requested}The details for events with this
type.-
id: StringThe ID of the group.
-
changes_requested: ChangesRequested{ group_name}The payload used to update the group.
-
group_name: StringThe updated group name.
-
-
-
invite_accepted: InviteAccepted{ id}The details for events with this
type.-
id: StringThe ID of the invite.
-
-
invite_deleted: InviteDeleted{ id}The details for events with this
type.-
id: StringThe ID of the invite.
-
-
invite_sent: InviteSent{ id, data}The details for events with this
type.-
id: StringThe ID of the invite.
-
data: Data{ email, role}The payload used to create the invite.
-
email: StringThe email invited to the organization.
-
role: StringThe role the email was invited to be. Is either
ownerormember.
-
-
-
ip_allowlist_config_activated: IPAllowlistConfigActivated{ configs}The details for events with this
type.-
configs: Array[Config{ id, name}]The configurations that were activated.
-
id: StringThe ID of the IP allowlist configuration.
-
name: StringThe name of the IP allowlist configuration.
-
-
-
ip_allowlist_config_deactivated: IPAllowlistConfigDeactivated{ configs}The details for events with this
type.-
configs: Array[Config{ id, name}]The configurations that were deactivated.
-
id: StringThe ID of the IP allowlist configuration.
-
name: StringThe name of the IP allowlist configuration.
-
-
-
ip_allowlist_created: IPAllowlistCreated{ id, allowed_ips, name}The details for events with this
type.-
id: StringThe ID of the IP allowlist configuration.
-
allowed_ips: Array[String]The IP addresses or CIDR ranges included in the configuration.
-
name: StringThe name of the IP allowlist configuration.
-
-
ip_allowlist_deleted: IPAllowlistDeleted{ id, allowed_ips, name}The details for events with this
type.-
id: StringThe ID of the IP allowlist configuration.
-
allowed_ips: Array[String]The IP addresses or CIDR ranges that were in the configuration.
-
name: StringThe name of the IP allowlist configuration.
-
-
ip_allowlist_updated: IPAllowlistUpdated{ id, allowed_ips}The details for events with this
type.-
id: StringThe ID of the IP allowlist configuration.
-
allowed_ips: Array[String]The updated set of IP addresses or CIDR ranges in the configuration.
-
-
login_failed: LoginFailed{ error_code, error_message}The details for events with this
type.-
error_code: StringThe error code of the failure.
-
error_message: StringThe error message of the failure.
-
-
login_succeeded: untypedThis event has no additional fields beyond the standard audit log attributes.
-
logout_failed: LogoutFailed{ error_code, error_message}The details for events with this
type.-
error_code: StringThe error code of the failure.
-
error_message: StringThe error message of the failure.
-
-
logout_succeeded: untypedThis event has no additional fields beyond the standard audit log attributes.
-
organization_updated: OrganizationUpdated{ id, changes_requested}The details for events with this
type.-
id: StringThe organization ID.
-
changes_requested: ChangesRequested{ api_call_logging, api_call_logging_project_ids, description, 4 more}The payload used to update the organization settings.
-
api_call_logging: StringHow your organization logs data from supported API calls. One of
disabled,enabled_per_call,enabled_for_all_projects, orenabled_for_selected_projects -
api_call_logging_project_ids: StringThe list of project ids if api_call_logging is set to
enabled_for_selected_projects -
description: StringThe organization description.
-
name: StringThe organization name.
-
threads_ui_visibility: StringVisibility of the threads page which shows messages created with the Assistants API and Playground. One of
ANY_ROLE,OWNERS, orNONE. -
title: StringThe organization title.
-
usage_dashboard_visibility: StringVisibility of the usage dashboard which shows activity and costs for your organization. One of
ANY_ROLEorOWNERS.
-
-
-
project: Project{ id, name}The project that the action was scoped to. Absent for actions not scoped to projects. Note that any admin actions taken via Admin API keys are associated with the default project.
-
id: StringThe project ID.
-
name: StringThe project title.
-
-
project_archived: ProjectArchived{ id}The details for events with this
type.-
id: StringThe project ID.
-
-
project_created: ProjectCreated{ id, data}The details for events with this
type.-
id: StringThe project ID.
-
data: Data{ name, title}The payload used to create the project.
-
name: StringThe project name.
-
title: StringThe title of the project as seen on the dashboard.
-
-
-
project_deleted: ProjectDeleted{ id}The details for events with this
type.-
id: StringThe project ID.
-
-
project_updated: ProjectUpdated{ id, changes_requested}The details for events with this
type.-
id: StringThe project ID.
-
changes_requested: ChangesRequested{ title}The payload used to update the project.
-
title: StringThe title of the project as seen on the dashboard.
-
-
-
rate_limit_deleted: RateLimitDeleted{ id}The details for events with this
type.-
id: StringThe rate limit ID
-
-
rate_limit_updated: RateLimitUpdated{ id, changes_requested}The details for events with this
type.-
id: StringThe rate limit ID
-
changes_requested: ChangesRequested{ batch_1_day_max_input_tokens, max_audio_megabytes_per_1_minute, max_images_per_1_minute, 3 more}The payload used to update the rate limits.
-
batch_1_day_max_input_tokens: IntegerThe maximum batch input tokens per day. Only relevant for certain models.
-
max_audio_megabytes_per_1_minute: IntegerThe maximum audio megabytes per minute. Only relevant for certain models.
-
max_images_per_1_minute: IntegerThe maximum images per minute. Only relevant for certain models.
-
max_requests_per_1_day: IntegerThe maximum requests per day. Only relevant for certain models.
-
max_requests_per_1_minute: IntegerThe maximum requests per minute.
-
max_tokens_per_1_minute: IntegerThe maximum tokens per minute.
-
-
-
role_assignment_created: RoleAssignmentCreated{ id, principal_id, principal_type, 2 more}The details for events with this
type.-
id: StringThe identifier of the role assignment.
-
principal_id: StringThe principal (user or group) that received the role.
-
principal_type: StringThe type of principal (user or group) that received the role.
-
resource_id: StringThe resource the role assignment is scoped to.
-
resource_type: StringThe type of resource the role assignment is scoped to.
-
-
role_assignment_deleted: RoleAssignmentDeleted{ id, principal_id, principal_type, 2 more}The details for events with this
type.-
id: StringThe identifier of the role assignment.
-
principal_id: StringThe principal (user or group) that had the role removed.
-
principal_type: StringThe type of principal (user or group) that had the role removed.
-
resource_id: StringThe resource the role assignment was scoped to.
-
resource_type: StringThe type of resource the role assignment was scoped to.
-
-
role_created: RoleCreated{ id, permissions, resource_id, 2 more}The details for events with this
type.-
id: StringThe role ID.
-
permissions: Array[String]The permissions granted by the role.
-
resource_id: StringThe resource the role is scoped to.
-
resource_type: StringThe type of resource the role belongs to.
-
role_name: StringThe name of the role.
-
-
role_deleted: RoleDeleted{ id}The details for events with this
type.-
id: StringThe role ID.
-
-
role_updated: RoleUpdated{ id, changes_requested}The details for events with this
type.-
id: StringThe role ID.
-
changes_requested: ChangesRequested{ description, metadata, permissions_added, 4 more}The payload used to update the role.
-
description: StringThe updated role description, when provided.
-
metadata: untypedAdditional metadata stored on the role.
-
permissions_added: Array[String]The permissions added to the role.
-
permissions_removed: Array[String]The permissions removed from the role.
-
resource_id: StringThe resource the role is scoped to.
-
resource_type: StringThe type of resource the role belongs to.
-
role_name: StringThe updated role name, when provided.
-
-
-
scim_disabled: ScimDisabled{ id}The details for events with this
type.-
id: StringThe ID of the SCIM was disabled for.
-
-
scim_enabled: ScimEnabled{ id}The details for events with this
type.-
id: StringThe ID of the SCIM was enabled for.
-
-
service_account_created: ServiceAccountCreated{ id, data}The details for events with this
type.-
id: StringThe service account ID.
-
data: Data{ role}The payload used to create the service account.
-
role: StringThe role of the service account. Is either
ownerormember.
-
-
-
service_account_deleted: ServiceAccountDeleted{ id}The details for events with this
type.-
id: StringThe service account ID.
-
-
service_account_updated: ServiceAccountUpdated{ id, changes_requested}The details for events with this
type.-
id: StringThe service account ID.
-
changes_requested: ChangesRequested{ role}The payload used to updated the service account.
-
role: StringThe role of the service account. Is either
ownerormember.
-
-
-
user_added: UserAdded{ id, data}The details for events with this
type.-
id: StringThe user ID.
-
data: Data{ role}The payload used to add the user to the project.
-
role: StringThe role of the user. Is either
ownerormember.
-
-
-
user_deleted: UserDeleted{ id}The details for events with this
type.-
id: StringThe user ID.
-
-
user_updated: UserUpdated{ id, changes_requested}The details for events with this
type.-
id: StringThe project ID.
-
changes_requested: ChangesRequested{ role}The payload used to update the user.
-
role: StringThe role of the user. Is either
ownerormember.
-
-
-
workload_identity_provider_mapping_created: WorkloadIdentityProviderMappingCreated{ id, data, identity_provider_id}The details for events with this
type.-
id: StringThe workload identity provider mapping ID.
-
data: untypedThe payload used to create the workload identity provider mapping.
-
identity_provider_id: StringThe workload identity provider ID.
-
-
workload_identity_provider_mapping_deleted: WorkloadIdentityProviderMappingDeleted{ id, identity_provider_id, project_id, service_account_id}The details for events with this
type.-
id: StringThe workload identity provider mapping ID.
-
identity_provider_id: StringThe workload identity provider ID.
-
project_id: StringThe project ID.
-
service_account_id: StringThe mapped service account ID.
-
-
workload_identity_provider_mapping_updated: WorkloadIdentityProviderMappingUpdated{ id, changes_requested, identity_provider_id}The details for events with this
type.-
id: StringThe workload identity provider mapping ID.
-
changes_requested: untypedThe payload used to update the workload identity provider mapping.
-
identity_provider_id: StringThe workload identity provider ID.
-
-
workload_identity_provider_created: WorkloadIdentityProviderCreated{ id, data}The details for events with this
type.-
id: StringThe workload identity provider ID.
-
data: untypedThe payload used to create the workload identity provider.
-
-
workload_identity_provider_deleted: WorkloadIdentityProviderDeleted{ id, name}The details for events with this
type.-
id: StringThe workload identity provider ID.
-
name: StringThe workload identity provider name.
-
-
workload_identity_provider_updated: WorkloadIdentityProviderUpdated{ id, changes_requested}The details for events with this
type.-
id: StringThe workload identity provider ID.
-
changes_requested: untypedThe payload used to update the workload identity provider.
-
-
Admin API Keys
List all organization and project API keys.
admin.organization.admin_api_keys.list(**kwargs) -> CursorPage<AdminAPIKey>
get /organization/admin_api_keys
List organization API keys
Parameters
-
after: StringReturn keys with IDs that come after this ID in the pagination order.
-
limit: IntegerMaximum number of keys to return.
-
order: :asc | :descOrder results by creation time, ascending or descending.
-
:asc -
:desc
-
Returns
-
class AdminAPIKeyRepresents an individual Admin API key in an org.
-
id: StringThe identifier, which can be referenced in API endpoints
-
created_at: IntegerThe Unix timestamp (in seconds) of when the API key was created
-
object: :"organization.admin_api_key"The object type, which is always
organization.admin_api_key:"organization.admin_api_key"
-
owner: Owner{ id, created_at, name, 3 more}-
id: StringThe identifier, which can be referenced in API endpoints
-
created_at: IntegerThe Unix timestamp (in seconds) of when the user was created
-
name: StringThe name of the user
-
object: StringThe object type, which is always organization.user
-
role: StringAlways
owner -
type: StringAlways
user
-
-
redacted_value: StringThe redacted value of the API key
-
last_used_at: IntegerThe Unix timestamp (in seconds) of when the API key was last used
-
name: StringThe name of the API key
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
page = openai.admin.organization.admin_api_keys.list
puts(page)
Response
{
"data": [
{
"id": "key_abc",
"created_at": 1711471533,
"object": "organization.admin_api_key",
"owner": {
"id": "sa_456",
"created_at": 1711471533,
"name": "My Service Account",
"object": "organization.user",
"role": "owner",
"type": "user"
},
"redacted_value": "sk-admin...def",
"last_used_at": 1711471534,
"name": "Administration Key"
}
],
"has_more": false,
"object": "list",
"first_id": "key_abc",
"last_id": "key_xyz"
}
Create admin API key
admin.organization.admin_api_keys.create(**kwargs) -> AdminAPIKeyCreateResponse
post /organization/admin_api_keys
Create an organization admin API key
Parameters
name: String
Returns
-
class AdminAPIKeyCreateResponseRepresents an individual Admin API key in an org.
-
value: StringThe value of the API key. Only shown on create.
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
admin_api_key = openai.admin.organization.admin_api_keys.create(name: "New Admin Key")
puts(admin_api_key)
Response
{
"id": "key_abc",
"created_at": 1711471533,
"object": "organization.admin_api_key",
"owner": {
"id": "sa_456",
"created_at": 1711471533,
"name": "My Service Account",
"object": "organization.user",
"role": "owner",
"type": "user"
},
"redacted_value": "sk-admin...def",
"last_used_at": 1711471534,
"name": "Administration Key",
"value": "sk-admin-1234abcd"
}
Retrieve admin API key
admin.organization.admin_api_keys.retrieve(key_id) -> AdminAPIKey
get /organization/admin_api_keys/{key_id}
Retrieve a single organization API key
Parameters
-
key_id: StringThe ID of the API key.
Returns
-
class AdminAPIKeyRepresents an individual Admin API key in an org.
-
id: StringThe identifier, which can be referenced in API endpoints
-
created_at: IntegerThe Unix timestamp (in seconds) of when the API key was created
-
object: :"organization.admin_api_key"The object type, which is always
organization.admin_api_key:"organization.admin_api_key"
-
owner: Owner{ id, created_at, name, 3 more}-
id: StringThe identifier, which can be referenced in API endpoints
-
created_at: IntegerThe Unix timestamp (in seconds) of when the user was created
-
name: StringThe name of the user
-
object: StringThe object type, which is always organization.user
-
role: StringAlways
owner -
type: StringAlways
user
-
-
redacted_value: StringThe redacted value of the API key
-
last_used_at: IntegerThe Unix timestamp (in seconds) of when the API key was last used
-
name: StringThe name of the API key
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
admin_api_key = openai.admin.organization.admin_api_keys.retrieve("key_id")
puts(admin_api_key)
Response
{
"id": "key_abc",
"created_at": 1711471533,
"object": "organization.admin_api_key",
"owner": {
"id": "sa_456",
"created_at": 1711471533,
"name": "My Service Account",
"object": "organization.user",
"role": "owner",
"type": "user"
},
"redacted_value": "sk-admin...def",
"last_used_at": 1711471534,
"name": "Administration Key"
}
Delete admin API key
admin.organization.admin_api_keys.delete(key_id) -> AdminAPIKeyDeleteResponse
delete /organization/admin_api_keys/{key_id}
Delete an organization admin API key
Parameters
-
key_id: StringThe ID of the API key to be deleted.
Returns
-
class AdminAPIKeyDeleteResponse-
id: String -
deleted: bool -
object: :"organization.admin_api_key.deleted":"organization.admin_api_key.deleted"
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
admin_api_key = openai.admin.organization.admin_api_keys.delete("key_id")
puts(admin_api_key)
Response
{
"id": "key_abc",
"deleted": true,
"object": "organization.admin_api_key.deleted"
}
Domain Types
Admin API Key
-
class AdminAPIKeyRepresents an individual Admin API key in an org.
-
id: StringThe identifier, which can be referenced in API endpoints
-
created_at: IntegerThe Unix timestamp (in seconds) of when the API key was created
-
object: :"organization.admin_api_key"The object type, which is always
organization.admin_api_key:"organization.admin_api_key"
-
owner: Owner{ id, created_at, name, 3 more}-
id: StringThe identifier, which can be referenced in API endpoints
-
created_at: IntegerThe Unix timestamp (in seconds) of when the user was created
-
name: StringThe name of the user
-
object: StringThe object type, which is always organization.user
-
role: StringAlways
owner -
type: StringAlways
user
-
-
redacted_value: StringThe redacted value of the API key
-
last_used_at: IntegerThe Unix timestamp (in seconds) of when the API key was last used
-
name: StringThe name of the API key
-
Admin API Key Create Response
-
class AdminAPIKeyCreateResponseRepresents an individual Admin API key in an org.
-
value: StringThe value of the API key. Only shown on create.
-
Admin API Key Delete Response
-
class AdminAPIKeyDeleteResponse-
id: String -
deleted: bool -
object: :"organization.admin_api_key.deleted":"organization.admin_api_key.deleted"
-
Usage
Audio speeches
admin.organization.usage.audio_speeches(**kwargs) -> UsageAudioSpeechesResponse
get /organization/usage/audio_speeches
Get audio speeches usage details for the organization.
Parameters
-
start_time: IntegerStart time (Unix seconds) of the query time range, inclusive.
-
api_key_ids: Array[String]Return only usage for these API keys.
-
bucket_width: :"1m" | :"1h" | :"1d"Width of each time bucket in response. Currently
1m,1hand1dare supported, default to1d.-
:"1m" -
:"1h" -
:"1d"
-
-
end_time: IntegerEnd time (Unix seconds) of the query time range, exclusive.
-
group_by: Array[:project_id | :user_id | :api_key_id | :model]Group the usage data by the specified fields. Support fields include
project_id,user_id,api_key_id,modelor any combination of them.-
:project_id -
:user_id -
:api_key_id -
:model
-
-
limit: IntegerSpecifies 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
-
models: Array[String]Return only usage for these models.
-
page: StringA cursor for use in pagination. Corresponding to the
next_pagefield from the previous response. -
project_ids: Array[String]Return only usage for these projects.
-
user_ids: Array[String]Return only usage for these users.
Returns
-
class UsageAudioSpeechesResponse-
data: Array[Data{ end_time, object, results, start_time}]-
end_time: Integer -
object: :bucket:bucket
-
results: Array[OrganizationUsageCompletionsResult{ input_tokens, num_model_requests, object, 10 more} | OrganizationUsageEmbeddingsResult{ input_tokens, num_model_requests, object, 4 more} | OrganizationUsageModerationsResult{ input_tokens, num_model_requests, object, 4 more} | 8 more]-
class OrganizationUsageCompletionsResultThe aggregated completions usage details of the specific time bucket.
-
input_tokens: IntegerThe aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.completions.result":"organization.usage.completions.result"
-
output_tokens: IntegerThe aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens.
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
batch: boolWhen
group_by=batch, this field tells whether the grouped usage result is batch or not. -
input_audio_tokens: IntegerThe aggregated number of audio input tokens used, including cached tokens.
-
input_cached_tokens: IntegerThe aggregated number of text input tokens that has been cached from previous requests. For customers subscribe to scale tier, this includes scale tier tokens.
-
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
output_audio_tokens: IntegerThe aggregated number of audio output tokens used.
-
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
service_tier: StringWhen
group_by=service_tier, this field provides the service tier of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageEmbeddingsResultThe aggregated embeddings usage details of the specific time bucket.
-
input_tokens: IntegerThe aggregated number of input tokens used.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.embeddings.result":"organization.usage.embeddings.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageModerationsResultThe aggregated moderations usage details of the specific time bucket.
-
input_tokens: IntegerThe aggregated number of input tokens used.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.moderations.result":"organization.usage.moderations.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageImagesResultThe aggregated images usage details of the specific time bucket.
-
images: IntegerThe number of images processed.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.images.result":"organization.usage.images.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
size: StringWhen
group_by=size, this field provides the image size of the grouped usage result. -
source: StringWhen
group_by=source, this field provides the source of the grouped usage result, possible values areimage.generation,image.edit,image.variation. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageAudioSpeechesResultThe aggregated audio speeches usage details of the specific time bucket.
-
characters: IntegerThe number of characters processed.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.audio_speeches.result":"organization.usage.audio_speeches.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageAudioTranscriptionsResultThe aggregated audio transcriptions usage details of the specific time bucket.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.audio_transcriptions.result":"organization.usage.audio_transcriptions.result"
-
seconds: IntegerThe number of seconds processed.
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageVectorStoresResultThe aggregated vector stores usage details of the specific time bucket.
-
object: :"organization.usage.vector_stores.result":"organization.usage.vector_stores.result"
-
usage_bytes: IntegerThe vector stores usage in bytes.
-
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
class OrganizationUsageCodeInterpreterSessionsResultThe aggregated code interpreter sessions usage details of the specific time bucket.
-
num_sessions: IntegerThe number of code interpreter sessions.
-
object: :"organization.usage.code_interpreter_sessions.result":"organization.usage.code_interpreter_sessions.result"
-
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
class OrganizationUsageFileSearchesResultThe aggregated file search calls usage details of the specific time bucket.
-
num_requests: IntegerThe count of file search calls.
-
object: :"organization.usage.file_searches.result":"organization.usage.file_searches.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result. -
vector_store_id: StringWhen
group_by=vector_store_id, this field provides the vector store ID of the grouped usage result.
-
-
class OrganizationUsageWebSearchesResultThe aggregated web search calls usage details of the specific time bucket.
-
num_model_requests: IntegerThe count of model requests.
-
num_requests: IntegerThe count of web search calls.
-
object: :"organization.usage.web_searches.result":"organization.usage.web_searches.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
context_level: StringWhen
group_by=context_level, this field provides the search context size of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationCostsResultThe aggregated costs details of the specific time bucket.
-
object: :"organization.costs.result":"organization.costs.result"
-
amount: Amount{ currency, value}The monetary value in its associated currency.
-
currency: StringLowercase ISO-4217 currency e.g. "usd"
-
value: FloatThe numeric value of the cost.
-
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API Key ID of the grouped costs result. -
line_item: StringWhen
group_by=line_item, this field provides the line item of the grouped costs result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped costs result. -
quantity: FloatWhen
group_by=line_item, this field provides the quantity of the grouped costs result.
-
-
-
start_time: Integer
-
-
has_more: bool -
next_page: String -
object: :page:page
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
response = openai.admin.organization.usage.audio_speeches(start_time: 0)
puts(response)
Response
{
"data": [
{
"end_time": 0,
"object": "bucket",
"results": [
{
"input_tokens": 0,
"num_model_requests": 0,
"object": "organization.usage.completions.result",
"output_tokens": 0,
"api_key_id": "api_key_id",
"batch": true,
"input_audio_tokens": 0,
"input_cached_tokens": 0,
"model": "model",
"output_audio_tokens": 0,
"project_id": "project_id",
"service_tier": "service_tier",
"user_id": "user_id"
}
],
"start_time": 0
}
],
"has_more": true,
"next_page": "next_page",
"object": "page"
}
Audio transcriptions
admin.organization.usage.audio_transcriptions(**kwargs) -> UsageAudioTranscriptionsResponse
get /organization/usage/audio_transcriptions
Get audio transcriptions usage details for the organization.
Parameters
-
start_time: IntegerStart time (Unix seconds) of the query time range, inclusive.
-
api_key_ids: Array[String]Return only usage for these API keys.
-
bucket_width: :"1m" | :"1h" | :"1d"Width of each time bucket in response. Currently
1m,1hand1dare supported, default to1d.-
:"1m" -
:"1h" -
:"1d"
-
-
end_time: IntegerEnd time (Unix seconds) of the query time range, exclusive.
-
group_by: Array[:project_id | :user_id | :api_key_id | :model]Group the usage data by the specified fields. Support fields include
project_id,user_id,api_key_id,modelor any combination of them.-
:project_id -
:user_id -
:api_key_id -
:model
-
-
limit: IntegerSpecifies 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
-
models: Array[String]Return only usage for these models.
-
page: StringA cursor for use in pagination. Corresponding to the
next_pagefield from the previous response. -
project_ids: Array[String]Return only usage for these projects.
-
user_ids: Array[String]Return only usage for these users.
Returns
-
class UsageAudioTranscriptionsResponse-
data: Array[Data{ end_time, object, results, start_time}]-
end_time: Integer -
object: :bucket:bucket
-
results: Array[OrganizationUsageCompletionsResult{ input_tokens, num_model_requests, object, 10 more} | OrganizationUsageEmbeddingsResult{ input_tokens, num_model_requests, object, 4 more} | OrganizationUsageModerationsResult{ input_tokens, num_model_requests, object, 4 more} | 8 more]-
class OrganizationUsageCompletionsResultThe aggregated completions usage details of the specific time bucket.
-
input_tokens: IntegerThe aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.completions.result":"organization.usage.completions.result"
-
output_tokens: IntegerThe aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens.
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
batch: boolWhen
group_by=batch, this field tells whether the grouped usage result is batch or not. -
input_audio_tokens: IntegerThe aggregated number of audio input tokens used, including cached tokens.
-
input_cached_tokens: IntegerThe aggregated number of text input tokens that has been cached from previous requests. For customers subscribe to scale tier, this includes scale tier tokens.
-
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
output_audio_tokens: IntegerThe aggregated number of audio output tokens used.
-
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
service_tier: StringWhen
group_by=service_tier, this field provides the service tier of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageEmbeddingsResultThe aggregated embeddings usage details of the specific time bucket.
-
input_tokens: IntegerThe aggregated number of input tokens used.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.embeddings.result":"organization.usage.embeddings.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageModerationsResultThe aggregated moderations usage details of the specific time bucket.
-
input_tokens: IntegerThe aggregated number of input tokens used.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.moderations.result":"organization.usage.moderations.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageImagesResultThe aggregated images usage details of the specific time bucket.
-
images: IntegerThe number of images processed.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.images.result":"organization.usage.images.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
size: StringWhen
group_by=size, this field provides the image size of the grouped usage result. -
source: StringWhen
group_by=source, this field provides the source of the grouped usage result, possible values areimage.generation,image.edit,image.variation. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageAudioSpeechesResultThe aggregated audio speeches usage details of the specific time bucket.
-
characters: IntegerThe number of characters processed.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.audio_speeches.result":"organization.usage.audio_speeches.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageAudioTranscriptionsResultThe aggregated audio transcriptions usage details of the specific time bucket.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.audio_transcriptions.result":"organization.usage.audio_transcriptions.result"
-
seconds: IntegerThe number of seconds processed.
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageVectorStoresResultThe aggregated vector stores usage details of the specific time bucket.
-
object: :"organization.usage.vector_stores.result":"organization.usage.vector_stores.result"
-
usage_bytes: IntegerThe vector stores usage in bytes.
-
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
class OrganizationUsageCodeInterpreterSessionsResultThe aggregated code interpreter sessions usage details of the specific time bucket.
-
num_sessions: IntegerThe number of code interpreter sessions.
-
object: :"organization.usage.code_interpreter_sessions.result":"organization.usage.code_interpreter_sessions.result"
-
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
class OrganizationUsageFileSearchesResultThe aggregated file search calls usage details of the specific time bucket.
-
num_requests: IntegerThe count of file search calls.
-
object: :"organization.usage.file_searches.result":"organization.usage.file_searches.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result. -
vector_store_id: StringWhen
group_by=vector_store_id, this field provides the vector store ID of the grouped usage result.
-
-
class OrganizationUsageWebSearchesResultThe aggregated web search calls usage details of the specific time bucket.
-
num_model_requests: IntegerThe count of model requests.
-
num_requests: IntegerThe count of web search calls.
-
object: :"organization.usage.web_searches.result":"organization.usage.web_searches.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
context_level: StringWhen
group_by=context_level, this field provides the search context size of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationCostsResultThe aggregated costs details of the specific time bucket.
-
object: :"organization.costs.result":"organization.costs.result"
-
amount: Amount{ currency, value}The monetary value in its associated currency.
-
currency: StringLowercase ISO-4217 currency e.g. "usd"
-
value: FloatThe numeric value of the cost.
-
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API Key ID of the grouped costs result. -
line_item: StringWhen
group_by=line_item, this field provides the line item of the grouped costs result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped costs result. -
quantity: FloatWhen
group_by=line_item, this field provides the quantity of the grouped costs result.
-
-
-
start_time: Integer
-
-
has_more: bool -
next_page: String -
object: :page:page
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
response = openai.admin.organization.usage.audio_transcriptions(start_time: 0)
puts(response)
Response
{
"data": [
{
"end_time": 0,
"object": "bucket",
"results": [
{
"input_tokens": 0,
"num_model_requests": 0,
"object": "organization.usage.completions.result",
"output_tokens": 0,
"api_key_id": "api_key_id",
"batch": true,
"input_audio_tokens": 0,
"input_cached_tokens": 0,
"model": "model",
"output_audio_tokens": 0,
"project_id": "project_id",
"service_tier": "service_tier",
"user_id": "user_id"
}
],
"start_time": 0
}
],
"has_more": true,
"next_page": "next_page",
"object": "page"
}
Code interpreter sessions
admin.organization.usage.code_interpreter_sessions(**kwargs) -> UsageCodeInterpreterSessionsResponse
get /organization/usage/code_interpreter_sessions
Get code interpreter sessions usage details for the organization.
Parameters
-
start_time: IntegerStart time (Unix seconds) of the query time range, inclusive.
-
bucket_width: :"1m" | :"1h" | :"1d"Width of each time bucket in response. Currently
1m,1hand1dare supported, default to1d.-
:"1m" -
:"1h" -
:"1d"
-
-
end_time: IntegerEnd time (Unix seconds) of the query time range, exclusive.
-
group_by: Array[:project_id]Group the usage data by the specified fields. Support fields include
project_id.:project_id
-
limit: IntegerSpecifies 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: StringA cursor for use in pagination. Corresponding to the
next_pagefield from the previous response. -
project_ids: Array[String]Return only usage for these projects.
Returns
-
class UsageCodeInterpreterSessionsResponse-
data: Array[Data{ end_time, object, results, start_time}]-
end_time: Integer -
object: :bucket:bucket
-
results: Array[OrganizationUsageCompletionsResult{ input_tokens, num_model_requests, object, 10 more} | OrganizationUsageEmbeddingsResult{ input_tokens, num_model_requests, object, 4 more} | OrganizationUsageModerationsResult{ input_tokens, num_model_requests, object, 4 more} | 8 more]-
class OrganizationUsageCompletionsResultThe aggregated completions usage details of the specific time bucket.
-
input_tokens: IntegerThe aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.completions.result":"organization.usage.completions.result"
-
output_tokens: IntegerThe aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens.
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
batch: boolWhen
group_by=batch, this field tells whether the grouped usage result is batch or not. -
input_audio_tokens: IntegerThe aggregated number of audio input tokens used, including cached tokens.
-
input_cached_tokens: IntegerThe aggregated number of text input tokens that has been cached from previous requests. For customers subscribe to scale tier, this includes scale tier tokens.
-
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
output_audio_tokens: IntegerThe aggregated number of audio output tokens used.
-
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
service_tier: StringWhen
group_by=service_tier, this field provides the service tier of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageEmbeddingsResultThe aggregated embeddings usage details of the specific time bucket.
-
input_tokens: IntegerThe aggregated number of input tokens used.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.embeddings.result":"organization.usage.embeddings.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageModerationsResultThe aggregated moderations usage details of the specific time bucket.
-
input_tokens: IntegerThe aggregated number of input tokens used.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.moderations.result":"organization.usage.moderations.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageImagesResultThe aggregated images usage details of the specific time bucket.
-
images: IntegerThe number of images processed.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.images.result":"organization.usage.images.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
size: StringWhen
group_by=size, this field provides the image size of the grouped usage result. -
source: StringWhen
group_by=source, this field provides the source of the grouped usage result, possible values areimage.generation,image.edit,image.variation. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageAudioSpeechesResultThe aggregated audio speeches usage details of the specific time bucket.
-
characters: IntegerThe number of characters processed.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.audio_speeches.result":"organization.usage.audio_speeches.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageAudioTranscriptionsResultThe aggregated audio transcriptions usage details of the specific time bucket.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.audio_transcriptions.result":"organization.usage.audio_transcriptions.result"
-
seconds: IntegerThe number of seconds processed.
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageVectorStoresResultThe aggregated vector stores usage details of the specific time bucket.
-
object: :"organization.usage.vector_stores.result":"organization.usage.vector_stores.result"
-
usage_bytes: IntegerThe vector stores usage in bytes.
-
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
class OrganizationUsageCodeInterpreterSessionsResultThe aggregated code interpreter sessions usage details of the specific time bucket.
-
num_sessions: IntegerThe number of code interpreter sessions.
-
object: :"organization.usage.code_interpreter_sessions.result":"organization.usage.code_interpreter_sessions.result"
-
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
class OrganizationUsageFileSearchesResultThe aggregated file search calls usage details of the specific time bucket.
-
num_requests: IntegerThe count of file search calls.
-
object: :"organization.usage.file_searches.result":"organization.usage.file_searches.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result. -
vector_store_id: StringWhen
group_by=vector_store_id, this field provides the vector store ID of the grouped usage result.
-
-
class OrganizationUsageWebSearchesResultThe aggregated web search calls usage details of the specific time bucket.
-
num_model_requests: IntegerThe count of model requests.
-
num_requests: IntegerThe count of web search calls.
-
object: :"organization.usage.web_searches.result":"organization.usage.web_searches.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
context_level: StringWhen
group_by=context_level, this field provides the search context size of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationCostsResultThe aggregated costs details of the specific time bucket.
-
object: :"organization.costs.result":"organization.costs.result"
-
amount: Amount{ currency, value}The monetary value in its associated currency.
-
currency: StringLowercase ISO-4217 currency e.g. "usd"
-
value: FloatThe numeric value of the cost.
-
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API Key ID of the grouped costs result. -
line_item: StringWhen
group_by=line_item, this field provides the line item of the grouped costs result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped costs result. -
quantity: FloatWhen
group_by=line_item, this field provides the quantity of the grouped costs result.
-
-
-
start_time: Integer
-
-
has_more: bool -
next_page: String -
object: :page:page
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
response = openai.admin.organization.usage.code_interpreter_sessions(start_time: 0)
puts(response)
Response
{
"data": [
{
"end_time": 0,
"object": "bucket",
"results": [
{
"input_tokens": 0,
"num_model_requests": 0,
"object": "organization.usage.completions.result",
"output_tokens": 0,
"api_key_id": "api_key_id",
"batch": true,
"input_audio_tokens": 0,
"input_cached_tokens": 0,
"model": "model",
"output_audio_tokens": 0,
"project_id": "project_id",
"service_tier": "service_tier",
"user_id": "user_id"
}
],
"start_time": 0
}
],
"has_more": true,
"next_page": "next_page",
"object": "page"
}
Completions
admin.organization.usage.completions(**kwargs) -> UsageCompletionsResponse
get /organization/usage/completions
Get completions usage details for the organization.
Parameters
-
start_time: IntegerStart time (Unix seconds) of the query time range, inclusive.
-
api_key_ids: Array[String]Return only usage for these API keys.
-
batch: boolIf
true, return batch jobs only. Iffalse, return non-batch jobs only. By default, return both. -
bucket_width: :"1m" | :"1h" | :"1d"Width of each time bucket in response. Currently
1m,1hand1dare supported, default to1d.-
:"1m" -
:"1h" -
:"1d"
-
-
end_time: IntegerEnd time (Unix seconds) of the query time range, exclusive.
-
group_by: Array[:project_id | :user_id | :api_key_id | 3 more]Group the usage data by the specified fields. Support fields include
project_id,user_id,api_key_id,model,batch,service_tieror any combination of them.-
:project_id -
:user_id -
:api_key_id -
:model -
:batch -
:service_tier
-
-
limit: IntegerSpecifies 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
-
models: Array[String]Return only usage for these models.
-
page: StringA cursor for use in pagination. Corresponding to the
next_pagefield from the previous response. -
project_ids: Array[String]Return only usage for these projects.
-
user_ids: Array[String]Return only usage for these users.
Returns
-
class UsageCompletionsResponse-
data: Array[Data{ end_time, object, results, start_time}]-
end_time: Integer -
object: :bucket:bucket
-
results: Array[OrganizationUsageCompletionsResult{ input_tokens, num_model_requests, object, 10 more} | OrganizationUsageEmbeddingsResult{ input_tokens, num_model_requests, object, 4 more} | OrganizationUsageModerationsResult{ input_tokens, num_model_requests, object, 4 more} | 8 more]-
class OrganizationUsageCompletionsResultThe aggregated completions usage details of the specific time bucket.
-
input_tokens: IntegerThe aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.completions.result":"organization.usage.completions.result"
-
output_tokens: IntegerThe aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens.
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
batch: boolWhen
group_by=batch, this field tells whether the grouped usage result is batch or not. -
input_audio_tokens: IntegerThe aggregated number of audio input tokens used, including cached tokens.
-
input_cached_tokens: IntegerThe aggregated number of text input tokens that has been cached from previous requests. For customers subscribe to scale tier, this includes scale tier tokens.
-
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
output_audio_tokens: IntegerThe aggregated number of audio output tokens used.
-
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
service_tier: StringWhen
group_by=service_tier, this field provides the service tier of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageEmbeddingsResultThe aggregated embeddings usage details of the specific time bucket.
-
input_tokens: IntegerThe aggregated number of input tokens used.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.embeddings.result":"organization.usage.embeddings.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageModerationsResultThe aggregated moderations usage details of the specific time bucket.
-
input_tokens: IntegerThe aggregated number of input tokens used.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.moderations.result":"organization.usage.moderations.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageImagesResultThe aggregated images usage details of the specific time bucket.
-
images: IntegerThe number of images processed.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.images.result":"organization.usage.images.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
size: StringWhen
group_by=size, this field provides the image size of the grouped usage result. -
source: StringWhen
group_by=source, this field provides the source of the grouped usage result, possible values areimage.generation,image.edit,image.variation. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageAudioSpeechesResultThe aggregated audio speeches usage details of the specific time bucket.
-
characters: IntegerThe number of characters processed.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.audio_speeches.result":"organization.usage.audio_speeches.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageAudioTranscriptionsResultThe aggregated audio transcriptions usage details of the specific time bucket.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.audio_transcriptions.result":"organization.usage.audio_transcriptions.result"
-
seconds: IntegerThe number of seconds processed.
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageVectorStoresResultThe aggregated vector stores usage details of the specific time bucket.
-
object: :"organization.usage.vector_stores.result":"organization.usage.vector_stores.result"
-
usage_bytes: IntegerThe vector stores usage in bytes.
-
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
class OrganizationUsageCodeInterpreterSessionsResultThe aggregated code interpreter sessions usage details of the specific time bucket.
-
num_sessions: IntegerThe number of code interpreter sessions.
-
object: :"organization.usage.code_interpreter_sessions.result":"organization.usage.code_interpreter_sessions.result"
-
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
class OrganizationUsageFileSearchesResultThe aggregated file search calls usage details of the specific time bucket.
-
num_requests: IntegerThe count of file search calls.
-
object: :"organization.usage.file_searches.result":"organization.usage.file_searches.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result. -
vector_store_id: StringWhen
group_by=vector_store_id, this field provides the vector store ID of the grouped usage result.
-
-
class OrganizationUsageWebSearchesResultThe aggregated web search calls usage details of the specific time bucket.
-
num_model_requests: IntegerThe count of model requests.
-
num_requests: IntegerThe count of web search calls.
-
object: :"organization.usage.web_searches.result":"organization.usage.web_searches.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
context_level: StringWhen
group_by=context_level, this field provides the search context size of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationCostsResultThe aggregated costs details of the specific time bucket.
-
object: :"organization.costs.result":"organization.costs.result"
-
amount: Amount{ currency, value}The monetary value in its associated currency.
-
currency: StringLowercase ISO-4217 currency e.g. "usd"
-
value: FloatThe numeric value of the cost.
-
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API Key ID of the grouped costs result. -
line_item: StringWhen
group_by=line_item, this field provides the line item of the grouped costs result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped costs result. -
quantity: FloatWhen
group_by=line_item, this field provides the quantity of the grouped costs result.
-
-
-
start_time: Integer
-
-
has_more: bool -
next_page: String -
object: :page:page
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
response = openai.admin.organization.usage.completions(start_time: 0)
puts(response)
Response
{
"data": [
{
"end_time": 0,
"object": "bucket",
"results": [
{
"input_tokens": 0,
"num_model_requests": 0,
"object": "organization.usage.completions.result",
"output_tokens": 0,
"api_key_id": "api_key_id",
"batch": true,
"input_audio_tokens": 0,
"input_cached_tokens": 0,
"model": "model",
"output_audio_tokens": 0,
"project_id": "project_id",
"service_tier": "service_tier",
"user_id": "user_id"
}
],
"start_time": 0
}
],
"has_more": true,
"next_page": "next_page",
"object": "page"
}
Embeddings
admin.organization.usage.embeddings(**kwargs) -> UsageEmbeddingsResponse
get /organization/usage/embeddings
Get embeddings usage details for the organization.
Parameters
-
start_time: IntegerStart time (Unix seconds) of the query time range, inclusive.
-
api_key_ids: Array[String]Return only usage for these API keys.
-
bucket_width: :"1m" | :"1h" | :"1d"Width of each time bucket in response. Currently
1m,1hand1dare supported, default to1d.-
:"1m" -
:"1h" -
:"1d"
-
-
end_time: IntegerEnd time (Unix seconds) of the query time range, exclusive.
-
group_by: Array[:project_id | :user_id | :api_key_id | :model]Group the usage data by the specified fields. Support fields include
project_id,user_id,api_key_id,modelor any combination of them.-
:project_id -
:user_id -
:api_key_id -
:model
-
-
limit: IntegerSpecifies 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
-
models: Array[String]Return only usage for these models.
-
page: StringA cursor for use in pagination. Corresponding to the
next_pagefield from the previous response. -
project_ids: Array[String]Return only usage for these projects.
-
user_ids: Array[String]Return only usage for these users.
Returns
-
class UsageEmbeddingsResponse-
data: Array[Data{ end_time, object, results, start_time}]-
end_time: Integer -
object: :bucket:bucket
-
results: Array[OrganizationUsageCompletionsResult{ input_tokens, num_model_requests, object, 10 more} | OrganizationUsageEmbeddingsResult{ input_tokens, num_model_requests, object, 4 more} | OrganizationUsageModerationsResult{ input_tokens, num_model_requests, object, 4 more} | 8 more]-
class OrganizationUsageCompletionsResultThe aggregated completions usage details of the specific time bucket.
-
input_tokens: IntegerThe aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.completions.result":"organization.usage.completions.result"
-
output_tokens: IntegerThe aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens.
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
batch: boolWhen
group_by=batch, this field tells whether the grouped usage result is batch or not. -
input_audio_tokens: IntegerThe aggregated number of audio input tokens used, including cached tokens.
-
input_cached_tokens: IntegerThe aggregated number of text input tokens that has been cached from previous requests. For customers subscribe to scale tier, this includes scale tier tokens.
-
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
output_audio_tokens: IntegerThe aggregated number of audio output tokens used.
-
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
service_tier: StringWhen
group_by=service_tier, this field provides the service tier of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageEmbeddingsResultThe aggregated embeddings usage details of the specific time bucket.
-
input_tokens: IntegerThe aggregated number of input tokens used.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.embeddings.result":"organization.usage.embeddings.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageModerationsResultThe aggregated moderations usage details of the specific time bucket.
-
input_tokens: IntegerThe aggregated number of input tokens used.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.moderations.result":"organization.usage.moderations.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageImagesResultThe aggregated images usage details of the specific time bucket.
-
images: IntegerThe number of images processed.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.images.result":"organization.usage.images.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
size: StringWhen
group_by=size, this field provides the image size of the grouped usage result. -
source: StringWhen
group_by=source, this field provides the source of the grouped usage result, possible values areimage.generation,image.edit,image.variation. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageAudioSpeechesResultThe aggregated audio speeches usage details of the specific time bucket.
-
characters: IntegerThe number of characters processed.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.audio_speeches.result":"organization.usage.audio_speeches.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageAudioTranscriptionsResultThe aggregated audio transcriptions usage details of the specific time bucket.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.audio_transcriptions.result":"organization.usage.audio_transcriptions.result"
-
seconds: IntegerThe number of seconds processed.
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageVectorStoresResultThe aggregated vector stores usage details of the specific time bucket.
-
object: :"organization.usage.vector_stores.result":"organization.usage.vector_stores.result"
-
usage_bytes: IntegerThe vector stores usage in bytes.
-
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
class OrganizationUsageCodeInterpreterSessionsResultThe aggregated code interpreter sessions usage details of the specific time bucket.
-
num_sessions: IntegerThe number of code interpreter sessions.
-
object: :"organization.usage.code_interpreter_sessions.result":"organization.usage.code_interpreter_sessions.result"
-
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
class OrganizationUsageFileSearchesResultThe aggregated file search calls usage details of the specific time bucket.
-
num_requests: IntegerThe count of file search calls.
-
object: :"organization.usage.file_searches.result":"organization.usage.file_searches.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result. -
vector_store_id: StringWhen
group_by=vector_store_id, this field provides the vector store ID of the grouped usage result.
-
-
class OrganizationUsageWebSearchesResultThe aggregated web search calls usage details of the specific time bucket.
-
num_model_requests: IntegerThe count of model requests.
-
num_requests: IntegerThe count of web search calls.
-
object: :"organization.usage.web_searches.result":"organization.usage.web_searches.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
context_level: StringWhen
group_by=context_level, this field provides the search context size of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationCostsResultThe aggregated costs details of the specific time bucket.
-
object: :"organization.costs.result":"organization.costs.result"
-
amount: Amount{ currency, value}The monetary value in its associated currency.
-
currency: StringLowercase ISO-4217 currency e.g. "usd"
-
value: FloatThe numeric value of the cost.
-
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API Key ID of the grouped costs result. -
line_item: StringWhen
group_by=line_item, this field provides the line item of the grouped costs result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped costs result. -
quantity: FloatWhen
group_by=line_item, this field provides the quantity of the grouped costs result.
-
-
-
start_time: Integer
-
-
has_more: bool -
next_page: String -
object: :page:page
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
response = openai.admin.organization.usage.embeddings(start_time: 0)
puts(response)
Response
{
"data": [
{
"end_time": 0,
"object": "bucket",
"results": [
{
"input_tokens": 0,
"num_model_requests": 0,
"object": "organization.usage.completions.result",
"output_tokens": 0,
"api_key_id": "api_key_id",
"batch": true,
"input_audio_tokens": 0,
"input_cached_tokens": 0,
"model": "model",
"output_audio_tokens": 0,
"project_id": "project_id",
"service_tier": "service_tier",
"user_id": "user_id"
}
],
"start_time": 0
}
],
"has_more": true,
"next_page": "next_page",
"object": "page"
}
Images
admin.organization.usage.images(**kwargs) -> UsageImagesResponse
get /organization/usage/images
Get images usage details for the organization.
Parameters
-
start_time: IntegerStart time (Unix seconds) of the query time range, inclusive.
-
api_key_ids: Array[String]Return only usage for these API keys.
-
bucket_width: :"1m" | :"1h" | :"1d"Width of each time bucket in response. Currently
1m,1hand1dare supported, default to1d.-
:"1m" -
:"1h" -
:"1d"
-
-
end_time: IntegerEnd time (Unix seconds) of the query time range, exclusive.
-
group_by: Array[:project_id | :user_id | :api_key_id | 3 more]Group the usage data by the specified fields. Support fields include
project_id,user_id,api_key_id,model,size,sourceor any combination of them.-
:project_id -
:user_id -
:api_key_id -
:model -
:size -
:source
-
-
limit: IntegerSpecifies 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
-
models: Array[String]Return only usage for these models.
-
page: StringA cursor for use in pagination. Corresponding to the
next_pagefield from the previous response. -
project_ids: Array[String]Return only usage for these projects.
-
sizes: Array[:"256x256" | :"512x512" | :"1024x1024" | 2 more]Return only usages for these image sizes. Possible values are
256x256,512x512,1024x1024,1792x1792,1024x1792or any combination of them.-
:"256x256" -
:"512x512" -
:"1024x1024" -
:"1792x1792" -
:"1024x1792"
-
-
sources: Array[:"image.generation" | :"image.edit" | :"image.variation"]Return only usages for these sources. Possible values are
image.generation,image.edit,image.variationor any combination of them.-
:"image.generation" -
:"image.edit" -
:"image.variation"
-
-
user_ids: Array[String]Return only usage for these users.
Returns
-
class UsageImagesResponse-
data: Array[Data{ end_time, object, results, start_time}]-
end_time: Integer -
object: :bucket:bucket
-
results: Array[OrganizationUsageCompletionsResult{ input_tokens, num_model_requests, object, 10 more} | OrganizationUsageEmbeddingsResult{ input_tokens, num_model_requests, object, 4 more} | OrganizationUsageModerationsResult{ input_tokens, num_model_requests, object, 4 more} | 8 more]-
class OrganizationUsageCompletionsResultThe aggregated completions usage details of the specific time bucket.
-
input_tokens: IntegerThe aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.completions.result":"organization.usage.completions.result"
-
output_tokens: IntegerThe aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens.
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
batch: boolWhen
group_by=batch, this field tells whether the grouped usage result is batch or not. -
input_audio_tokens: IntegerThe aggregated number of audio input tokens used, including cached tokens.
-
input_cached_tokens: IntegerThe aggregated number of text input tokens that has been cached from previous requests. For customers subscribe to scale tier, this includes scale tier tokens.
-
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
output_audio_tokens: IntegerThe aggregated number of audio output tokens used.
-
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
service_tier: StringWhen
group_by=service_tier, this field provides the service tier of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageEmbeddingsResultThe aggregated embeddings usage details of the specific time bucket.
-
input_tokens: IntegerThe aggregated number of input tokens used.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.embeddings.result":"organization.usage.embeddings.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageModerationsResultThe aggregated moderations usage details of the specific time bucket.
-
input_tokens: IntegerThe aggregated number of input tokens used.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.moderations.result":"organization.usage.moderations.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageImagesResultThe aggregated images usage details of the specific time bucket.
-
images: IntegerThe number of images processed.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.images.result":"organization.usage.images.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
size: StringWhen
group_by=size, this field provides the image size of the grouped usage result. -
source: StringWhen
group_by=source, this field provides the source of the grouped usage result, possible values areimage.generation,image.edit,image.variation. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageAudioSpeechesResultThe aggregated audio speeches usage details of the specific time bucket.
-
characters: IntegerThe number of characters processed.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.audio_speeches.result":"organization.usage.audio_speeches.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageAudioTranscriptionsResultThe aggregated audio transcriptions usage details of the specific time bucket.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.audio_transcriptions.result":"organization.usage.audio_transcriptions.result"
-
seconds: IntegerThe number of seconds processed.
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageVectorStoresResultThe aggregated vector stores usage details of the specific time bucket.
-
object: :"organization.usage.vector_stores.result":"organization.usage.vector_stores.result"
-
usage_bytes: IntegerThe vector stores usage in bytes.
-
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
class OrganizationUsageCodeInterpreterSessionsResultThe aggregated code interpreter sessions usage details of the specific time bucket.
-
num_sessions: IntegerThe number of code interpreter sessions.
-
object: :"organization.usage.code_interpreter_sessions.result":"organization.usage.code_interpreter_sessions.result"
-
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
class OrganizationUsageFileSearchesResultThe aggregated file search calls usage details of the specific time bucket.
-
num_requests: IntegerThe count of file search calls.
-
object: :"organization.usage.file_searches.result":"organization.usage.file_searches.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result. -
vector_store_id: StringWhen
group_by=vector_store_id, this field provides the vector store ID of the grouped usage result.
-
-
class OrganizationUsageWebSearchesResultThe aggregated web search calls usage details of the specific time bucket.
-
num_model_requests: IntegerThe count of model requests.
-
num_requests: IntegerThe count of web search calls.
-
object: :"organization.usage.web_searches.result":"organization.usage.web_searches.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
context_level: StringWhen
group_by=context_level, this field provides the search context size of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationCostsResultThe aggregated costs details of the specific time bucket.
-
object: :"organization.costs.result":"organization.costs.result"
-
amount: Amount{ currency, value}The monetary value in its associated currency.
-
currency: StringLowercase ISO-4217 currency e.g. "usd"
-
value: FloatThe numeric value of the cost.
-
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API Key ID of the grouped costs result. -
line_item: StringWhen
group_by=line_item, this field provides the line item of the grouped costs result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped costs result. -
quantity: FloatWhen
group_by=line_item, this field provides the quantity of the grouped costs result.
-
-
-
start_time: Integer
-
-
has_more: bool -
next_page: String -
object: :page:page
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
response = openai.admin.organization.usage.images(start_time: 0)
puts(response)
Response
{
"data": [
{
"end_time": 0,
"object": "bucket",
"results": [
{
"input_tokens": 0,
"num_model_requests": 0,
"object": "organization.usage.completions.result",
"output_tokens": 0,
"api_key_id": "api_key_id",
"batch": true,
"input_audio_tokens": 0,
"input_cached_tokens": 0,
"model": "model",
"output_audio_tokens": 0,
"project_id": "project_id",
"service_tier": "service_tier",
"user_id": "user_id"
}
],
"start_time": 0
}
],
"has_more": true,
"next_page": "next_page",
"object": "page"
}
Moderations
admin.organization.usage.moderations(**kwargs) -> UsageModerationsResponse
get /organization/usage/moderations
Get moderations usage details for the organization.
Parameters
-
start_time: IntegerStart time (Unix seconds) of the query time range, inclusive.
-
api_key_ids: Array[String]Return only usage for these API keys.
-
bucket_width: :"1m" | :"1h" | :"1d"Width of each time bucket in response. Currently
1m,1hand1dare supported, default to1d.-
:"1m" -
:"1h" -
:"1d"
-
-
end_time: IntegerEnd time (Unix seconds) of the query time range, exclusive.
-
group_by: Array[:project_id | :user_id | :api_key_id | :model]Group the usage data by the specified fields. Support fields include
project_id,user_id,api_key_id,modelor any combination of them.-
:project_id -
:user_id -
:api_key_id -
:model
-
-
limit: IntegerSpecifies 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
-
models: Array[String]Return only usage for these models.
-
page: StringA cursor for use in pagination. Corresponding to the
next_pagefield from the previous response. -
project_ids: Array[String]Return only usage for these projects.
-
user_ids: Array[String]Return only usage for these users.
Returns
-
class UsageModerationsResponse-
data: Array[Data{ end_time, object, results, start_time}]-
end_time: Integer -
object: :bucket:bucket
-
results: Array[OrganizationUsageCompletionsResult{ input_tokens, num_model_requests, object, 10 more} | OrganizationUsageEmbeddingsResult{ input_tokens, num_model_requests, object, 4 more} | OrganizationUsageModerationsResult{ input_tokens, num_model_requests, object, 4 more} | 8 more]-
class OrganizationUsageCompletionsResultThe aggregated completions usage details of the specific time bucket.
-
input_tokens: IntegerThe aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.completions.result":"organization.usage.completions.result"
-
output_tokens: IntegerThe aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens.
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
batch: boolWhen
group_by=batch, this field tells whether the grouped usage result is batch or not. -
input_audio_tokens: IntegerThe aggregated number of audio input tokens used, including cached tokens.
-
input_cached_tokens: IntegerThe aggregated number of text input tokens that has been cached from previous requests. For customers subscribe to scale tier, this includes scale tier tokens.
-
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
output_audio_tokens: IntegerThe aggregated number of audio output tokens used.
-
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
service_tier: StringWhen
group_by=service_tier, this field provides the service tier of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageEmbeddingsResultThe aggregated embeddings usage details of the specific time bucket.
-
input_tokens: IntegerThe aggregated number of input tokens used.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.embeddings.result":"organization.usage.embeddings.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageModerationsResultThe aggregated moderations usage details of the specific time bucket.
-
input_tokens: IntegerThe aggregated number of input tokens used.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.moderations.result":"organization.usage.moderations.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageImagesResultThe aggregated images usage details of the specific time bucket.
-
images: IntegerThe number of images processed.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.images.result":"organization.usage.images.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
size: StringWhen
group_by=size, this field provides the image size of the grouped usage result. -
source: StringWhen
group_by=source, this field provides the source of the grouped usage result, possible values areimage.generation,image.edit,image.variation. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageAudioSpeechesResultThe aggregated audio speeches usage details of the specific time bucket.
-
characters: IntegerThe number of characters processed.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.audio_speeches.result":"organization.usage.audio_speeches.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageAudioTranscriptionsResultThe aggregated audio transcriptions usage details of the specific time bucket.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.audio_transcriptions.result":"organization.usage.audio_transcriptions.result"
-
seconds: IntegerThe number of seconds processed.
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageVectorStoresResultThe aggregated vector stores usage details of the specific time bucket.
-
object: :"organization.usage.vector_stores.result":"organization.usage.vector_stores.result"
-
usage_bytes: IntegerThe vector stores usage in bytes.
-
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
class OrganizationUsageCodeInterpreterSessionsResultThe aggregated code interpreter sessions usage details of the specific time bucket.
-
num_sessions: IntegerThe number of code interpreter sessions.
-
object: :"organization.usage.code_interpreter_sessions.result":"organization.usage.code_interpreter_sessions.result"
-
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
class OrganizationUsageFileSearchesResultThe aggregated file search calls usage details of the specific time bucket.
-
num_requests: IntegerThe count of file search calls.
-
object: :"organization.usage.file_searches.result":"organization.usage.file_searches.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result. -
vector_store_id: StringWhen
group_by=vector_store_id, this field provides the vector store ID of the grouped usage result.
-
-
class OrganizationUsageWebSearchesResultThe aggregated web search calls usage details of the specific time bucket.
-
num_model_requests: IntegerThe count of model requests.
-
num_requests: IntegerThe count of web search calls.
-
object: :"organization.usage.web_searches.result":"organization.usage.web_searches.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
context_level: StringWhen
group_by=context_level, this field provides the search context size of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationCostsResultThe aggregated costs details of the specific time bucket.
-
object: :"organization.costs.result":"organization.costs.result"
-
amount: Amount{ currency, value}The monetary value in its associated currency.
-
currency: StringLowercase ISO-4217 currency e.g. "usd"
-
value: FloatThe numeric value of the cost.
-
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API Key ID of the grouped costs result. -
line_item: StringWhen
group_by=line_item, this field provides the line item of the grouped costs result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped costs result. -
quantity: FloatWhen
group_by=line_item, this field provides the quantity of the grouped costs result.
-
-
-
start_time: Integer
-
-
has_more: bool -
next_page: String -
object: :page:page
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
response = openai.admin.organization.usage.moderations(start_time: 0)
puts(response)
Response
{
"data": [
{
"end_time": 0,
"object": "bucket",
"results": [
{
"input_tokens": 0,
"num_model_requests": 0,
"object": "organization.usage.completions.result",
"output_tokens": 0,
"api_key_id": "api_key_id",
"batch": true,
"input_audio_tokens": 0,
"input_cached_tokens": 0,
"model": "model",
"output_audio_tokens": 0,
"project_id": "project_id",
"service_tier": "service_tier",
"user_id": "user_id"
}
],
"start_time": 0
}
],
"has_more": true,
"next_page": "next_page",
"object": "page"
}
Vector stores
admin.organization.usage.vector_stores(**kwargs) -> UsageVectorStoresResponse
get /organization/usage/vector_stores
Get vector stores usage details for the organization.
Parameters
-
start_time: IntegerStart time (Unix seconds) of the query time range, inclusive.
-
bucket_width: :"1m" | :"1h" | :"1d"Width of each time bucket in response. Currently
1m,1hand1dare supported, default to1d.-
:"1m" -
:"1h" -
:"1d"
-
-
end_time: IntegerEnd time (Unix seconds) of the query time range, exclusive.
-
group_by: Array[:project_id]Group the usage data by the specified fields. Support fields include
project_id.:project_id
-
limit: IntegerSpecifies 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: StringA cursor for use in pagination. Corresponding to the
next_pagefield from the previous response. -
project_ids: Array[String]Return only usage for these projects.
Returns
-
class UsageVectorStoresResponse-
data: Array[Data{ end_time, object, results, start_time}]-
end_time: Integer -
object: :bucket:bucket
-
results: Array[OrganizationUsageCompletionsResult{ input_tokens, num_model_requests, object, 10 more} | OrganizationUsageEmbeddingsResult{ input_tokens, num_model_requests, object, 4 more} | OrganizationUsageModerationsResult{ input_tokens, num_model_requests, object, 4 more} | 8 more]-
class OrganizationUsageCompletionsResultThe aggregated completions usage details of the specific time bucket.
-
input_tokens: IntegerThe aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.completions.result":"organization.usage.completions.result"
-
output_tokens: IntegerThe aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens.
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
batch: boolWhen
group_by=batch, this field tells whether the grouped usage result is batch or not. -
input_audio_tokens: IntegerThe aggregated number of audio input tokens used, including cached tokens.
-
input_cached_tokens: IntegerThe aggregated number of text input tokens that has been cached from previous requests. For customers subscribe to scale tier, this includes scale tier tokens.
-
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
output_audio_tokens: IntegerThe aggregated number of audio output tokens used.
-
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
service_tier: StringWhen
group_by=service_tier, this field provides the service tier of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageEmbeddingsResultThe aggregated embeddings usage details of the specific time bucket.
-
input_tokens: IntegerThe aggregated number of input tokens used.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.embeddings.result":"organization.usage.embeddings.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageModerationsResultThe aggregated moderations usage details of the specific time bucket.
-
input_tokens: IntegerThe aggregated number of input tokens used.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.moderations.result":"organization.usage.moderations.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageImagesResultThe aggregated images usage details of the specific time bucket.
-
images: IntegerThe number of images processed.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.images.result":"organization.usage.images.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
size: StringWhen
group_by=size, this field provides the image size of the grouped usage result. -
source: StringWhen
group_by=source, this field provides the source of the grouped usage result, possible values areimage.generation,image.edit,image.variation. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageAudioSpeechesResultThe aggregated audio speeches usage details of the specific time bucket.
-
characters: IntegerThe number of characters processed.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.audio_speeches.result":"organization.usage.audio_speeches.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageAudioTranscriptionsResultThe aggregated audio transcriptions usage details of the specific time bucket.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.audio_transcriptions.result":"organization.usage.audio_transcriptions.result"
-
seconds: IntegerThe number of seconds processed.
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageVectorStoresResultThe aggregated vector stores usage details of the specific time bucket.
-
object: :"organization.usage.vector_stores.result":"organization.usage.vector_stores.result"
-
usage_bytes: IntegerThe vector stores usage in bytes.
-
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
class OrganizationUsageCodeInterpreterSessionsResultThe aggregated code interpreter sessions usage details of the specific time bucket.
-
num_sessions: IntegerThe number of code interpreter sessions.
-
object: :"organization.usage.code_interpreter_sessions.result":"organization.usage.code_interpreter_sessions.result"
-
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
class OrganizationUsageFileSearchesResultThe aggregated file search calls usage details of the specific time bucket.
-
num_requests: IntegerThe count of file search calls.
-
object: :"organization.usage.file_searches.result":"organization.usage.file_searches.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result. -
vector_store_id: StringWhen
group_by=vector_store_id, this field provides the vector store ID of the grouped usage result.
-
-
class OrganizationUsageWebSearchesResultThe aggregated web search calls usage details of the specific time bucket.
-
num_model_requests: IntegerThe count of model requests.
-
num_requests: IntegerThe count of web search calls.
-
object: :"organization.usage.web_searches.result":"organization.usage.web_searches.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
context_level: StringWhen
group_by=context_level, this field provides the search context size of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationCostsResultThe aggregated costs details of the specific time bucket.
-
object: :"organization.costs.result":"organization.costs.result"
-
amount: Amount{ currency, value}The monetary value in its associated currency.
-
currency: StringLowercase ISO-4217 currency e.g. "usd"
-
value: FloatThe numeric value of the cost.
-
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API Key ID of the grouped costs result. -
line_item: StringWhen
group_by=line_item, this field provides the line item of the grouped costs result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped costs result. -
quantity: FloatWhen
group_by=line_item, this field provides the quantity of the grouped costs result.
-
-
-
start_time: Integer
-
-
has_more: bool -
next_page: String -
object: :page:page
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
response = openai.admin.organization.usage.vector_stores(start_time: 0)
puts(response)
Response
{
"data": [
{
"end_time": 0,
"object": "bucket",
"results": [
{
"input_tokens": 0,
"num_model_requests": 0,
"object": "organization.usage.completions.result",
"output_tokens": 0,
"api_key_id": "api_key_id",
"batch": true,
"input_audio_tokens": 0,
"input_cached_tokens": 0,
"model": "model",
"output_audio_tokens": 0,
"project_id": "project_id",
"service_tier": "service_tier",
"user_id": "user_id"
}
],
"start_time": 0
}
],
"has_more": true,
"next_page": "next_page",
"object": "page"
}
File search calls
admin.organization.usage.file_search_calls(**kwargs) -> UsageFileSearchCallsResponse
get /organization/usage/file_search_calls
Get file search calls usage details for the organization.
Parameters
-
start_time: IntegerStart time (Unix seconds) of the query time range, inclusive.
-
api_key_ids: Array[String]Return only usage for these API keys.
-
bucket_width: :"1m" | :"1h" | :"1d"Width of each time bucket in response. Currently
1m,1hand1dare supported, default to1d.-
:"1m" -
:"1h" -
:"1d"
-
-
end_time: IntegerEnd time (Unix seconds) of the query time range, exclusive.
-
group_by: Array[:project_id | :user_id | :api_key_id | :vector_store_id]Group the usage data by the specified fields. Support fields include
project_id,user_id,api_key_id,vector_store_idor any combination of them.-
:project_id -
:user_id -
:api_key_id -
:vector_store_id
-
-
limit: IntegerSpecifies 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: StringA cursor for use in pagination. Corresponding to the
next_pagefield from the previous response. -
project_ids: Array[String]Return only usage for these projects.
-
user_ids: Array[String]Return only usage for these users.
-
vector_store_ids: Array[String]Return only usage for these vector stores.
Returns
-
class UsageFileSearchCallsResponse-
data: Array[Data{ end_time, object, results, start_time}]-
end_time: Integer -
object: :bucket:bucket
-
results: Array[OrganizationUsageCompletionsResult{ input_tokens, num_model_requests, object, 10 more} | OrganizationUsageEmbeddingsResult{ input_tokens, num_model_requests, object, 4 more} | OrganizationUsageModerationsResult{ input_tokens, num_model_requests, object, 4 more} | 8 more]-
class OrganizationUsageCompletionsResultThe aggregated completions usage details of the specific time bucket.
-
input_tokens: IntegerThe aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.completions.result":"organization.usage.completions.result"
-
output_tokens: IntegerThe aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens.
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
batch: boolWhen
group_by=batch, this field tells whether the grouped usage result is batch or not. -
input_audio_tokens: IntegerThe aggregated number of audio input tokens used, including cached tokens.
-
input_cached_tokens: IntegerThe aggregated number of text input tokens that has been cached from previous requests. For customers subscribe to scale tier, this includes scale tier tokens.
-
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
output_audio_tokens: IntegerThe aggregated number of audio output tokens used.
-
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
service_tier: StringWhen
group_by=service_tier, this field provides the service tier of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageEmbeddingsResultThe aggregated embeddings usage details of the specific time bucket.
-
input_tokens: IntegerThe aggregated number of input tokens used.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.embeddings.result":"organization.usage.embeddings.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageModerationsResultThe aggregated moderations usage details of the specific time bucket.
-
input_tokens: IntegerThe aggregated number of input tokens used.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.moderations.result":"organization.usage.moderations.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageImagesResultThe aggregated images usage details of the specific time bucket.
-
images: IntegerThe number of images processed.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.images.result":"organization.usage.images.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
size: StringWhen
group_by=size, this field provides the image size of the grouped usage result. -
source: StringWhen
group_by=source, this field provides the source of the grouped usage result, possible values areimage.generation,image.edit,image.variation. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageAudioSpeechesResultThe aggregated audio speeches usage details of the specific time bucket.
-
characters: IntegerThe number of characters processed.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.audio_speeches.result":"organization.usage.audio_speeches.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageAudioTranscriptionsResultThe aggregated audio transcriptions usage details of the specific time bucket.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.audio_transcriptions.result":"organization.usage.audio_transcriptions.result"
-
seconds: IntegerThe number of seconds processed.
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageVectorStoresResultThe aggregated vector stores usage details of the specific time bucket.
-
object: :"organization.usage.vector_stores.result":"organization.usage.vector_stores.result"
-
usage_bytes: IntegerThe vector stores usage in bytes.
-
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
class OrganizationUsageCodeInterpreterSessionsResultThe aggregated code interpreter sessions usage details of the specific time bucket.
-
num_sessions: IntegerThe number of code interpreter sessions.
-
object: :"organization.usage.code_interpreter_sessions.result":"organization.usage.code_interpreter_sessions.result"
-
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
class OrganizationUsageFileSearchesResultThe aggregated file search calls usage details of the specific time bucket.
-
num_requests: IntegerThe count of file search calls.
-
object: :"organization.usage.file_searches.result":"organization.usage.file_searches.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result. -
vector_store_id: StringWhen
group_by=vector_store_id, this field provides the vector store ID of the grouped usage result.
-
-
class OrganizationUsageWebSearchesResultThe aggregated web search calls usage details of the specific time bucket.
-
num_model_requests: IntegerThe count of model requests.
-
num_requests: IntegerThe count of web search calls.
-
object: :"organization.usage.web_searches.result":"organization.usage.web_searches.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
context_level: StringWhen
group_by=context_level, this field provides the search context size of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationCostsResultThe aggregated costs details of the specific time bucket.
-
object: :"organization.costs.result":"organization.costs.result"
-
amount: Amount{ currency, value}The monetary value in its associated currency.
-
currency: StringLowercase ISO-4217 currency e.g. "usd"
-
value: FloatThe numeric value of the cost.
-
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API Key ID of the grouped costs result. -
line_item: StringWhen
group_by=line_item, this field provides the line item of the grouped costs result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped costs result. -
quantity: FloatWhen
group_by=line_item, this field provides the quantity of the grouped costs result.
-
-
-
start_time: Integer
-
-
has_more: bool -
next_page: String -
object: :page:page
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
response = openai.admin.organization.usage.file_search_calls(start_time: 0)
puts(response)
Response
{
"data": [
{
"end_time": 0,
"object": "bucket",
"results": [
{
"input_tokens": 0,
"num_model_requests": 0,
"object": "organization.usage.completions.result",
"output_tokens": 0,
"api_key_id": "api_key_id",
"batch": true,
"input_audio_tokens": 0,
"input_cached_tokens": 0,
"model": "model",
"output_audio_tokens": 0,
"project_id": "project_id",
"service_tier": "service_tier",
"user_id": "user_id"
}
],
"start_time": 0
}
],
"has_more": true,
"next_page": "next_page",
"object": "page"
}
Web search calls
admin.organization.usage.web_search_calls(**kwargs) -> UsageWebSearchCallsResponse
get /organization/usage/web_search_calls
Get web search calls usage details for the organization.
Parameters
-
start_time: IntegerStart time (Unix seconds) of the query time range, inclusive.
-
api_key_ids: Array[String]Return only usage for these API keys.
-
bucket_width: :"1m" | :"1h" | :"1d"Width of each time bucket in response. Currently
1m,1hand1dare supported, default to1d.-
:"1m" -
:"1h" -
:"1d"
-
-
context_levels: Array[:low | :medium | :high]Return only web search usage for these context levels.
-
:low -
:medium -
:high
-
-
end_time: IntegerEnd time (Unix seconds) of the query time range, exclusive.
-
group_by: Array[:project_id | :user_id | :api_key_id | 2 more]Group the usage data by the specified fields. Support fields include
project_id,user_id,api_key_id,model,context_levelor any combination of them.-
:project_id -
:user_id -
:api_key_id -
:model -
:context_level
-
-
limit: IntegerSpecifies 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
-
models: Array[String]Return only usage for these models.
-
page: StringA cursor for use in pagination. Corresponding to the
next_pagefield from the previous response. -
project_ids: Array[String]Return only usage for these projects.
-
user_ids: Array[String]Return only usage for these users.
Returns
-
class UsageWebSearchCallsResponse-
data: Array[Data{ end_time, object, results, start_time}]-
end_time: Integer -
object: :bucket:bucket
-
results: Array[OrganizationUsageCompletionsResult{ input_tokens, num_model_requests, object, 10 more} | OrganizationUsageEmbeddingsResult{ input_tokens, num_model_requests, object, 4 more} | OrganizationUsageModerationsResult{ input_tokens, num_model_requests, object, 4 more} | 8 more]-
class OrganizationUsageCompletionsResultThe aggregated completions usage details of the specific time bucket.
-
input_tokens: IntegerThe aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.completions.result":"organization.usage.completions.result"
-
output_tokens: IntegerThe aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens.
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
batch: boolWhen
group_by=batch, this field tells whether the grouped usage result is batch or not. -
input_audio_tokens: IntegerThe aggregated number of audio input tokens used, including cached tokens.
-
input_cached_tokens: IntegerThe aggregated number of text input tokens that has been cached from previous requests. For customers subscribe to scale tier, this includes scale tier tokens.
-
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
output_audio_tokens: IntegerThe aggregated number of audio output tokens used.
-
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
service_tier: StringWhen
group_by=service_tier, this field provides the service tier of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageEmbeddingsResultThe aggregated embeddings usage details of the specific time bucket.
-
input_tokens: IntegerThe aggregated number of input tokens used.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.embeddings.result":"organization.usage.embeddings.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageModerationsResultThe aggregated moderations usage details of the specific time bucket.
-
input_tokens: IntegerThe aggregated number of input tokens used.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.moderations.result":"organization.usage.moderations.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageImagesResultThe aggregated images usage details of the specific time bucket.
-
images: IntegerThe number of images processed.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.images.result":"organization.usage.images.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
size: StringWhen
group_by=size, this field provides the image size of the grouped usage result. -
source: StringWhen
group_by=source, this field provides the source of the grouped usage result, possible values areimage.generation,image.edit,image.variation. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageAudioSpeechesResultThe aggregated audio speeches usage details of the specific time bucket.
-
characters: IntegerThe number of characters processed.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.audio_speeches.result":"organization.usage.audio_speeches.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageAudioTranscriptionsResultThe aggregated audio transcriptions usage details of the specific time bucket.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.audio_transcriptions.result":"organization.usage.audio_transcriptions.result"
-
seconds: IntegerThe number of seconds processed.
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageVectorStoresResultThe aggregated vector stores usage details of the specific time bucket.
-
object: :"organization.usage.vector_stores.result":"organization.usage.vector_stores.result"
-
usage_bytes: IntegerThe vector stores usage in bytes.
-
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
class OrganizationUsageCodeInterpreterSessionsResultThe aggregated code interpreter sessions usage details of the specific time bucket.
-
num_sessions: IntegerThe number of code interpreter sessions.
-
object: :"organization.usage.code_interpreter_sessions.result":"organization.usage.code_interpreter_sessions.result"
-
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
class OrganizationUsageFileSearchesResultThe aggregated file search calls usage details of the specific time bucket.
-
num_requests: IntegerThe count of file search calls.
-
object: :"organization.usage.file_searches.result":"organization.usage.file_searches.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result. -
vector_store_id: StringWhen
group_by=vector_store_id, this field provides the vector store ID of the grouped usage result.
-
-
class OrganizationUsageWebSearchesResultThe aggregated web search calls usage details of the specific time bucket.
-
num_model_requests: IntegerThe count of model requests.
-
num_requests: IntegerThe count of web search calls.
-
object: :"organization.usage.web_searches.result":"organization.usage.web_searches.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
context_level: StringWhen
group_by=context_level, this field provides the search context size of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationCostsResultThe aggregated costs details of the specific time bucket.
-
object: :"organization.costs.result":"organization.costs.result"
-
amount: Amount{ currency, value}The monetary value in its associated currency.
-
currency: StringLowercase ISO-4217 currency e.g. "usd"
-
value: FloatThe numeric value of the cost.
-
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API Key ID of the grouped costs result. -
line_item: StringWhen
group_by=line_item, this field provides the line item of the grouped costs result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped costs result. -
quantity: FloatWhen
group_by=line_item, this field provides the quantity of the grouped costs result.
-
-
-
start_time: Integer
-
-
has_more: bool -
next_page: String -
object: :page:page
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
response = openai.admin.organization.usage.web_search_calls(start_time: 0)
puts(response)
Response
{
"data": [
{
"end_time": 0,
"object": "bucket",
"results": [
{
"input_tokens": 0,
"num_model_requests": 0,
"object": "organization.usage.completions.result",
"output_tokens": 0,
"api_key_id": "api_key_id",
"batch": true,
"input_audio_tokens": 0,
"input_cached_tokens": 0,
"model": "model",
"output_audio_tokens": 0,
"project_id": "project_id",
"service_tier": "service_tier",
"user_id": "user_id"
}
],
"start_time": 0
}
],
"has_more": true,
"next_page": "next_page",
"object": "page"
}
Costs
admin.organization.usage.costs(**kwargs) -> UsageCostsResponse
get /organization/costs
Get costs details for the organization.
Parameters
-
start_time: IntegerStart time (Unix seconds) of the query time range, inclusive.
-
api_key_ids: Array[String]Return only costs for these API keys.
-
bucket_width: :"1d"Width of each time bucket in response. Currently only
1dis supported, default to1d.:"1d"
-
end_time: IntegerEnd time (Unix seconds) of the query time range, exclusive.
-
group_by: Array[:project_id | :line_item | :api_key_id]Group the costs by the specified fields. Support fields include
project_id,line_item,api_key_idand any combination of them.-
:project_id -
:line_item -
:api_key_id
-
-
limit: IntegerA limit on the number of buckets to be returned. Limit can range between 1 and 180, and the default is 7.
-
page: StringA cursor for use in pagination. Corresponding to the
next_pagefield from the previous response. -
project_ids: Array[String]Return only costs for these projects.
Returns
-
class UsageCostsResponse-
data: Array[Data{ end_time, object, results, start_time}]-
end_time: Integer -
object: :bucket:bucket
-
results: Array[OrganizationUsageCompletionsResult{ input_tokens, num_model_requests, object, 10 more} | OrganizationUsageEmbeddingsResult{ input_tokens, num_model_requests, object, 4 more} | OrganizationUsageModerationsResult{ input_tokens, num_model_requests, object, 4 more} | 8 more]-
class OrganizationUsageCompletionsResultThe aggregated completions usage details of the specific time bucket.
-
input_tokens: IntegerThe aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.completions.result":"organization.usage.completions.result"
-
output_tokens: IntegerThe aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens.
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
batch: boolWhen
group_by=batch, this field tells whether the grouped usage result is batch or not. -
input_audio_tokens: IntegerThe aggregated number of audio input tokens used, including cached tokens.
-
input_cached_tokens: IntegerThe aggregated number of text input tokens that has been cached from previous requests. For customers subscribe to scale tier, this includes scale tier tokens.
-
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
output_audio_tokens: IntegerThe aggregated number of audio output tokens used.
-
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
service_tier: StringWhen
group_by=service_tier, this field provides the service tier of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageEmbeddingsResultThe aggregated embeddings usage details of the specific time bucket.
-
input_tokens: IntegerThe aggregated number of input tokens used.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.embeddings.result":"organization.usage.embeddings.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageModerationsResultThe aggregated moderations usage details of the specific time bucket.
-
input_tokens: IntegerThe aggregated number of input tokens used.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.moderations.result":"organization.usage.moderations.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageImagesResultThe aggregated images usage details of the specific time bucket.
-
images: IntegerThe number of images processed.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.images.result":"organization.usage.images.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
size: StringWhen
group_by=size, this field provides the image size of the grouped usage result. -
source: StringWhen
group_by=source, this field provides the source of the grouped usage result, possible values areimage.generation,image.edit,image.variation. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageAudioSpeechesResultThe aggregated audio speeches usage details of the specific time bucket.
-
characters: IntegerThe number of characters processed.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.audio_speeches.result":"organization.usage.audio_speeches.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageAudioTranscriptionsResultThe aggregated audio transcriptions usage details of the specific time bucket.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.audio_transcriptions.result":"organization.usage.audio_transcriptions.result"
-
seconds: IntegerThe number of seconds processed.
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageVectorStoresResultThe aggregated vector stores usage details of the specific time bucket.
-
object: :"organization.usage.vector_stores.result":"organization.usage.vector_stores.result"
-
usage_bytes: IntegerThe vector stores usage in bytes.
-
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
class OrganizationUsageCodeInterpreterSessionsResultThe aggregated code interpreter sessions usage details of the specific time bucket.
-
num_sessions: IntegerThe number of code interpreter sessions.
-
object: :"organization.usage.code_interpreter_sessions.result":"organization.usage.code_interpreter_sessions.result"
-
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
class OrganizationUsageFileSearchesResultThe aggregated file search calls usage details of the specific time bucket.
-
num_requests: IntegerThe count of file search calls.
-
object: :"organization.usage.file_searches.result":"organization.usage.file_searches.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result. -
vector_store_id: StringWhen
group_by=vector_store_id, this field provides the vector store ID of the grouped usage result.
-
-
class OrganizationUsageWebSearchesResultThe aggregated web search calls usage details of the specific time bucket.
-
num_model_requests: IntegerThe count of model requests.
-
num_requests: IntegerThe count of web search calls.
-
object: :"organization.usage.web_searches.result":"organization.usage.web_searches.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
context_level: StringWhen
group_by=context_level, this field provides the search context size of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationCostsResultThe aggregated costs details of the specific time bucket.
-
object: :"organization.costs.result":"organization.costs.result"
-
amount: Amount{ currency, value}The monetary value in its associated currency.
-
currency: StringLowercase ISO-4217 currency e.g. "usd"
-
value: FloatThe numeric value of the cost.
-
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API Key ID of the grouped costs result. -
line_item: StringWhen
group_by=line_item, this field provides the line item of the grouped costs result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped costs result. -
quantity: FloatWhen
group_by=line_item, this field provides the quantity of the grouped costs result.
-
-
-
start_time: Integer
-
-
has_more: bool -
next_page: String -
object: :page:page
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
response = openai.admin.organization.usage.costs(start_time: 0)
puts(response)
Response
{
"data": [
{
"end_time": 0,
"object": "bucket",
"results": [
{
"input_tokens": 0,
"num_model_requests": 0,
"object": "organization.usage.completions.result",
"output_tokens": 0,
"api_key_id": "api_key_id",
"batch": true,
"input_audio_tokens": 0,
"input_cached_tokens": 0,
"model": "model",
"output_audio_tokens": 0,
"project_id": "project_id",
"service_tier": "service_tier",
"user_id": "user_id"
}
],
"start_time": 0
}
],
"has_more": true,
"next_page": "next_page",
"object": "page"
}
Domain Types
Usage Audio Speeches Response
-
class UsageAudioSpeechesResponse-
data: Array[Data{ end_time, object, results, start_time}]-
end_time: Integer -
object: :bucket:bucket
-
results: Array[OrganizationUsageCompletionsResult{ input_tokens, num_model_requests, object, 10 more} | OrganizationUsageEmbeddingsResult{ input_tokens, num_model_requests, object, 4 more} | OrganizationUsageModerationsResult{ input_tokens, num_model_requests, object, 4 more} | 8 more]-
class OrganizationUsageCompletionsResultThe aggregated completions usage details of the specific time bucket.
-
input_tokens: IntegerThe aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.completions.result":"organization.usage.completions.result"
-
output_tokens: IntegerThe aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens.
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
batch: boolWhen
group_by=batch, this field tells whether the grouped usage result is batch or not. -
input_audio_tokens: IntegerThe aggregated number of audio input tokens used, including cached tokens.
-
input_cached_tokens: IntegerThe aggregated number of text input tokens that has been cached from previous requests. For customers subscribe to scale tier, this includes scale tier tokens.
-
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
output_audio_tokens: IntegerThe aggregated number of audio output tokens used.
-
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
service_tier: StringWhen
group_by=service_tier, this field provides the service tier of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageEmbeddingsResultThe aggregated embeddings usage details of the specific time bucket.
-
input_tokens: IntegerThe aggregated number of input tokens used.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.embeddings.result":"organization.usage.embeddings.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageModerationsResultThe aggregated moderations usage details of the specific time bucket.
-
input_tokens: IntegerThe aggregated number of input tokens used.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.moderations.result":"organization.usage.moderations.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageImagesResultThe aggregated images usage details of the specific time bucket.
-
images: IntegerThe number of images processed.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.images.result":"organization.usage.images.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
size: StringWhen
group_by=size, this field provides the image size of the grouped usage result. -
source: StringWhen
group_by=source, this field provides the source of the grouped usage result, possible values areimage.generation,image.edit,image.variation. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageAudioSpeechesResultThe aggregated audio speeches usage details of the specific time bucket.
-
characters: IntegerThe number of characters processed.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.audio_speeches.result":"organization.usage.audio_speeches.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageAudioTranscriptionsResultThe aggregated audio transcriptions usage details of the specific time bucket.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.audio_transcriptions.result":"organization.usage.audio_transcriptions.result"
-
seconds: IntegerThe number of seconds processed.
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageVectorStoresResultThe aggregated vector stores usage details of the specific time bucket.
-
object: :"organization.usage.vector_stores.result":"organization.usage.vector_stores.result"
-
usage_bytes: IntegerThe vector stores usage in bytes.
-
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
class OrganizationUsageCodeInterpreterSessionsResultThe aggregated code interpreter sessions usage details of the specific time bucket.
-
num_sessions: IntegerThe number of code interpreter sessions.
-
object: :"organization.usage.code_interpreter_sessions.result":"organization.usage.code_interpreter_sessions.result"
-
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
class OrganizationUsageFileSearchesResultThe aggregated file search calls usage details of the specific time bucket.
-
num_requests: IntegerThe count of file search calls.
-
object: :"organization.usage.file_searches.result":"organization.usage.file_searches.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result. -
vector_store_id: StringWhen
group_by=vector_store_id, this field provides the vector store ID of the grouped usage result.
-
-
class OrganizationUsageWebSearchesResultThe aggregated web search calls usage details of the specific time bucket.
-
num_model_requests: IntegerThe count of model requests.
-
num_requests: IntegerThe count of web search calls.
-
object: :"organization.usage.web_searches.result":"organization.usage.web_searches.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
context_level: StringWhen
group_by=context_level, this field provides the search context size of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationCostsResultThe aggregated costs details of the specific time bucket.
-
object: :"organization.costs.result":"organization.costs.result"
-
amount: Amount{ currency, value}The monetary value in its associated currency.
-
currency: StringLowercase ISO-4217 currency e.g. "usd"
-
value: FloatThe numeric value of the cost.
-
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API Key ID of the grouped costs result. -
line_item: StringWhen
group_by=line_item, this field provides the line item of the grouped costs result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped costs result. -
quantity: FloatWhen
group_by=line_item, this field provides the quantity of the grouped costs result.
-
-
-
start_time: Integer
-
-
has_more: bool -
next_page: String -
object: :page:page
-
Usage Audio Transcriptions Response
-
class UsageAudioTranscriptionsResponse-
data: Array[Data{ end_time, object, results, start_time}]-
end_time: Integer -
object: :bucket:bucket
-
results: Array[OrganizationUsageCompletionsResult{ input_tokens, num_model_requests, object, 10 more} | OrganizationUsageEmbeddingsResult{ input_tokens, num_model_requests, object, 4 more} | OrganizationUsageModerationsResult{ input_tokens, num_model_requests, object, 4 more} | 8 more]-
class OrganizationUsageCompletionsResultThe aggregated completions usage details of the specific time bucket.
-
input_tokens: IntegerThe aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.completions.result":"organization.usage.completions.result"
-
output_tokens: IntegerThe aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens.
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
batch: boolWhen
group_by=batch, this field tells whether the grouped usage result is batch or not. -
input_audio_tokens: IntegerThe aggregated number of audio input tokens used, including cached tokens.
-
input_cached_tokens: IntegerThe aggregated number of text input tokens that has been cached from previous requests. For customers subscribe to scale tier, this includes scale tier tokens.
-
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
output_audio_tokens: IntegerThe aggregated number of audio output tokens used.
-
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
service_tier: StringWhen
group_by=service_tier, this field provides the service tier of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageEmbeddingsResultThe aggregated embeddings usage details of the specific time bucket.
-
input_tokens: IntegerThe aggregated number of input tokens used.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.embeddings.result":"organization.usage.embeddings.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageModerationsResultThe aggregated moderations usage details of the specific time bucket.
-
input_tokens: IntegerThe aggregated number of input tokens used.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.moderations.result":"organization.usage.moderations.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageImagesResultThe aggregated images usage details of the specific time bucket.
-
images: IntegerThe number of images processed.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.images.result":"organization.usage.images.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
size: StringWhen
group_by=size, this field provides the image size of the grouped usage result. -
source: StringWhen
group_by=source, this field provides the source of the grouped usage result, possible values areimage.generation,image.edit,image.variation. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageAudioSpeechesResultThe aggregated audio speeches usage details of the specific time bucket.
-
characters: IntegerThe number of characters processed.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.audio_speeches.result":"organization.usage.audio_speeches.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageAudioTranscriptionsResultThe aggregated audio transcriptions usage details of the specific time bucket.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.audio_transcriptions.result":"organization.usage.audio_transcriptions.result"
-
seconds: IntegerThe number of seconds processed.
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageVectorStoresResultThe aggregated vector stores usage details of the specific time bucket.
-
object: :"organization.usage.vector_stores.result":"organization.usage.vector_stores.result"
-
usage_bytes: IntegerThe vector stores usage in bytes.
-
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
class OrganizationUsageCodeInterpreterSessionsResultThe aggregated code interpreter sessions usage details of the specific time bucket.
-
num_sessions: IntegerThe number of code interpreter sessions.
-
object: :"organization.usage.code_interpreter_sessions.result":"organization.usage.code_interpreter_sessions.result"
-
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
class OrganizationUsageFileSearchesResultThe aggregated file search calls usage details of the specific time bucket.
-
num_requests: IntegerThe count of file search calls.
-
object: :"organization.usage.file_searches.result":"organization.usage.file_searches.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result. -
vector_store_id: StringWhen
group_by=vector_store_id, this field provides the vector store ID of the grouped usage result.
-
-
class OrganizationUsageWebSearchesResultThe aggregated web search calls usage details of the specific time bucket.
-
num_model_requests: IntegerThe count of model requests.
-
num_requests: IntegerThe count of web search calls.
-
object: :"organization.usage.web_searches.result":"organization.usage.web_searches.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
context_level: StringWhen
group_by=context_level, this field provides the search context size of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationCostsResultThe aggregated costs details of the specific time bucket.
-
object: :"organization.costs.result":"organization.costs.result"
-
amount: Amount{ currency, value}The monetary value in its associated currency.
-
currency: StringLowercase ISO-4217 currency e.g. "usd"
-
value: FloatThe numeric value of the cost.
-
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API Key ID of the grouped costs result. -
line_item: StringWhen
group_by=line_item, this field provides the line item of the grouped costs result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped costs result. -
quantity: FloatWhen
group_by=line_item, this field provides the quantity of the grouped costs result.
-
-
-
start_time: Integer
-
-
has_more: bool -
next_page: String -
object: :page:page
-
Usage Code Interpreter Sessions Response
-
class UsageCodeInterpreterSessionsResponse-
data: Array[Data{ end_time, object, results, start_time}]-
end_time: Integer -
object: :bucket:bucket
-
results: Array[OrganizationUsageCompletionsResult{ input_tokens, num_model_requests, object, 10 more} | OrganizationUsageEmbeddingsResult{ input_tokens, num_model_requests, object, 4 more} | OrganizationUsageModerationsResult{ input_tokens, num_model_requests, object, 4 more} | 8 more]-
class OrganizationUsageCompletionsResultThe aggregated completions usage details of the specific time bucket.
-
input_tokens: IntegerThe aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.completions.result":"organization.usage.completions.result"
-
output_tokens: IntegerThe aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens.
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
batch: boolWhen
group_by=batch, this field tells whether the grouped usage result is batch or not. -
input_audio_tokens: IntegerThe aggregated number of audio input tokens used, including cached tokens.
-
input_cached_tokens: IntegerThe aggregated number of text input tokens that has been cached from previous requests. For customers subscribe to scale tier, this includes scale tier tokens.
-
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
output_audio_tokens: IntegerThe aggregated number of audio output tokens used.
-
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
service_tier: StringWhen
group_by=service_tier, this field provides the service tier of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageEmbeddingsResultThe aggregated embeddings usage details of the specific time bucket.
-
input_tokens: IntegerThe aggregated number of input tokens used.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.embeddings.result":"organization.usage.embeddings.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageModerationsResultThe aggregated moderations usage details of the specific time bucket.
-
input_tokens: IntegerThe aggregated number of input tokens used.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.moderations.result":"organization.usage.moderations.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageImagesResultThe aggregated images usage details of the specific time bucket.
-
images: IntegerThe number of images processed.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.images.result":"organization.usage.images.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
size: StringWhen
group_by=size, this field provides the image size of the grouped usage result. -
source: StringWhen
group_by=source, this field provides the source of the grouped usage result, possible values areimage.generation,image.edit,image.variation. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageAudioSpeechesResultThe aggregated audio speeches usage details of the specific time bucket.
-
characters: IntegerThe number of characters processed.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.audio_speeches.result":"organization.usage.audio_speeches.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageAudioTranscriptionsResultThe aggregated audio transcriptions usage details of the specific time bucket.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.audio_transcriptions.result":"organization.usage.audio_transcriptions.result"
-
seconds: IntegerThe number of seconds processed.
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageVectorStoresResultThe aggregated vector stores usage details of the specific time bucket.
-
object: :"organization.usage.vector_stores.result":"organization.usage.vector_stores.result"
-
usage_bytes: IntegerThe vector stores usage in bytes.
-
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
class OrganizationUsageCodeInterpreterSessionsResultThe aggregated code interpreter sessions usage details of the specific time bucket.
-
num_sessions: IntegerThe number of code interpreter sessions.
-
object: :"organization.usage.code_interpreter_sessions.result":"organization.usage.code_interpreter_sessions.result"
-
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
class OrganizationUsageFileSearchesResultThe aggregated file search calls usage details of the specific time bucket.
-
num_requests: IntegerThe count of file search calls.
-
object: :"organization.usage.file_searches.result":"organization.usage.file_searches.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result. -
vector_store_id: StringWhen
group_by=vector_store_id, this field provides the vector store ID of the grouped usage result.
-
-
class OrganizationUsageWebSearchesResultThe aggregated web search calls usage details of the specific time bucket.
-
num_model_requests: IntegerThe count of model requests.
-
num_requests: IntegerThe count of web search calls.
-
object: :"organization.usage.web_searches.result":"organization.usage.web_searches.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
context_level: StringWhen
group_by=context_level, this field provides the search context size of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationCostsResultThe aggregated costs details of the specific time bucket.
-
object: :"organization.costs.result":"organization.costs.result"
-
amount: Amount{ currency, value}The monetary value in its associated currency.
-
currency: StringLowercase ISO-4217 currency e.g. "usd"
-
value: FloatThe numeric value of the cost.
-
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API Key ID of the grouped costs result. -
line_item: StringWhen
group_by=line_item, this field provides the line item of the grouped costs result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped costs result. -
quantity: FloatWhen
group_by=line_item, this field provides the quantity of the grouped costs result.
-
-
-
start_time: Integer
-
-
has_more: bool -
next_page: String -
object: :page:page
-
Usage Completions Response
-
class UsageCompletionsResponse-
data: Array[Data{ end_time, object, results, start_time}]-
end_time: Integer -
object: :bucket:bucket
-
results: Array[OrganizationUsageCompletionsResult{ input_tokens, num_model_requests, object, 10 more} | OrganizationUsageEmbeddingsResult{ input_tokens, num_model_requests, object, 4 more} | OrganizationUsageModerationsResult{ input_tokens, num_model_requests, object, 4 more} | 8 more]-
class OrganizationUsageCompletionsResultThe aggregated completions usage details of the specific time bucket.
-
input_tokens: IntegerThe aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.completions.result":"organization.usage.completions.result"
-
output_tokens: IntegerThe aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens.
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
batch: boolWhen
group_by=batch, this field tells whether the grouped usage result is batch or not. -
input_audio_tokens: IntegerThe aggregated number of audio input tokens used, including cached tokens.
-
input_cached_tokens: IntegerThe aggregated number of text input tokens that has been cached from previous requests. For customers subscribe to scale tier, this includes scale tier tokens.
-
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
output_audio_tokens: IntegerThe aggregated number of audio output tokens used.
-
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
service_tier: StringWhen
group_by=service_tier, this field provides the service tier of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageEmbeddingsResultThe aggregated embeddings usage details of the specific time bucket.
-
input_tokens: IntegerThe aggregated number of input tokens used.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.embeddings.result":"organization.usage.embeddings.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageModerationsResultThe aggregated moderations usage details of the specific time bucket.
-
input_tokens: IntegerThe aggregated number of input tokens used.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.moderations.result":"organization.usage.moderations.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageImagesResultThe aggregated images usage details of the specific time bucket.
-
images: IntegerThe number of images processed.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.images.result":"organization.usage.images.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
size: StringWhen
group_by=size, this field provides the image size of the grouped usage result. -
source: StringWhen
group_by=source, this field provides the source of the grouped usage result, possible values areimage.generation,image.edit,image.variation. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageAudioSpeechesResultThe aggregated audio speeches usage details of the specific time bucket.
-
characters: IntegerThe number of characters processed.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.audio_speeches.result":"organization.usage.audio_speeches.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageAudioTranscriptionsResultThe aggregated audio transcriptions usage details of the specific time bucket.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.audio_transcriptions.result":"organization.usage.audio_transcriptions.result"
-
seconds: IntegerThe number of seconds processed.
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageVectorStoresResultThe aggregated vector stores usage details of the specific time bucket.
-
object: :"organization.usage.vector_stores.result":"organization.usage.vector_stores.result"
-
usage_bytes: IntegerThe vector stores usage in bytes.
-
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
class OrganizationUsageCodeInterpreterSessionsResultThe aggregated code interpreter sessions usage details of the specific time bucket.
-
num_sessions: IntegerThe number of code interpreter sessions.
-
object: :"organization.usage.code_interpreter_sessions.result":"organization.usage.code_interpreter_sessions.result"
-
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
class OrganizationUsageFileSearchesResultThe aggregated file search calls usage details of the specific time bucket.
-
num_requests: IntegerThe count of file search calls.
-
object: :"organization.usage.file_searches.result":"organization.usage.file_searches.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result. -
vector_store_id: StringWhen
group_by=vector_store_id, this field provides the vector store ID of the grouped usage result.
-
-
class OrganizationUsageWebSearchesResultThe aggregated web search calls usage details of the specific time bucket.
-
num_model_requests: IntegerThe count of model requests.
-
num_requests: IntegerThe count of web search calls.
-
object: :"organization.usage.web_searches.result":"organization.usage.web_searches.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
context_level: StringWhen
group_by=context_level, this field provides the search context size of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationCostsResultThe aggregated costs details of the specific time bucket.
-
object: :"organization.costs.result":"organization.costs.result"
-
amount: Amount{ currency, value}The monetary value in its associated currency.
-
currency: StringLowercase ISO-4217 currency e.g. "usd"
-
value: FloatThe numeric value of the cost.
-
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API Key ID of the grouped costs result. -
line_item: StringWhen
group_by=line_item, this field provides the line item of the grouped costs result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped costs result. -
quantity: FloatWhen
group_by=line_item, this field provides the quantity of the grouped costs result.
-
-
-
start_time: Integer
-
-
has_more: bool -
next_page: String -
object: :page:page
-
Usage Embeddings Response
-
class UsageEmbeddingsResponse-
data: Array[Data{ end_time, object, results, start_time}]-
end_time: Integer -
object: :bucket:bucket
-
results: Array[OrganizationUsageCompletionsResult{ input_tokens, num_model_requests, object, 10 more} | OrganizationUsageEmbeddingsResult{ input_tokens, num_model_requests, object, 4 more} | OrganizationUsageModerationsResult{ input_tokens, num_model_requests, object, 4 more} | 8 more]-
class OrganizationUsageCompletionsResultThe aggregated completions usage details of the specific time bucket.
-
input_tokens: IntegerThe aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.completions.result":"organization.usage.completions.result"
-
output_tokens: IntegerThe aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens.
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
batch: boolWhen
group_by=batch, this field tells whether the grouped usage result is batch or not. -
input_audio_tokens: IntegerThe aggregated number of audio input tokens used, including cached tokens.
-
input_cached_tokens: IntegerThe aggregated number of text input tokens that has been cached from previous requests. For customers subscribe to scale tier, this includes scale tier tokens.
-
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
output_audio_tokens: IntegerThe aggregated number of audio output tokens used.
-
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
service_tier: StringWhen
group_by=service_tier, this field provides the service tier of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageEmbeddingsResultThe aggregated embeddings usage details of the specific time bucket.
-
input_tokens: IntegerThe aggregated number of input tokens used.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.embeddings.result":"organization.usage.embeddings.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageModerationsResultThe aggregated moderations usage details of the specific time bucket.
-
input_tokens: IntegerThe aggregated number of input tokens used.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.moderations.result":"organization.usage.moderations.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageImagesResultThe aggregated images usage details of the specific time bucket.
-
images: IntegerThe number of images processed.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.images.result":"organization.usage.images.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
size: StringWhen
group_by=size, this field provides the image size of the grouped usage result. -
source: StringWhen
group_by=source, this field provides the source of the grouped usage result, possible values areimage.generation,image.edit,image.variation. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageAudioSpeechesResultThe aggregated audio speeches usage details of the specific time bucket.
-
characters: IntegerThe number of characters processed.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.audio_speeches.result":"organization.usage.audio_speeches.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageAudioTranscriptionsResultThe aggregated audio transcriptions usage details of the specific time bucket.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.audio_transcriptions.result":"organization.usage.audio_transcriptions.result"
-
seconds: IntegerThe number of seconds processed.
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageVectorStoresResultThe aggregated vector stores usage details of the specific time bucket.
-
object: :"organization.usage.vector_stores.result":"organization.usage.vector_stores.result"
-
usage_bytes: IntegerThe vector stores usage in bytes.
-
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
class OrganizationUsageCodeInterpreterSessionsResultThe aggregated code interpreter sessions usage details of the specific time bucket.
-
num_sessions: IntegerThe number of code interpreter sessions.
-
object: :"organization.usage.code_interpreter_sessions.result":"organization.usage.code_interpreter_sessions.result"
-
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
class OrganizationUsageFileSearchesResultThe aggregated file search calls usage details of the specific time bucket.
-
num_requests: IntegerThe count of file search calls.
-
object: :"organization.usage.file_searches.result":"organization.usage.file_searches.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result. -
vector_store_id: StringWhen
group_by=vector_store_id, this field provides the vector store ID of the grouped usage result.
-
-
class OrganizationUsageWebSearchesResultThe aggregated web search calls usage details of the specific time bucket.
-
num_model_requests: IntegerThe count of model requests.
-
num_requests: IntegerThe count of web search calls.
-
object: :"organization.usage.web_searches.result":"organization.usage.web_searches.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
context_level: StringWhen
group_by=context_level, this field provides the search context size of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationCostsResultThe aggregated costs details of the specific time bucket.
-
object: :"organization.costs.result":"organization.costs.result"
-
amount: Amount{ currency, value}The monetary value in its associated currency.
-
currency: StringLowercase ISO-4217 currency e.g. "usd"
-
value: FloatThe numeric value of the cost.
-
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API Key ID of the grouped costs result. -
line_item: StringWhen
group_by=line_item, this field provides the line item of the grouped costs result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped costs result. -
quantity: FloatWhen
group_by=line_item, this field provides the quantity of the grouped costs result.
-
-
-
start_time: Integer
-
-
has_more: bool -
next_page: String -
object: :page:page
-
Usage Images Response
-
class UsageImagesResponse-
data: Array[Data{ end_time, object, results, start_time}]-
end_time: Integer -
object: :bucket:bucket
-
results: Array[OrganizationUsageCompletionsResult{ input_tokens, num_model_requests, object, 10 more} | OrganizationUsageEmbeddingsResult{ input_tokens, num_model_requests, object, 4 more} | OrganizationUsageModerationsResult{ input_tokens, num_model_requests, object, 4 more} | 8 more]-
class OrganizationUsageCompletionsResultThe aggregated completions usage details of the specific time bucket.
-
input_tokens: IntegerThe aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.completions.result":"organization.usage.completions.result"
-
output_tokens: IntegerThe aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens.
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
batch: boolWhen
group_by=batch, this field tells whether the grouped usage result is batch or not. -
input_audio_tokens: IntegerThe aggregated number of audio input tokens used, including cached tokens.
-
input_cached_tokens: IntegerThe aggregated number of text input tokens that has been cached from previous requests. For customers subscribe to scale tier, this includes scale tier tokens.
-
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
output_audio_tokens: IntegerThe aggregated number of audio output tokens used.
-
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
service_tier: StringWhen
group_by=service_tier, this field provides the service tier of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageEmbeddingsResultThe aggregated embeddings usage details of the specific time bucket.
-
input_tokens: IntegerThe aggregated number of input tokens used.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.embeddings.result":"organization.usage.embeddings.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageModerationsResultThe aggregated moderations usage details of the specific time bucket.
-
input_tokens: IntegerThe aggregated number of input tokens used.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.moderations.result":"organization.usage.moderations.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageImagesResultThe aggregated images usage details of the specific time bucket.
-
images: IntegerThe number of images processed.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.images.result":"organization.usage.images.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
size: StringWhen
group_by=size, this field provides the image size of the grouped usage result. -
source: StringWhen
group_by=source, this field provides the source of the grouped usage result, possible values areimage.generation,image.edit,image.variation. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageAudioSpeechesResultThe aggregated audio speeches usage details of the specific time bucket.
-
characters: IntegerThe number of characters processed.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.audio_speeches.result":"organization.usage.audio_speeches.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageAudioTranscriptionsResultThe aggregated audio transcriptions usage details of the specific time bucket.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.audio_transcriptions.result":"organization.usage.audio_transcriptions.result"
-
seconds: IntegerThe number of seconds processed.
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageVectorStoresResultThe aggregated vector stores usage details of the specific time bucket.
-
object: :"organization.usage.vector_stores.result":"organization.usage.vector_stores.result"
-
usage_bytes: IntegerThe vector stores usage in bytes.
-
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
class OrganizationUsageCodeInterpreterSessionsResultThe aggregated code interpreter sessions usage details of the specific time bucket.
-
num_sessions: IntegerThe number of code interpreter sessions.
-
object: :"organization.usage.code_interpreter_sessions.result":"organization.usage.code_interpreter_sessions.result"
-
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
class OrganizationUsageFileSearchesResultThe aggregated file search calls usage details of the specific time bucket.
-
num_requests: IntegerThe count of file search calls.
-
object: :"organization.usage.file_searches.result":"organization.usage.file_searches.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result. -
vector_store_id: StringWhen
group_by=vector_store_id, this field provides the vector store ID of the grouped usage result.
-
-
class OrganizationUsageWebSearchesResultThe aggregated web search calls usage details of the specific time bucket.
-
num_model_requests: IntegerThe count of model requests.
-
num_requests: IntegerThe count of web search calls.
-
object: :"organization.usage.web_searches.result":"organization.usage.web_searches.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
context_level: StringWhen
group_by=context_level, this field provides the search context size of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationCostsResultThe aggregated costs details of the specific time bucket.
-
object: :"organization.costs.result":"organization.costs.result"
-
amount: Amount{ currency, value}The monetary value in its associated currency.
-
currency: StringLowercase ISO-4217 currency e.g. "usd"
-
value: FloatThe numeric value of the cost.
-
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API Key ID of the grouped costs result. -
line_item: StringWhen
group_by=line_item, this field provides the line item of the grouped costs result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped costs result. -
quantity: FloatWhen
group_by=line_item, this field provides the quantity of the grouped costs result.
-
-
-
start_time: Integer
-
-
has_more: bool -
next_page: String -
object: :page:page
-
Usage Moderations Response
-
class UsageModerationsResponse-
data: Array[Data{ end_time, object, results, start_time}]-
end_time: Integer -
object: :bucket:bucket
-
results: Array[OrganizationUsageCompletionsResult{ input_tokens, num_model_requests, object, 10 more} | OrganizationUsageEmbeddingsResult{ input_tokens, num_model_requests, object, 4 more} | OrganizationUsageModerationsResult{ input_tokens, num_model_requests, object, 4 more} | 8 more]-
class OrganizationUsageCompletionsResultThe aggregated completions usage details of the specific time bucket.
-
input_tokens: IntegerThe aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.completions.result":"organization.usage.completions.result"
-
output_tokens: IntegerThe aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens.
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
batch: boolWhen
group_by=batch, this field tells whether the grouped usage result is batch or not. -
input_audio_tokens: IntegerThe aggregated number of audio input tokens used, including cached tokens.
-
input_cached_tokens: IntegerThe aggregated number of text input tokens that has been cached from previous requests. For customers subscribe to scale tier, this includes scale tier tokens.
-
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
output_audio_tokens: IntegerThe aggregated number of audio output tokens used.
-
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
service_tier: StringWhen
group_by=service_tier, this field provides the service tier of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageEmbeddingsResultThe aggregated embeddings usage details of the specific time bucket.
-
input_tokens: IntegerThe aggregated number of input tokens used.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.embeddings.result":"organization.usage.embeddings.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageModerationsResultThe aggregated moderations usage details of the specific time bucket.
-
input_tokens: IntegerThe aggregated number of input tokens used.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.moderations.result":"organization.usage.moderations.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageImagesResultThe aggregated images usage details of the specific time bucket.
-
images: IntegerThe number of images processed.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.images.result":"organization.usage.images.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
size: StringWhen
group_by=size, this field provides the image size of the grouped usage result. -
source: StringWhen
group_by=source, this field provides the source of the grouped usage result, possible values areimage.generation,image.edit,image.variation. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageAudioSpeechesResultThe aggregated audio speeches usage details of the specific time bucket.
-
characters: IntegerThe number of characters processed.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.audio_speeches.result":"organization.usage.audio_speeches.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageAudioTranscriptionsResultThe aggregated audio transcriptions usage details of the specific time bucket.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.audio_transcriptions.result":"organization.usage.audio_transcriptions.result"
-
seconds: IntegerThe number of seconds processed.
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageVectorStoresResultThe aggregated vector stores usage details of the specific time bucket.
-
object: :"organization.usage.vector_stores.result":"organization.usage.vector_stores.result"
-
usage_bytes: IntegerThe vector stores usage in bytes.
-
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
class OrganizationUsageCodeInterpreterSessionsResultThe aggregated code interpreter sessions usage details of the specific time bucket.
-
num_sessions: IntegerThe number of code interpreter sessions.
-
object: :"organization.usage.code_interpreter_sessions.result":"organization.usage.code_interpreter_sessions.result"
-
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
class OrganizationUsageFileSearchesResultThe aggregated file search calls usage details of the specific time bucket.
-
num_requests: IntegerThe count of file search calls.
-
object: :"organization.usage.file_searches.result":"organization.usage.file_searches.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result. -
vector_store_id: StringWhen
group_by=vector_store_id, this field provides the vector store ID of the grouped usage result.
-
-
class OrganizationUsageWebSearchesResultThe aggregated web search calls usage details of the specific time bucket.
-
num_model_requests: IntegerThe count of model requests.
-
num_requests: IntegerThe count of web search calls.
-
object: :"organization.usage.web_searches.result":"organization.usage.web_searches.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
context_level: StringWhen
group_by=context_level, this field provides the search context size of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationCostsResultThe aggregated costs details of the specific time bucket.
-
object: :"organization.costs.result":"organization.costs.result"
-
amount: Amount{ currency, value}The monetary value in its associated currency.
-
currency: StringLowercase ISO-4217 currency e.g. "usd"
-
value: FloatThe numeric value of the cost.
-
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API Key ID of the grouped costs result. -
line_item: StringWhen
group_by=line_item, this field provides the line item of the grouped costs result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped costs result. -
quantity: FloatWhen
group_by=line_item, this field provides the quantity of the grouped costs result.
-
-
-
start_time: Integer
-
-
has_more: bool -
next_page: String -
object: :page:page
-
Usage Vector Stores Response
-
class UsageVectorStoresResponse-
data: Array[Data{ end_time, object, results, start_time}]-
end_time: Integer -
object: :bucket:bucket
-
results: Array[OrganizationUsageCompletionsResult{ input_tokens, num_model_requests, object, 10 more} | OrganizationUsageEmbeddingsResult{ input_tokens, num_model_requests, object, 4 more} | OrganizationUsageModerationsResult{ input_tokens, num_model_requests, object, 4 more} | 8 more]-
class OrganizationUsageCompletionsResultThe aggregated completions usage details of the specific time bucket.
-
input_tokens: IntegerThe aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.completions.result":"organization.usage.completions.result"
-
output_tokens: IntegerThe aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens.
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
batch: boolWhen
group_by=batch, this field tells whether the grouped usage result is batch or not. -
input_audio_tokens: IntegerThe aggregated number of audio input tokens used, including cached tokens.
-
input_cached_tokens: IntegerThe aggregated number of text input tokens that has been cached from previous requests. For customers subscribe to scale tier, this includes scale tier tokens.
-
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
output_audio_tokens: IntegerThe aggregated number of audio output tokens used.
-
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
service_tier: StringWhen
group_by=service_tier, this field provides the service tier of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageEmbeddingsResultThe aggregated embeddings usage details of the specific time bucket.
-
input_tokens: IntegerThe aggregated number of input tokens used.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.embeddings.result":"organization.usage.embeddings.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageModerationsResultThe aggregated moderations usage details of the specific time bucket.
-
input_tokens: IntegerThe aggregated number of input tokens used.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.moderations.result":"organization.usage.moderations.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageImagesResultThe aggregated images usage details of the specific time bucket.
-
images: IntegerThe number of images processed.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.images.result":"organization.usage.images.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
size: StringWhen
group_by=size, this field provides the image size of the grouped usage result. -
source: StringWhen
group_by=source, this field provides the source of the grouped usage result, possible values areimage.generation,image.edit,image.variation. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageAudioSpeechesResultThe aggregated audio speeches usage details of the specific time bucket.
-
characters: IntegerThe number of characters processed.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.audio_speeches.result":"organization.usage.audio_speeches.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageAudioTranscriptionsResultThe aggregated audio transcriptions usage details of the specific time bucket.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.audio_transcriptions.result":"organization.usage.audio_transcriptions.result"
-
seconds: IntegerThe number of seconds processed.
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageVectorStoresResultThe aggregated vector stores usage details of the specific time bucket.
-
object: :"organization.usage.vector_stores.result":"organization.usage.vector_stores.result"
-
usage_bytes: IntegerThe vector stores usage in bytes.
-
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
class OrganizationUsageCodeInterpreterSessionsResultThe aggregated code interpreter sessions usage details of the specific time bucket.
-
num_sessions: IntegerThe number of code interpreter sessions.
-
object: :"organization.usage.code_interpreter_sessions.result":"organization.usage.code_interpreter_sessions.result"
-
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
class OrganizationUsageFileSearchesResultThe aggregated file search calls usage details of the specific time bucket.
-
num_requests: IntegerThe count of file search calls.
-
object: :"organization.usage.file_searches.result":"organization.usage.file_searches.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result. -
vector_store_id: StringWhen
group_by=vector_store_id, this field provides the vector store ID of the grouped usage result.
-
-
class OrganizationUsageWebSearchesResultThe aggregated web search calls usage details of the specific time bucket.
-
num_model_requests: IntegerThe count of model requests.
-
num_requests: IntegerThe count of web search calls.
-
object: :"organization.usage.web_searches.result":"organization.usage.web_searches.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
context_level: StringWhen
group_by=context_level, this field provides the search context size of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationCostsResultThe aggregated costs details of the specific time bucket.
-
object: :"organization.costs.result":"organization.costs.result"
-
amount: Amount{ currency, value}The monetary value in its associated currency.
-
currency: StringLowercase ISO-4217 currency e.g. "usd"
-
value: FloatThe numeric value of the cost.
-
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API Key ID of the grouped costs result. -
line_item: StringWhen
group_by=line_item, this field provides the line item of the grouped costs result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped costs result. -
quantity: FloatWhen
group_by=line_item, this field provides the quantity of the grouped costs result.
-
-
-
start_time: Integer
-
-
has_more: bool -
next_page: String -
object: :page:page
-
Usage File Search Calls Response
-
class UsageFileSearchCallsResponse-
data: Array[Data{ end_time, object, results, start_time}]-
end_time: Integer -
object: :bucket:bucket
-
results: Array[OrganizationUsageCompletionsResult{ input_tokens, num_model_requests, object, 10 more} | OrganizationUsageEmbeddingsResult{ input_tokens, num_model_requests, object, 4 more} | OrganizationUsageModerationsResult{ input_tokens, num_model_requests, object, 4 more} | 8 more]-
class OrganizationUsageCompletionsResultThe aggregated completions usage details of the specific time bucket.
-
input_tokens: IntegerThe aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.completions.result":"organization.usage.completions.result"
-
output_tokens: IntegerThe aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens.
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
batch: boolWhen
group_by=batch, this field tells whether the grouped usage result is batch or not. -
input_audio_tokens: IntegerThe aggregated number of audio input tokens used, including cached tokens.
-
input_cached_tokens: IntegerThe aggregated number of text input tokens that has been cached from previous requests. For customers subscribe to scale tier, this includes scale tier tokens.
-
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
output_audio_tokens: IntegerThe aggregated number of audio output tokens used.
-
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
service_tier: StringWhen
group_by=service_tier, this field provides the service tier of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageEmbeddingsResultThe aggregated embeddings usage details of the specific time bucket.
-
input_tokens: IntegerThe aggregated number of input tokens used.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.embeddings.result":"organization.usage.embeddings.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageModerationsResultThe aggregated moderations usage details of the specific time bucket.
-
input_tokens: IntegerThe aggregated number of input tokens used.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.moderations.result":"organization.usage.moderations.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageImagesResultThe aggregated images usage details of the specific time bucket.
-
images: IntegerThe number of images processed.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.images.result":"organization.usage.images.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
size: StringWhen
group_by=size, this field provides the image size of the grouped usage result. -
source: StringWhen
group_by=source, this field provides the source of the grouped usage result, possible values areimage.generation,image.edit,image.variation. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageAudioSpeechesResultThe aggregated audio speeches usage details of the specific time bucket.
-
characters: IntegerThe number of characters processed.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.audio_speeches.result":"organization.usage.audio_speeches.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageAudioTranscriptionsResultThe aggregated audio transcriptions usage details of the specific time bucket.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.audio_transcriptions.result":"organization.usage.audio_transcriptions.result"
-
seconds: IntegerThe number of seconds processed.
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageVectorStoresResultThe aggregated vector stores usage details of the specific time bucket.
-
object: :"organization.usage.vector_stores.result":"organization.usage.vector_stores.result"
-
usage_bytes: IntegerThe vector stores usage in bytes.
-
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
class OrganizationUsageCodeInterpreterSessionsResultThe aggregated code interpreter sessions usage details of the specific time bucket.
-
num_sessions: IntegerThe number of code interpreter sessions.
-
object: :"organization.usage.code_interpreter_sessions.result":"organization.usage.code_interpreter_sessions.result"
-
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
class OrganizationUsageFileSearchesResultThe aggregated file search calls usage details of the specific time bucket.
-
num_requests: IntegerThe count of file search calls.
-
object: :"organization.usage.file_searches.result":"organization.usage.file_searches.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result. -
vector_store_id: StringWhen
group_by=vector_store_id, this field provides the vector store ID of the grouped usage result.
-
-
class OrganizationUsageWebSearchesResultThe aggregated web search calls usage details of the specific time bucket.
-
num_model_requests: IntegerThe count of model requests.
-
num_requests: IntegerThe count of web search calls.
-
object: :"organization.usage.web_searches.result":"organization.usage.web_searches.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
context_level: StringWhen
group_by=context_level, this field provides the search context size of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationCostsResultThe aggregated costs details of the specific time bucket.
-
object: :"organization.costs.result":"organization.costs.result"
-
amount: Amount{ currency, value}The monetary value in its associated currency.
-
currency: StringLowercase ISO-4217 currency e.g. "usd"
-
value: FloatThe numeric value of the cost.
-
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API Key ID of the grouped costs result. -
line_item: StringWhen
group_by=line_item, this field provides the line item of the grouped costs result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped costs result. -
quantity: FloatWhen
group_by=line_item, this field provides the quantity of the grouped costs result.
-
-
-
start_time: Integer
-
-
has_more: bool -
next_page: String -
object: :page:page
-
Usage Web Search Calls Response
-
class UsageWebSearchCallsResponse-
data: Array[Data{ end_time, object, results, start_time}]-
end_time: Integer -
object: :bucket:bucket
-
results: Array[OrganizationUsageCompletionsResult{ input_tokens, num_model_requests, object, 10 more} | OrganizationUsageEmbeddingsResult{ input_tokens, num_model_requests, object, 4 more} | OrganizationUsageModerationsResult{ input_tokens, num_model_requests, object, 4 more} | 8 more]-
class OrganizationUsageCompletionsResultThe aggregated completions usage details of the specific time bucket.
-
input_tokens: IntegerThe aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.completions.result":"organization.usage.completions.result"
-
output_tokens: IntegerThe aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens.
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
batch: boolWhen
group_by=batch, this field tells whether the grouped usage result is batch or not. -
input_audio_tokens: IntegerThe aggregated number of audio input tokens used, including cached tokens.
-
input_cached_tokens: IntegerThe aggregated number of text input tokens that has been cached from previous requests. For customers subscribe to scale tier, this includes scale tier tokens.
-
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
output_audio_tokens: IntegerThe aggregated number of audio output tokens used.
-
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
service_tier: StringWhen
group_by=service_tier, this field provides the service tier of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageEmbeddingsResultThe aggregated embeddings usage details of the specific time bucket.
-
input_tokens: IntegerThe aggregated number of input tokens used.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.embeddings.result":"organization.usage.embeddings.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageModerationsResultThe aggregated moderations usage details of the specific time bucket.
-
input_tokens: IntegerThe aggregated number of input tokens used.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.moderations.result":"organization.usage.moderations.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageImagesResultThe aggregated images usage details of the specific time bucket.
-
images: IntegerThe number of images processed.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.images.result":"organization.usage.images.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
size: StringWhen
group_by=size, this field provides the image size of the grouped usage result. -
source: StringWhen
group_by=source, this field provides the source of the grouped usage result, possible values areimage.generation,image.edit,image.variation. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageAudioSpeechesResultThe aggregated audio speeches usage details of the specific time bucket.
-
characters: IntegerThe number of characters processed.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.audio_speeches.result":"organization.usage.audio_speeches.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageAudioTranscriptionsResultThe aggregated audio transcriptions usage details of the specific time bucket.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.audio_transcriptions.result":"organization.usage.audio_transcriptions.result"
-
seconds: IntegerThe number of seconds processed.
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageVectorStoresResultThe aggregated vector stores usage details of the specific time bucket.
-
object: :"organization.usage.vector_stores.result":"organization.usage.vector_stores.result"
-
usage_bytes: IntegerThe vector stores usage in bytes.
-
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
class OrganizationUsageCodeInterpreterSessionsResultThe aggregated code interpreter sessions usage details of the specific time bucket.
-
num_sessions: IntegerThe number of code interpreter sessions.
-
object: :"organization.usage.code_interpreter_sessions.result":"organization.usage.code_interpreter_sessions.result"
-
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
class OrganizationUsageFileSearchesResultThe aggregated file search calls usage details of the specific time bucket.
-
num_requests: IntegerThe count of file search calls.
-
object: :"organization.usage.file_searches.result":"organization.usage.file_searches.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result. -
vector_store_id: StringWhen
group_by=vector_store_id, this field provides the vector store ID of the grouped usage result.
-
-
class OrganizationUsageWebSearchesResultThe aggregated web search calls usage details of the specific time bucket.
-
num_model_requests: IntegerThe count of model requests.
-
num_requests: IntegerThe count of web search calls.
-
object: :"organization.usage.web_searches.result":"organization.usage.web_searches.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
context_level: StringWhen
group_by=context_level, this field provides the search context size of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationCostsResultThe aggregated costs details of the specific time bucket.
-
object: :"organization.costs.result":"organization.costs.result"
-
amount: Amount{ currency, value}The monetary value in its associated currency.
-
currency: StringLowercase ISO-4217 currency e.g. "usd"
-
value: FloatThe numeric value of the cost.
-
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API Key ID of the grouped costs result. -
line_item: StringWhen
group_by=line_item, this field provides the line item of the grouped costs result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped costs result. -
quantity: FloatWhen
group_by=line_item, this field provides the quantity of the grouped costs result.
-
-
-
start_time: Integer
-
-
has_more: bool -
next_page: String -
object: :page:page
-
Usage Costs Response
-
class UsageCostsResponse-
data: Array[Data{ end_time, object, results, start_time}]-
end_time: Integer -
object: :bucket:bucket
-
results: Array[OrganizationUsageCompletionsResult{ input_tokens, num_model_requests, object, 10 more} | OrganizationUsageEmbeddingsResult{ input_tokens, num_model_requests, object, 4 more} | OrganizationUsageModerationsResult{ input_tokens, num_model_requests, object, 4 more} | 8 more]-
class OrganizationUsageCompletionsResultThe aggregated completions usage details of the specific time bucket.
-
input_tokens: IntegerThe aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.completions.result":"organization.usage.completions.result"
-
output_tokens: IntegerThe aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens.
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
batch: boolWhen
group_by=batch, this field tells whether the grouped usage result is batch or not. -
input_audio_tokens: IntegerThe aggregated number of audio input tokens used, including cached tokens.
-
input_cached_tokens: IntegerThe aggregated number of text input tokens that has been cached from previous requests. For customers subscribe to scale tier, this includes scale tier tokens.
-
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
output_audio_tokens: IntegerThe aggregated number of audio output tokens used.
-
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
service_tier: StringWhen
group_by=service_tier, this field provides the service tier of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageEmbeddingsResultThe aggregated embeddings usage details of the specific time bucket.
-
input_tokens: IntegerThe aggregated number of input tokens used.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.embeddings.result":"organization.usage.embeddings.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageModerationsResultThe aggregated moderations usage details of the specific time bucket.
-
input_tokens: IntegerThe aggregated number of input tokens used.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.moderations.result":"organization.usage.moderations.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageImagesResultThe aggregated images usage details of the specific time bucket.
-
images: IntegerThe number of images processed.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.images.result":"organization.usage.images.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
size: StringWhen
group_by=size, this field provides the image size of the grouped usage result. -
source: StringWhen
group_by=source, this field provides the source of the grouped usage result, possible values areimage.generation,image.edit,image.variation. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageAudioSpeechesResultThe aggregated audio speeches usage details of the specific time bucket.
-
characters: IntegerThe number of characters processed.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.audio_speeches.result":"organization.usage.audio_speeches.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageAudioTranscriptionsResultThe aggregated audio transcriptions usage details of the specific time bucket.
-
num_model_requests: IntegerThe count of requests made to the model.
-
object: :"organization.usage.audio_transcriptions.result":"organization.usage.audio_transcriptions.result"
-
seconds: IntegerThe number of seconds processed.
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageVectorStoresResultThe aggregated vector stores usage details of the specific time bucket.
-
object: :"organization.usage.vector_stores.result":"organization.usage.vector_stores.result"
-
usage_bytes: IntegerThe vector stores usage in bytes.
-
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
class OrganizationUsageCodeInterpreterSessionsResultThe aggregated code interpreter sessions usage details of the specific time bucket.
-
num_sessions: IntegerThe number of code interpreter sessions.
-
object: :"organization.usage.code_interpreter_sessions.result":"organization.usage.code_interpreter_sessions.result"
-
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
class OrganizationUsageFileSearchesResultThe aggregated file search calls usage details of the specific time bucket.
-
num_requests: IntegerThe count of file search calls.
-
object: :"organization.usage.file_searches.result":"organization.usage.file_searches.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result. -
vector_store_id: StringWhen
group_by=vector_store_id, this field provides the vector store ID of the grouped usage result.
-
-
class OrganizationUsageWebSearchesResultThe aggregated web search calls usage details of the specific time bucket.
-
num_model_requests: IntegerThe count of model requests.
-
num_requests: IntegerThe count of web search calls.
-
object: :"organization.usage.web_searches.result":"organization.usage.web_searches.result"
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
context_level: StringWhen
group_by=context_level, this field provides the search context size of the grouped usage result. -
model: StringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: StringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationCostsResultThe aggregated costs details of the specific time bucket.
-
object: :"organization.costs.result":"organization.costs.result"
-
amount: Amount{ currency, value}The monetary value in its associated currency.
-
currency: StringLowercase ISO-4217 currency e.g. "usd"
-
value: FloatThe numeric value of the cost.
-
-
api_key_id: StringWhen
group_by=api_key_id, this field provides the API Key ID of the grouped costs result. -
line_item: StringWhen
group_by=line_item, this field provides the line item of the grouped costs result. -
project_id: StringWhen
group_by=project_id, this field provides the project ID of the grouped costs result. -
quantity: FloatWhen
group_by=line_item, this field provides the quantity of the grouped costs result.
-
-
-
start_time: Integer
-
-
has_more: bool -
next_page: String -
object: :page:page
-
Invites
List invites
admin.organization.invites.list(**kwargs) -> ConversationCursorPage<Invite>
get /organization/invites
Returns a list of invites in the organization.
Parameters
-
after: StringA cursor for use in pagination.
afteris an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. -
limit: IntegerA limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
Returns
-
class InviteRepresents an individual
inviteto the organization.-
id: StringThe identifier, which can be referenced in API endpoints
-
created_at: IntegerThe Unix timestamp (in seconds) of when the invite was sent.
-
email: StringThe email address of the individual to whom the invite was sent
-
object: :"organization.invite"The object type, which is always
organization.invite:"organization.invite"
-
projects: Array[Project{ id, role}]The projects that were granted membership upon acceptance of the invite.
-
id: StringProject's public ID
-
role: :member | :ownerProject membership role
-
:member -
:owner
-
-
-
role: :owner | :readerownerorreader-
:owner -
:reader
-
-
status: :accepted | :expired | :pendingaccepted,expired, orpending-
:accepted -
:expired -
:pending
-
-
accepted_at: IntegerThe Unix timestamp (in seconds) of when the invite was accepted.
-
expires_at: IntegerThe Unix timestamp (in seconds) of when the invite expires.
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
page = openai.admin.organization.invites.list
puts(page)
Response
{
"data": [
{
"id": "id",
"created_at": 0,
"email": "email",
"object": "organization.invite",
"projects": [
{
"id": "id",
"role": "member"
}
],
"role": "owner",
"status": "accepted",
"accepted_at": 0,
"expires_at": 0
}
],
"has_more": true,
"object": "list",
"first_id": "first_id",
"last_id": "last_id"
}
Create invite
admin.organization.invites.create(**kwargs) -> Invite
post /organization/invites
Create an invite for a user to the organization. The invite must be accepted by the user before they have access to the organization.
Parameters
-
email: StringSend an email to this address
-
role: :reader | :ownerownerorreader-
:reader -
:owner
-
-
projects: Array[Project{ id, role}]An array of projects to which membership is granted at the same time the org invite is accepted. If omitted, the user will be invited to the default project for compatibility with legacy behavior. If empty list is passed, the user will not be invited to any projects, including the default one.
-
id: StringProject's public ID
-
role: :member | :ownerProject membership role
-
:member -
:owner
-
-
Returns
-
class InviteRepresents an individual
inviteto the organization.-
id: StringThe identifier, which can be referenced in API endpoints
-
created_at: IntegerThe Unix timestamp (in seconds) of when the invite was sent.
-
email: StringThe email address of the individual to whom the invite was sent
-
object: :"organization.invite"The object type, which is always
organization.invite:"organization.invite"
-
projects: Array[Project{ id, role}]The projects that were granted membership upon acceptance of the invite.
-
id: StringProject's public ID
-
role: :member | :ownerProject membership role
-
:member -
:owner
-
-
-
role: :owner | :readerownerorreader-
:owner -
:reader
-
-
status: :accepted | :expired | :pendingaccepted,expired, orpending-
:accepted -
:expired -
:pending
-
-
accepted_at: IntegerThe Unix timestamp (in seconds) of when the invite was accepted.
-
expires_at: IntegerThe Unix timestamp (in seconds) of when the invite expires.
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
invite = openai.admin.organization.invites.create(email: "email", role: :reader)
puts(invite)
Response
{
"id": "id",
"created_at": 0,
"email": "email",
"object": "organization.invite",
"projects": [
{
"id": "id",
"role": "member"
}
],
"role": "owner",
"status": "accepted",
"accepted_at": 0,
"expires_at": 0
}
Retrieve invite
admin.organization.invites.retrieve(invite_id) -> Invite
get /organization/invites/{invite_id}
Retrieves an invite.
Parameters
invite_id: String
Returns
-
class InviteRepresents an individual
inviteto the organization.-
id: StringThe identifier, which can be referenced in API endpoints
-
created_at: IntegerThe Unix timestamp (in seconds) of when the invite was sent.
-
email: StringThe email address of the individual to whom the invite was sent
-
object: :"organization.invite"The object type, which is always
organization.invite:"organization.invite"
-
projects: Array[Project{ id, role}]The projects that were granted membership upon acceptance of the invite.
-
id: StringProject's public ID
-
role: :member | :ownerProject membership role
-
:member -
:owner
-
-
-
role: :owner | :readerownerorreader-
:owner -
:reader
-
-
status: :accepted | :expired | :pendingaccepted,expired, orpending-
:accepted -
:expired -
:pending
-
-
accepted_at: IntegerThe Unix timestamp (in seconds) of when the invite was accepted.
-
expires_at: IntegerThe Unix timestamp (in seconds) of when the invite expires.
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
invite = openai.admin.organization.invites.retrieve("invite_id")
puts(invite)
Response
{
"id": "id",
"created_at": 0,
"email": "email",
"object": "organization.invite",
"projects": [
{
"id": "id",
"role": "member"
}
],
"role": "owner",
"status": "accepted",
"accepted_at": 0,
"expires_at": 0
}
Delete invite
admin.organization.invites.delete(invite_id) -> InviteDeleteResponse
delete /organization/invites/{invite_id}
Delete an invite. If the invite has already been accepted, it cannot be deleted.
Parameters
invite_id: String
Returns
-
class InviteDeleteResponse-
id: String -
deleted: bool -
object: :"organization.invite.deleted"The object type, which is always
organization.invite.deleted:"organization.invite.deleted"
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
invite = openai.admin.organization.invites.delete("invite_id")
puts(invite)
Response
{
"id": "id",
"deleted": true,
"object": "organization.invite.deleted"
}
Domain Types
Invite
-
class InviteRepresents an individual
inviteto the organization.-
id: StringThe identifier, which can be referenced in API endpoints
-
created_at: IntegerThe Unix timestamp (in seconds) of when the invite was sent.
-
email: StringThe email address of the individual to whom the invite was sent
-
object: :"organization.invite"The object type, which is always
organization.invite:"organization.invite"
-
projects: Array[Project{ id, role}]The projects that were granted membership upon acceptance of the invite.
-
id: StringProject's public ID
-
role: :member | :ownerProject membership role
-
:member -
:owner
-
-
-
role: :owner | :readerownerorreader-
:owner -
:reader
-
-
status: :accepted | :expired | :pendingaccepted,expired, orpending-
:accepted -
:expired -
:pending
-
-
accepted_at: IntegerThe Unix timestamp (in seconds) of when the invite was accepted.
-
expires_at: IntegerThe Unix timestamp (in seconds) of when the invite expires.
-
Invite Delete Response
-
class InviteDeleteResponse-
id: String -
deleted: bool -
object: :"organization.invite.deleted"The object type, which is always
organization.invite.deleted:"organization.invite.deleted"
-
Users
List users
admin.organization.users.list(**kwargs) -> ConversationCursorPage<OrganizationUser>
get /organization/users
Lists all of the users in the organization.
Parameters
-
after: StringA cursor for use in pagination.
afteris an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. -
emails: Array[String]Filter by the email address of users.
-
limit: IntegerA limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
Returns
-
class OrganizationUserRepresents an individual
userwithin an organization.-
id: StringThe identifier, which can be referenced in API endpoints
-
added_at: IntegerThe Unix timestamp (in seconds) of when the user was added.
-
object: :"organization.user"The object type, which is always
organization.user:"organization.user"
-
api_key_last_used_at: IntegerThe Unix timestamp (in seconds) of the user's last API key usage.
-
created: IntegerThe Unix timestamp (in seconds) of when the user was created.
-
developer_persona: StringThe developer persona metadata for the user.
-
email: StringThe email address of the user
-
is_default: boolWhether this is the organization's default user.
-
is_scale_tier_authorized_purchaser: boolWhether the user is an authorized purchaser for Scale Tier.
-
is_scim_managed: boolWhether the user is managed through SCIM.
-
is_service_account: boolWhether the user is a service account.
-
name: StringThe name of the user
-
projects: Projects{ data, object}Projects associated with the user, if included.
-
data: Array[Data{ id, name, role}]-
id: String -
name: String -
role: String
-
-
object: :list:list
-
-
role: Stringownerorreader -
technical_level: StringThe technical level metadata for the user.
-
user: User{ id, object, banned, 5 more}Nested user details.
-
id: String -
object: :user:user
-
banned: bool -
banned_at: Integer -
email: String -
enabled: bool -
name: String -
picture: String
-
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
page = openai.admin.organization.users.list
puts(page)
Response
{
"data": [
{
"id": "id",
"added_at": 0,
"object": "organization.user",
"api_key_last_used_at": 0,
"created": 0,
"developer_persona": "developer_persona",
"email": "email",
"is_default": true,
"is_scale_tier_authorized_purchaser": true,
"is_scim_managed": true,
"is_service_account": true,
"name": "name",
"projects": {
"data": [
{
"id": "id",
"name": "name",
"role": "role"
}
],
"object": "list"
},
"role": "role",
"technical_level": "technical_level",
"user": {
"id": "id",
"object": "user",
"banned": true,
"banned_at": 0,
"email": "email",
"enabled": true,
"name": "name",
"picture": "picture"
}
}
],
"has_more": true,
"object": "list",
"first_id": "first_id",
"last_id": "last_id"
}
Retrieve user
admin.organization.users.retrieve(user_id) -> OrganizationUser
get /organization/users/{user_id}
Retrieves a user by their identifier.
Parameters
user_id: String
Returns
-
class OrganizationUserRepresents an individual
userwithin an organization.-
id: StringThe identifier, which can be referenced in API endpoints
-
added_at: IntegerThe Unix timestamp (in seconds) of when the user was added.
-
object: :"organization.user"The object type, which is always
organization.user:"organization.user"
-
api_key_last_used_at: IntegerThe Unix timestamp (in seconds) of the user's last API key usage.
-
created: IntegerThe Unix timestamp (in seconds) of when the user was created.
-
developer_persona: StringThe developer persona metadata for the user.
-
email: StringThe email address of the user
-
is_default: boolWhether this is the organization's default user.
-
is_scale_tier_authorized_purchaser: boolWhether the user is an authorized purchaser for Scale Tier.
-
is_scim_managed: boolWhether the user is managed through SCIM.
-
is_service_account: boolWhether the user is a service account.
-
name: StringThe name of the user
-
projects: Projects{ data, object}Projects associated with the user, if included.
-
data: Array[Data{ id, name, role}]-
id: String -
name: String -
role: String
-
-
object: :list:list
-
-
role: Stringownerorreader -
technical_level: StringThe technical level metadata for the user.
-
user: User{ id, object, banned, 5 more}Nested user details.
-
id: String -
object: :user:user
-
banned: bool -
banned_at: Integer -
email: String -
enabled: bool -
name: String -
picture: String
-
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
organization_user = openai.admin.organization.users.retrieve("user_id")
puts(organization_user)
Response
{
"id": "id",
"added_at": 0,
"object": "organization.user",
"api_key_last_used_at": 0,
"created": 0,
"developer_persona": "developer_persona",
"email": "email",
"is_default": true,
"is_scale_tier_authorized_purchaser": true,
"is_scim_managed": true,
"is_service_account": true,
"name": "name",
"projects": {
"data": [
{
"id": "id",
"name": "name",
"role": "role"
}
],
"object": "list"
},
"role": "role",
"technical_level": "technical_level",
"user": {
"id": "id",
"object": "user",
"banned": true,
"banned_at": 0,
"email": "email",
"enabled": true,
"name": "name",
"picture": "picture"
}
}
Modify user
admin.organization.users.update(user_id, **kwargs) -> OrganizationUser
post /organization/users/{user_id}
Modifies a user's role in the organization.
Parameters
-
user_id: String -
developer_persona: StringDeveloper persona metadata.
-
role: Stringownerorreader -
role_id: StringRole ID to assign to the user.
-
technical_level: StringTechnical level metadata.
Returns
-
class OrganizationUserRepresents an individual
userwithin an organization.-
id: StringThe identifier, which can be referenced in API endpoints
-
added_at: IntegerThe Unix timestamp (in seconds) of when the user was added.
-
object: :"organization.user"The object type, which is always
organization.user:"organization.user"
-
api_key_last_used_at: IntegerThe Unix timestamp (in seconds) of the user's last API key usage.
-
created: IntegerThe Unix timestamp (in seconds) of when the user was created.
-
developer_persona: StringThe developer persona metadata for the user.
-
email: StringThe email address of the user
-
is_default: boolWhether this is the organization's default user.
-
is_scale_tier_authorized_purchaser: boolWhether the user is an authorized purchaser for Scale Tier.
-
is_scim_managed: boolWhether the user is managed through SCIM.
-
is_service_account: boolWhether the user is a service account.
-
name: StringThe name of the user
-
projects: Projects{ data, object}Projects associated with the user, if included.
-
data: Array[Data{ id, name, role}]-
id: String -
name: String -
role: String
-
-
object: :list:list
-
-
role: Stringownerorreader -
technical_level: StringThe technical level metadata for the user.
-
user: User{ id, object, banned, 5 more}Nested user details.
-
id: String -
object: :user:user
-
banned: bool -
banned_at: Integer -
email: String -
enabled: bool -
name: String -
picture: String
-
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
organization_user = openai.admin.organization.users.update("user_id")
puts(organization_user)
Response
{
"id": "id",
"added_at": 0,
"object": "organization.user",
"api_key_last_used_at": 0,
"created": 0,
"developer_persona": "developer_persona",
"email": "email",
"is_default": true,
"is_scale_tier_authorized_purchaser": true,
"is_scim_managed": true,
"is_service_account": true,
"name": "name",
"projects": {
"data": [
{
"id": "id",
"name": "name",
"role": "role"
}
],
"object": "list"
},
"role": "role",
"technical_level": "technical_level",
"user": {
"id": "id",
"object": "user",
"banned": true,
"banned_at": 0,
"email": "email",
"enabled": true,
"name": "name",
"picture": "picture"
}
}
Delete user
admin.organization.users.delete(user_id) -> UserDeleteResponse
delete /organization/users/{user_id}
Deletes a user from the organization.
Parameters
user_id: String
Returns
-
class UserDeleteResponse-
id: String -
deleted: bool -
object: :"organization.user.deleted":"organization.user.deleted"
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
user = openai.admin.organization.users.delete("user_id")
puts(user)
Response
{
"id": "id",
"deleted": true,
"object": "organization.user.deleted"
}
Domain Types
Organization User
-
class OrganizationUserRepresents an individual
userwithin an organization.-
id: StringThe identifier, which can be referenced in API endpoints
-
added_at: IntegerThe Unix timestamp (in seconds) of when the user was added.
-
object: :"organization.user"The object type, which is always
organization.user:"organization.user"
-
api_key_last_used_at: IntegerThe Unix timestamp (in seconds) of the user's last API key usage.
-
created: IntegerThe Unix timestamp (in seconds) of when the user was created.
-
developer_persona: StringThe developer persona metadata for the user.
-
email: StringThe email address of the user
-
is_default: boolWhether this is the organization's default user.
-
is_scale_tier_authorized_purchaser: boolWhether the user is an authorized purchaser for Scale Tier.
-
is_scim_managed: boolWhether the user is managed through SCIM.
-
is_service_account: boolWhether the user is a service account.
-
name: StringThe name of the user
-
projects: Projects{ data, object}Projects associated with the user, if included.
-
data: Array[Data{ id, name, role}]-
id: String -
name: String -
role: String
-
-
object: :list:list
-
-
role: Stringownerorreader -
technical_level: StringThe technical level metadata for the user.
-
user: User{ id, object, banned, 5 more}Nested user details.
-
id: String -
object: :user:user
-
banned: bool -
banned_at: Integer -
email: String -
enabled: bool -
name: String -
picture: String
-
-
User Delete Response
-
class UserDeleteResponse-
id: String -
deleted: bool -
object: :"organization.user.deleted":"organization.user.deleted"
-
Roles
List user organization role assignments
admin.organization.users.roles.list(user_id, **kwargs) -> NextCursorPage<RoleListResponse>
get /organization/users/{user_id}/roles
Lists the organization roles assigned to a user within the organization.
Parameters
-
user_id: String -
after: StringCursor for pagination. Provide the value from the previous response's
nextfield to continue listing organization roles. -
limit: IntegerA limit on the number of organization role assignments to return.
-
order: :asc | :descSort order for the returned organization roles.
-
:asc -
:desc
-
Returns
-
class RoleListResponseDetailed information about a role assignment entry returned when listing assignments.
-
id: StringIdentifier for the role.
-
assignment_sources: Array[AssignmentSource{ principal_id, principal_type}]Principals from which the role assignment is inherited, when available.
-
principal_id: String -
principal_type: String
-
-
created_at: IntegerWhen the role was created.
-
created_by: StringIdentifier of the actor who created the role.
-
created_by_user_obj: Hash[Symbol, untyped]User details for the actor that created the role, when available.
-
description: StringDescription of the role.
-
metadata: Hash[Symbol, untyped]Arbitrary metadata stored on the role.
-
name: StringName of the role.
-
permissions: Array[String]Permissions associated with the role.
-
predefined_role: boolWhether the role is predefined by OpenAI.
-
resource_type: StringResource type the role applies to.
-
updated_at: IntegerWhen the role was last updated.
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
page = openai.admin.organization.users.roles.list("user_id")
puts(page)
Response
{
"data": [
{
"id": "id",
"assignment_sources": [
{
"principal_id": "principal_id",
"principal_type": "principal_type"
}
],
"created_at": 0,
"created_by": "created_by",
"created_by_user_obj": {
"foo": "bar"
},
"description": "description",
"metadata": {
"foo": "bar"
},
"name": "name",
"permissions": [
"string"
],
"predefined_role": true,
"resource_type": "resource_type",
"updated_at": 0
}
],
"has_more": true,
"next": "next",
"object": "list"
}
Assign organization role to user
admin.organization.users.roles.create(user_id, **kwargs) -> RoleCreateResponse
post /organization/users/{user_id}/roles
Assigns an organization role to a user within the organization.
Parameters
-
user_id: String -
role_id: StringIdentifier of the role to assign.
Returns
-
class RoleCreateResponseRole assignment linking a user to a role.
-
object: :"user.role"Always
user.role.:"user.role"
-
role: RoleDetails about a role that can be assigned through the public Roles API.
-
id: StringIdentifier for the role.
-
description: StringOptional description of the role.
-
name: StringUnique name for the role.
-
object: :roleAlways
role.:role
-
permissions: Array[String]Permissions granted by the role.
-
predefined_role: boolWhether the role is predefined and managed by OpenAI.
-
resource_type: StringResource type the role is bound to (for example
api.organizationorapi.project).
-
-
user: OrganizationUserRepresents an individual
userwithin an organization.-
id: StringThe identifier, which can be referenced in API endpoints
-
added_at: IntegerThe Unix timestamp (in seconds) of when the user was added.
-
object: :"organization.user"The object type, which is always
organization.user:"organization.user"
-
api_key_last_used_at: IntegerThe Unix timestamp (in seconds) of the user's last API key usage.
-
created: IntegerThe Unix timestamp (in seconds) of when the user was created.
-
developer_persona: StringThe developer persona metadata for the user.
-
email: StringThe email address of the user
-
is_default: boolWhether this is the organization's default user.
-
is_scale_tier_authorized_purchaser: boolWhether the user is an authorized purchaser for Scale Tier.
-
is_scim_managed: boolWhether the user is managed through SCIM.
-
is_service_account: boolWhether the user is a service account.
-
name: StringThe name of the user
-
projects: Projects{ data, object}Projects associated with the user, if included.
-
data: Array[Data{ id, name, role}]-
id: String -
name: String -
role: String
-
-
object: :list:list
-
-
role: Stringownerorreader -
technical_level: StringThe technical level metadata for the user.
-
user: User{ id, object, banned, 5 more}Nested user details.
-
id: String -
object: :user:user
-
banned: bool -
banned_at: Integer -
email: String -
enabled: bool -
name: String -
picture: String
-
-
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
role = openai.admin.organization.users.roles.create("user_id", role_id: "role_id")
puts(role)
Response
{
"object": "user.role",
"role": {
"id": "id",
"description": "description",
"name": "name",
"object": "role",
"permissions": [
"string"
],
"predefined_role": true,
"resource_type": "resource_type"
},
"user": {
"id": "id",
"added_at": 0,
"object": "organization.user",
"api_key_last_used_at": 0,
"created": 0,
"developer_persona": "developer_persona",
"email": "email",
"is_default": true,
"is_scale_tier_authorized_purchaser": true,
"is_scim_managed": true,
"is_service_account": true,
"name": "name",
"projects": {
"data": [
{
"id": "id",
"name": "name",
"role": "role"
}
],
"object": "list"
},
"role": "role",
"technical_level": "technical_level",
"user": {
"id": "id",
"object": "user",
"banned": true,
"banned_at": 0,
"email": "email",
"enabled": true,
"name": "name",
"picture": "picture"
}
}
}
Retrieve user organization role
admin.organization.users.roles.retrieve(role_id, **kwargs) -> RoleRetrieveResponse
get /organization/users/{user_id}/roles/{role_id}
Retrieves an organization role assigned to a user.
Parameters
-
user_id: String -
role_id: String
Returns
-
class RoleRetrieveResponseDetailed information about a role assignment entry returned when listing assignments.
-
id: StringIdentifier for the role.
-
assignment_sources: Array[AssignmentSource{ principal_id, principal_type}]Principals from which the role assignment is inherited, when available.
-
principal_id: String -
principal_type: String
-
-
created_at: IntegerWhen the role was created.
-
created_by: StringIdentifier of the actor who created the role.
-
created_by_user_obj: Hash[Symbol, untyped]User details for the actor that created the role, when available.
-
description: StringDescription of the role.
-
metadata: Hash[Symbol, untyped]Arbitrary metadata stored on the role.
-
name: StringName of the role.
-
permissions: Array[String]Permissions associated with the role.
-
predefined_role: boolWhether the role is predefined by OpenAI.
-
resource_type: StringResource type the role applies to.
-
updated_at: IntegerWhen the role was last updated.
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
role = openai.admin.organization.users.roles.retrieve("role_id", user_id: "user_id")
puts(role)
Response
{
"id": "id",
"assignment_sources": [
{
"principal_id": "principal_id",
"principal_type": "principal_type"
}
],
"created_at": 0,
"created_by": "created_by",
"created_by_user_obj": {
"foo": "bar"
},
"description": "description",
"metadata": {
"foo": "bar"
},
"name": "name",
"permissions": [
"string"
],
"predefined_role": true,
"resource_type": "resource_type",
"updated_at": 0
}
Unassign organization role from user
admin.organization.users.roles.delete(role_id, **kwargs) -> RoleDeleteResponse
delete /organization/users/{user_id}/roles/{role_id}
Unassigns an organization role from a user within the organization.
Parameters
-
user_id: String -
role_id: String
Returns
-
class RoleDeleteResponseConfirmation payload returned after unassigning a role.
-
deleted: boolWhether the assignment was removed.
-
object: StringIdentifier for the deleted assignment, such as
group.role.deletedoruser.role.deleted.
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
role = openai.admin.organization.users.roles.delete("role_id", user_id: "user_id")
puts(role)
Response
{
"deleted": true,
"object": "object"
}
Domain Types
Role List Response
-
class RoleListResponseDetailed information about a role assignment entry returned when listing assignments.
-
id: StringIdentifier for the role.
-
assignment_sources: Array[AssignmentSource{ principal_id, principal_type}]Principals from which the role assignment is inherited, when available.
-
principal_id: String -
principal_type: String
-
-
created_at: IntegerWhen the role was created.
-
created_by: StringIdentifier of the actor who created the role.
-
created_by_user_obj: Hash[Symbol, untyped]User details for the actor that created the role, when available.
-
description: StringDescription of the role.
-
metadata: Hash[Symbol, untyped]Arbitrary metadata stored on the role.
-
name: StringName of the role.
-
permissions: Array[String]Permissions associated with the role.
-
predefined_role: boolWhether the role is predefined by OpenAI.
-
resource_type: StringResource type the role applies to.
-
updated_at: IntegerWhen the role was last updated.
-
Role Create Response
-
class RoleCreateResponseRole assignment linking a user to a role.
-
object: :"user.role"Always
user.role.:"user.role"
-
role: RoleDetails about a role that can be assigned through the public Roles API.
-
id: StringIdentifier for the role.
-
description: StringOptional description of the role.
-
name: StringUnique name for the role.
-
object: :roleAlways
role.:role
-
permissions: Array[String]Permissions granted by the role.
-
predefined_role: boolWhether the role is predefined and managed by OpenAI.
-
resource_type: StringResource type the role is bound to (for example
api.organizationorapi.project).
-
-
user: OrganizationUserRepresents an individual
userwithin an organization.-
id: StringThe identifier, which can be referenced in API endpoints
-
added_at: IntegerThe Unix timestamp (in seconds) of when the user was added.
-
object: :"organization.user"The object type, which is always
organization.user:"organization.user"
-
api_key_last_used_at: IntegerThe Unix timestamp (in seconds) of the user's last API key usage.
-
created: IntegerThe Unix timestamp (in seconds) of when the user was created.
-
developer_persona: StringThe developer persona metadata for the user.
-
email: StringThe email address of the user
-
is_default: boolWhether this is the organization's default user.
-
is_scale_tier_authorized_purchaser: boolWhether the user is an authorized purchaser for Scale Tier.
-
is_scim_managed: boolWhether the user is managed through SCIM.
-
is_service_account: boolWhether the user is a service account.
-
name: StringThe name of the user
-
projects: Projects{ data, object}Projects associated with the user, if included.
-
data: Array[Data{ id, name, role}]-
id: String -
name: String -
role: String
-
-
object: :list:list
-
-
role: Stringownerorreader -
technical_level: StringThe technical level metadata for the user.
-
user: User{ id, object, banned, 5 more}Nested user details.
-
id: String -
object: :user:user
-
banned: bool -
banned_at: Integer -
email: String -
enabled: bool -
name: String -
picture: String
-
-
-
Role Retrieve Response
-
class RoleRetrieveResponseDetailed information about a role assignment entry returned when listing assignments.
-
id: StringIdentifier for the role.
-
assignment_sources: Array[AssignmentSource{ principal_id, principal_type}]Principals from which the role assignment is inherited, when available.
-
principal_id: String -
principal_type: String
-
-
created_at: IntegerWhen the role was created.
-
created_by: StringIdentifier of the actor who created the role.
-
created_by_user_obj: Hash[Symbol, untyped]User details for the actor that created the role, when available.
-
description: StringDescription of the role.
-
metadata: Hash[Symbol, untyped]Arbitrary metadata stored on the role.
-
name: StringName of the role.
-
permissions: Array[String]Permissions associated with the role.
-
predefined_role: boolWhether the role is predefined by OpenAI.
-
resource_type: StringResource type the role applies to.
-
updated_at: IntegerWhen the role was last updated.
-
Role Delete Response
-
class RoleDeleteResponseConfirmation payload returned after unassigning a role.
-
deleted: boolWhether the assignment was removed.
-
object: StringIdentifier for the deleted assignment, such as
group.role.deletedoruser.role.deleted.
-
Groups
List groups
admin.organization.groups.list(**kwargs) -> NextCursorPage<Group>
get /organization/groups
Lists all groups in the organization.
Parameters
-
after: StringA cursor for use in pagination.
afteris a group ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with group_abc, your subsequent call can includeafter=group_abcin order to fetch the next page of the list. -
limit: IntegerA limit on the number of groups to be returned. Limit can range between 0 and 1000, and the default is 100.
-
order: :asc | :descSpecifies the sort order of the returned groups.
-
:asc -
:desc
-
Returns
-
class GroupDetails about an organization group.
-
id: StringIdentifier for the group.
-
created_at: IntegerUnix timestamp (in seconds) when the group was created.
-
group_type: :group | :tenant_groupThe type of the group.
-
:group -
:tenant_group
-
-
is_scim_managed: boolWhether the group is managed through SCIM and controlled by your identity provider.
-
name: StringDisplay name of the group.
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
page = openai.admin.organization.groups.list
puts(page)
Response
{
"data": [
{
"id": "id",
"created_at": 0,
"group_type": "group",
"is_scim_managed": true,
"name": "name"
}
],
"has_more": true,
"next": "next",
"object": "list"
}
Create group
admin.organization.groups.create(**kwargs) -> Group
post /organization/groups
Creates a new group in the organization.
Parameters
-
name: StringHuman readable name for the group.
Returns
-
class GroupDetails about an organization group.
-
id: StringIdentifier for the group.
-
created_at: IntegerUnix timestamp (in seconds) when the group was created.
-
group_type: :group | :tenant_groupThe type of the group.
-
:group -
:tenant_group
-
-
is_scim_managed: boolWhether the group is managed through SCIM and controlled by your identity provider.
-
name: StringDisplay name of the group.
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
group = openai.admin.organization.groups.create(name: "x")
puts(group)
Response
{
"id": "id",
"created_at": 0,
"group_type": "group",
"is_scim_managed": true,
"name": "name"
}
Retrieve group
admin.organization.groups.retrieve(group_id) -> Group
get /organization/groups/{group_id}
Retrieves a group.
Parameters
group_id: String
Returns
-
class GroupDetails about an organization group.
-
id: StringIdentifier for the group.
-
created_at: IntegerUnix timestamp (in seconds) when the group was created.
-
group_type: :group | :tenant_groupThe type of the group.
-
:group -
:tenant_group
-
-
is_scim_managed: boolWhether the group is managed through SCIM and controlled by your identity provider.
-
name: StringDisplay name of the group.
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
group = openai.admin.organization.groups.retrieve("group_id")
puts(group)
Response
{
"id": "id",
"created_at": 0,
"group_type": "group",
"is_scim_managed": true,
"name": "name"
}
Update group
admin.organization.groups.update(group_id, **kwargs) -> GroupUpdateResponse
post /organization/groups/{group_id}
Updates a group's information.
Parameters
-
group_id: String -
name: StringNew display name for the group.
Returns
-
class GroupUpdateResponseResponse returned after updating a group.
-
id: StringIdentifier for the group.
-
created_at: IntegerUnix timestamp (in seconds) when the group was created.
-
is_scim_managed: boolWhether the group is managed through SCIM and controlled by your identity provider.
-
name: StringUpdated display name for the group.
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
group = openai.admin.organization.groups.update("group_id", name: "x")
puts(group)
Response
{
"id": "id",
"created_at": 0,
"is_scim_managed": true,
"name": "name"
}
Delete group
admin.organization.groups.delete(group_id) -> GroupDeleteResponse
delete /organization/groups/{group_id}
Deletes a group from the organization.
Parameters
group_id: String
Returns
-
class GroupDeleteResponseConfirmation payload returned after deleting a group.
-
id: StringIdentifier of the deleted group.
-
deleted: boolWhether the group was deleted.
-
object: :"group.deleted"Always
group.deleted.:"group.deleted"
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
group = openai.admin.organization.groups.delete("group_id")
puts(group)
Response
{
"id": "id",
"deleted": true,
"object": "group.deleted"
}
Domain Types
Group
-
class GroupDetails about an organization group.
-
id: StringIdentifier for the group.
-
created_at: IntegerUnix timestamp (in seconds) when the group was created.
-
group_type: :group | :tenant_groupThe type of the group.
-
:group -
:tenant_group
-
-
is_scim_managed: boolWhether the group is managed through SCIM and controlled by your identity provider.
-
name: StringDisplay name of the group.
-
Group Update Response
-
class GroupUpdateResponseResponse returned after updating a group.
-
id: StringIdentifier for the group.
-
created_at: IntegerUnix timestamp (in seconds) when the group was created.
-
is_scim_managed: boolWhether the group is managed through SCIM and controlled by your identity provider.
-
name: StringUpdated display name for the group.
-
Group Delete Response
-
class GroupDeleteResponseConfirmation payload returned after deleting a group.
-
id: StringIdentifier of the deleted group.
-
deleted: boolWhether the group was deleted.
-
object: :"group.deleted"Always
group.deleted.:"group.deleted"
-
Users
List group users
admin.organization.groups.users.list(group_id, **kwargs) -> NextCursorPage<OrganizationGroupUser>
get /organization/groups/{group_id}/users
Lists the users assigned to a group.
Parameters
-
group_id: String -
after: StringA cursor for use in pagination. Provide the ID of the last user from the previous list response to retrieve the next page.
-
limit: IntegerA limit on the number of users to be returned. Limit can range between 0 and 1000, and the default is 100.
-
order: :asc | :descSpecifies the sort order of users in the list.
-
:asc -
:desc
-
Returns
-
class OrganizationGroupUserRepresents an individual user returned when inspecting group membership.
-
id: StringThe identifier, which can be referenced in API endpoints
-
email: StringThe email address of the user.
-
name: StringThe name of the user.
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
page = openai.admin.organization.groups.users.list("group_id")
puts(page)
Response
{
"data": [
{
"id": "id",
"email": "email",
"name": "name"
}
],
"has_more": true,
"next": "next",
"object": "list"
}
Add group user
admin.organization.groups.users.create(group_id, **kwargs) -> UserCreateResponse
post /organization/groups/{group_id}/users
Adds a user to a group.
Parameters
-
group_id: String -
user_id: StringIdentifier of the user to add to the group.
Returns
-
class UserCreateResponseConfirmation payload returned after adding a user to a group.
-
group_id: StringIdentifier of the group the user was added to.
-
object: :"group.user"Always
group.user.:"group.user"
-
user_id: StringIdentifier of the user that was added.
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
user = openai.admin.organization.groups.users.create("group_id", user_id: "user_id")
puts(user)
Response
{
"group_id": "group_id",
"object": "group.user",
"user_id": "user_id"
}
Retrieve group user
admin.organization.groups.users.retrieve(user_id, **kwargs) -> UserRetrieveResponse
get /organization/groups/{group_id}/users/{user_id}
Retrieves a user in a group.
Parameters
-
group_id: String -
user_id: String
Returns
-
class UserRetrieveResponseDetails about a user returned from an organization group membership lookup.
-
id: StringIdentifier for the user.
-
email: StringEmail address of the user, or
nullfor users without an email. -
is_service_account: boolWhether the user is a service account.
-
name: StringDisplay name of the user.
-
picture: StringURL of the user's profile picture, if available.
-
user_type: :user | :tenant_userThe type of user.
-
:user -
:tenant_user
-
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
user = openai.admin.organization.groups.users.retrieve("user_id", group_id: "group_id")
puts(user)
Response
{
"id": "id",
"email": "email",
"is_service_account": true,
"name": "name",
"picture": "picture",
"user_type": "user"
}
Remove group user
admin.organization.groups.users.delete(user_id, **kwargs) -> UserDeleteResponse
delete /organization/groups/{group_id}/users/{user_id}
Removes a user from a group.
Parameters
-
group_id: String -
user_id: String
Returns
-
class UserDeleteResponseConfirmation payload returned after removing a user from a group.
-
deleted: boolWhether the group membership was removed.
-
object: :"group.user.deleted"Always
group.user.deleted.:"group.user.deleted"
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
user = openai.admin.organization.groups.users.delete("user_id", group_id: "group_id")
puts(user)
Response
{
"deleted": true,
"object": "group.user.deleted"
}
Domain Types
Organization Group User
-
class OrganizationGroupUserRepresents an individual user returned when inspecting group membership.
-
id: StringThe identifier, which can be referenced in API endpoints
-
email: StringThe email address of the user.
-
name: StringThe name of the user.
-
User Create Response
-
class UserCreateResponseConfirmation payload returned after adding a user to a group.
-
group_id: StringIdentifier of the group the user was added to.
-
object: :"group.user"Always
group.user.:"group.user"
-
user_id: StringIdentifier of the user that was added.
-
User Retrieve Response
-
class UserRetrieveResponseDetails about a user returned from an organization group membership lookup.
-
id: StringIdentifier for the user.
-
email: StringEmail address of the user, or
nullfor users without an email. -
is_service_account: boolWhether the user is a service account.
-
name: StringDisplay name of the user.
-
picture: StringURL of the user's profile picture, if available.
-
user_type: :user | :tenant_userThe type of user.
-
:user -
:tenant_user
-
-
User Delete Response
-
class UserDeleteResponseConfirmation payload returned after removing a user from a group.
-
deleted: boolWhether the group membership was removed.
-
object: :"group.user.deleted"Always
group.user.deleted.:"group.user.deleted"
-
Roles
List group organization role assignments
admin.organization.groups.roles.list(group_id, **kwargs) -> NextCursorPage<RoleListResponse>
get /organization/groups/{group_id}/roles
Lists the organization roles assigned to a group within the organization.
Parameters
-
group_id: String -
after: StringCursor for pagination. Provide the value from the previous response's
nextfield to continue listing organization roles. -
limit: IntegerA limit on the number of organization role assignments to return.
-
order: :asc | :descSort order for the returned organization roles.
-
:asc -
:desc
-
Returns
-
class RoleListResponseDetailed information about a role assignment entry returned when listing assignments.
-
id: StringIdentifier for the role.
-
assignment_sources: Array[AssignmentSource{ principal_id, principal_type}]Principals from which the role assignment is inherited, when available.
-
principal_id: String -
principal_type: String
-
-
created_at: IntegerWhen the role was created.
-
created_by: StringIdentifier of the actor who created the role.
-
created_by_user_obj: Hash[Symbol, untyped]User details for the actor that created the role, when available.
-
description: StringDescription of the role.
-
metadata: Hash[Symbol, untyped]Arbitrary metadata stored on the role.
-
name: StringName of the role.
-
permissions: Array[String]Permissions associated with the role.
-
predefined_role: boolWhether the role is predefined by OpenAI.
-
resource_type: StringResource type the role applies to.
-
updated_at: IntegerWhen the role was last updated.
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
page = openai.admin.organization.groups.roles.list("group_id")
puts(page)
Response
{
"data": [
{
"id": "id",
"assignment_sources": [
{
"principal_id": "principal_id",
"principal_type": "principal_type"
}
],
"created_at": 0,
"created_by": "created_by",
"created_by_user_obj": {
"foo": "bar"
},
"description": "description",
"metadata": {
"foo": "bar"
},
"name": "name",
"permissions": [
"string"
],
"predefined_role": true,
"resource_type": "resource_type",
"updated_at": 0
}
],
"has_more": true,
"next": "next",
"object": "list"
}
Assign organization role to group
admin.organization.groups.roles.create(group_id, **kwargs) -> RoleCreateResponse
post /organization/groups/{group_id}/roles
Assigns an organization role to a group within the organization.
Parameters
-
group_id: String -
role_id: StringIdentifier of the role to assign.
Returns
-
class RoleCreateResponseRole assignment linking a group to a role.
-
group: Group{ id, created_at, name, 2 more}Summary information about a group returned in role assignment responses.
-
id: StringIdentifier for the group.
-
created_at: IntegerUnix timestamp (in seconds) when the group was created.
-
name: StringDisplay name of the group.
-
object: :groupAlways
group.:group
-
scim_managed: boolWhether the group is managed through SCIM.
-
-
object: :"group.role"Always
group.role.:"group.role"
-
role: RoleDetails about a role that can be assigned through the public Roles API.
-
id: StringIdentifier for the role.
-
description: StringOptional description of the role.
-
name: StringUnique name for the role.
-
object: :roleAlways
role.:role
-
permissions: Array[String]Permissions granted by the role.
-
predefined_role: boolWhether the role is predefined and managed by OpenAI.
-
resource_type: StringResource type the role is bound to (for example
api.organizationorapi.project).
-
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
role = openai.admin.organization.groups.roles.create("group_id", role_id: "role_id")
puts(role)
Response
{
"group": {
"id": "id",
"created_at": 0,
"name": "name",
"object": "group",
"scim_managed": true
},
"object": "group.role",
"role": {
"id": "id",
"description": "description",
"name": "name",
"object": "role",
"permissions": [
"string"
],
"predefined_role": true,
"resource_type": "resource_type"
}
}
Retrieve group organization role
admin.organization.groups.roles.retrieve(role_id, **kwargs) -> RoleRetrieveResponse
get /organization/groups/{group_id}/roles/{role_id}
Retrieves an organization role assigned to a group.
Parameters
-
group_id: String -
role_id: String
Returns
-
class RoleRetrieveResponseDetailed information about a role assignment entry returned when listing assignments.
-
id: StringIdentifier for the role.
-
assignment_sources: Array[AssignmentSource{ principal_id, principal_type}]Principals from which the role assignment is inherited, when available.
-
principal_id: String -
principal_type: String
-
-
created_at: IntegerWhen the role was created.
-
created_by: StringIdentifier of the actor who created the role.
-
created_by_user_obj: Hash[Symbol, untyped]User details for the actor that created the role, when available.
-
description: StringDescription of the role.
-
metadata: Hash[Symbol, untyped]Arbitrary metadata stored on the role.
-
name: StringName of the role.
-
permissions: Array[String]Permissions associated with the role.
-
predefined_role: boolWhether the role is predefined by OpenAI.
-
resource_type: StringResource type the role applies to.
-
updated_at: IntegerWhen the role was last updated.
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
role = openai.admin.organization.groups.roles.retrieve("role_id", group_id: "group_id")
puts(role)
Response
{
"id": "id",
"assignment_sources": [
{
"principal_id": "principal_id",
"principal_type": "principal_type"
}
],
"created_at": 0,
"created_by": "created_by",
"created_by_user_obj": {
"foo": "bar"
},
"description": "description",
"metadata": {
"foo": "bar"
},
"name": "name",
"permissions": [
"string"
],
"predefined_role": true,
"resource_type": "resource_type",
"updated_at": 0
}
Unassign organization role from group
admin.organization.groups.roles.delete(role_id, **kwargs) -> RoleDeleteResponse
delete /organization/groups/{group_id}/roles/{role_id}
Unassigns an organization role from a group within the organization.
Parameters
-
group_id: String -
role_id: String
Returns
-
class RoleDeleteResponseConfirmation payload returned after unassigning a role.
-
deleted: boolWhether the assignment was removed.
-
object: StringIdentifier for the deleted assignment, such as
group.role.deletedoruser.role.deleted.
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
role = openai.admin.organization.groups.roles.delete("role_id", group_id: "group_id")
puts(role)
Response
{
"deleted": true,
"object": "object"
}
Domain Types
Role List Response
-
class RoleListResponseDetailed information about a role assignment entry returned when listing assignments.
-
id: StringIdentifier for the role.
-
assignment_sources: Array[AssignmentSource{ principal_id, principal_type}]Principals from which the role assignment is inherited, when available.
-
principal_id: String -
principal_type: String
-
-
created_at: IntegerWhen the role was created.
-
created_by: StringIdentifier of the actor who created the role.
-
created_by_user_obj: Hash[Symbol, untyped]User details for the actor that created the role, when available.
-
description: StringDescription of the role.
-
metadata: Hash[Symbol, untyped]Arbitrary metadata stored on the role.
-
name: StringName of the role.
-
permissions: Array[String]Permissions associated with the role.
-
predefined_role: boolWhether the role is predefined by OpenAI.
-
resource_type: StringResource type the role applies to.
-
updated_at: IntegerWhen the role was last updated.
-
Role Create Response
-
class RoleCreateResponseRole assignment linking a group to a role.
-
group: Group{ id, created_at, name, 2 more}Summary information about a group returned in role assignment responses.
-
id: StringIdentifier for the group.
-
created_at: IntegerUnix timestamp (in seconds) when the group was created.
-
name: StringDisplay name of the group.
-
object: :groupAlways
group.:group
-
scim_managed: boolWhether the group is managed through SCIM.
-
-
object: :"group.role"Always
group.role.:"group.role"
-
role: RoleDetails about a role that can be assigned through the public Roles API.
-
id: StringIdentifier for the role.
-
description: StringOptional description of the role.
-
name: StringUnique name for the role.
-
object: :roleAlways
role.:role
-
permissions: Array[String]Permissions granted by the role.
-
predefined_role: boolWhether the role is predefined and managed by OpenAI.
-
resource_type: StringResource type the role is bound to (for example
api.organizationorapi.project).
-
-
Role Retrieve Response
-
class RoleRetrieveResponseDetailed information about a role assignment entry returned when listing assignments.
-
id: StringIdentifier for the role.
-
assignment_sources: Array[AssignmentSource{ principal_id, principal_type}]Principals from which the role assignment is inherited, when available.
-
principal_id: String -
principal_type: String
-
-
created_at: IntegerWhen the role was created.
-
created_by: StringIdentifier of the actor who created the role.
-
created_by_user_obj: Hash[Symbol, untyped]User details for the actor that created the role, when available.
-
description: StringDescription of the role.
-
metadata: Hash[Symbol, untyped]Arbitrary metadata stored on the role.
-
name: StringName of the role.
-
permissions: Array[String]Permissions associated with the role.
-
predefined_role: boolWhether the role is predefined by OpenAI.
-
resource_type: StringResource type the role applies to.
-
updated_at: IntegerWhen the role was last updated.
-
Role Delete Response
-
class RoleDeleteResponseConfirmation payload returned after unassigning a role.
-
deleted: boolWhether the assignment was removed.
-
object: StringIdentifier for the deleted assignment, such as
group.role.deletedoruser.role.deleted.
-
Roles
List organization roles
admin.organization.roles.list(**kwargs) -> NextCursorPage<Role>
get /organization/roles
Lists the roles configured for the organization.
Parameters
-
after: StringCursor for pagination. Provide the value from the previous response's
nextfield to continue listing roles. -
limit: IntegerA limit on the number of roles to return. Defaults to 1000.
-
order: :asc | :descSort order for the returned roles.
-
:asc -
:desc
-
Returns
-
class RoleDetails about a role that can be assigned through the public Roles API.
-
id: StringIdentifier for the role.
-
description: StringOptional description of the role.
-
name: StringUnique name for the role.
-
object: :roleAlways
role.:role
-
permissions: Array[String]Permissions granted by the role.
-
predefined_role: boolWhether the role is predefined and managed by OpenAI.
-
resource_type: StringResource type the role is bound to (for example
api.organizationorapi.project).
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
page = openai.admin.organization.roles.list
puts(page)
Response
{
"data": [
{
"id": "id",
"description": "description",
"name": "name",
"object": "role",
"permissions": [
"string"
],
"predefined_role": true,
"resource_type": "resource_type"
}
],
"has_more": true,
"next": "next",
"object": "list"
}
Create organization role
admin.organization.roles.create(**kwargs) -> Role
post /organization/roles
Creates a custom role for the organization.
Parameters
-
permissions: Array[String]Permissions to grant to the role.
-
role_name: StringUnique name for the role.
-
description: StringOptional description of the role.
Returns
-
class RoleDetails about a role that can be assigned through the public Roles API.
-
id: StringIdentifier for the role.
-
description: StringOptional description of the role.
-
name: StringUnique name for the role.
-
object: :roleAlways
role.:role
-
permissions: Array[String]Permissions granted by the role.
-
predefined_role: boolWhether the role is predefined and managed by OpenAI.
-
resource_type: StringResource type the role is bound to (for example
api.organizationorapi.project).
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
role = openai.admin.organization.roles.create(permissions: ["string"], role_name: "role_name")
puts(role)
Response
{
"id": "id",
"description": "description",
"name": "name",
"object": "role",
"permissions": [
"string"
],
"predefined_role": true,
"resource_type": "resource_type"
}
Retrieve organization role
admin.organization.roles.retrieve(role_id) -> Role
get /organization/roles/{role_id}
Retrieves an organization role.
Parameters
role_id: String
Returns
-
class RoleDetails about a role that can be assigned through the public Roles API.
-
id: StringIdentifier for the role.
-
description: StringOptional description of the role.
-
name: StringUnique name for the role.
-
object: :roleAlways
role.:role
-
permissions: Array[String]Permissions granted by the role.
-
predefined_role: boolWhether the role is predefined and managed by OpenAI.
-
resource_type: StringResource type the role is bound to (for example
api.organizationorapi.project).
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
role = openai.admin.organization.roles.retrieve("role_id")
puts(role)
Response
{
"id": "id",
"description": "description",
"name": "name",
"object": "role",
"permissions": [
"string"
],
"predefined_role": true,
"resource_type": "resource_type"
}
Update organization role
admin.organization.roles.update(role_id, **kwargs) -> Role
post /organization/roles/{role_id}
Updates an existing organization role.
Parameters
-
role_id: String -
description: StringNew description for the role.
-
permissions: Array[String]Updated set of permissions for the role.
-
role_name: StringNew name for the role.
Returns
-
class RoleDetails about a role that can be assigned through the public Roles API.
-
id: StringIdentifier for the role.
-
description: StringOptional description of the role.
-
name: StringUnique name for the role.
-
object: :roleAlways
role.:role
-
permissions: Array[String]Permissions granted by the role.
-
predefined_role: boolWhether the role is predefined and managed by OpenAI.
-
resource_type: StringResource type the role is bound to (for example
api.organizationorapi.project).
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
role = openai.admin.organization.roles.update("role_id")
puts(role)
Response
{
"id": "id",
"description": "description",
"name": "name",
"object": "role",
"permissions": [
"string"
],
"predefined_role": true,
"resource_type": "resource_type"
}
Delete organization role
admin.organization.roles.delete(role_id) -> RoleDeleteResponse
delete /organization/roles/{role_id}
Deletes a custom role from the organization.
Parameters
role_id: String
Returns
-
class RoleDeleteResponseConfirmation payload returned after deleting a role.
-
id: StringIdentifier of the deleted role.
-
deleted: boolWhether the role was deleted.
-
object: :"role.deleted"Always
role.deleted.:"role.deleted"
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
role = openai.admin.organization.roles.delete("role_id")
puts(role)
Response
{
"id": "id",
"deleted": true,
"object": "role.deleted"
}
Domain Types
Role
-
class RoleDetails about a role that can be assigned through the public Roles API.
-
id: StringIdentifier for the role.
-
description: StringOptional description of the role.
-
name: StringUnique name for the role.
-
object: :roleAlways
role.:role
-
permissions: Array[String]Permissions granted by the role.
-
predefined_role: boolWhether the role is predefined and managed by OpenAI.
-
resource_type: StringResource type the role is bound to (for example
api.organizationorapi.project).
-
Role Delete Response
-
class RoleDeleteResponseConfirmation payload returned after deleting a role.
-
id: StringIdentifier of the deleted role.
-
deleted: boolWhether the role was deleted.
-
object: :"role.deleted"Always
role.deleted.:"role.deleted"
-
Data Retention
Retrieve organization data retention
admin.organization.data_retention.retrieve() -> OrganizationDataRetention
get /organization/data_retention
Retrieves organization data retention controls.
Returns
-
class OrganizationDataRetentionRepresents the organization's data retention control setting.
-
object: :"organization.data_retention"The object type, which is always
organization.data_retention.:"organization.data_retention"
-
type: :zero_data_retention | :modified_abuse_monitoring | :enhanced_zero_data_retention | :enhanced_modified_abuse_monitoringThe configured organization data retention type.
-
:zero_data_retention -
:modified_abuse_monitoring -
:enhanced_zero_data_retention -
:enhanced_modified_abuse_monitoring
-
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
organization_data_retention = openai.admin.organization.data_retention.retrieve
puts(organization_data_retention)
Response
{
"object": "organization.data_retention",
"type": "zero_data_retention"
}
Update organization data retention
admin.organization.data_retention.update(**kwargs) -> OrganizationDataRetention
post /organization/data_retention
Updates organization data retention controls.
Parameters
-
retention_type: :zero_data_retention | :modified_abuse_monitoring | :enhanced_zero_data_retention | :enhanced_modified_abuse_monitoringThe desired organization data retention type.
-
:zero_data_retention -
:modified_abuse_monitoring -
:enhanced_zero_data_retention -
:enhanced_modified_abuse_monitoring
-
Returns
-
class OrganizationDataRetentionRepresents the organization's data retention control setting.
-
object: :"organization.data_retention"The object type, which is always
organization.data_retention.:"organization.data_retention"
-
type: :zero_data_retention | :modified_abuse_monitoring | :enhanced_zero_data_retention | :enhanced_modified_abuse_monitoringThe configured organization data retention type.
-
:zero_data_retention -
:modified_abuse_monitoring -
:enhanced_zero_data_retention -
:enhanced_modified_abuse_monitoring
-
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
organization_data_retention = openai.admin.organization.data_retention.update(retention_type: :zero_data_retention)
puts(organization_data_retention)
Response
{
"object": "organization.data_retention",
"type": "zero_data_retention"
}
Domain Types
Organization Data Retention
-
class OrganizationDataRetentionRepresents the organization's data retention control setting.
-
object: :"organization.data_retention"The object type, which is always
organization.data_retention.:"organization.data_retention"
-
type: :zero_data_retention | :modified_abuse_monitoring | :enhanced_zero_data_retention | :enhanced_modified_abuse_monitoringThe configured organization data retention type.
-
:zero_data_retention -
:modified_abuse_monitoring -
:enhanced_zero_data_retention -
:enhanced_modified_abuse_monitoring
-
-
Spend Alerts
List organization spend alerts
admin.organization.spend_alerts.list(**kwargs) -> ConversationCursorPage<OrganizationSpendAlert>
get /organization/spend_alerts
Lists organization spend alerts.
Parameters
-
after: StringCursor for pagination. Provide the ID of the last spend alert from the previous response to fetch the next page.
-
before: StringCursor for pagination. Provide the ID of the first spend alert from the previous response to fetch the previous page.
-
limit: IntegerA limit on the number of spend alerts to return. Defaults to 20.
-
order: :asc | :descSort order for the returned spend alerts.
-
:asc -
:desc
-
Returns
-
class OrganizationSpendAlertRepresents a spend alert configured at the organization level.
-
id: StringThe identifier, which can be referenced in API endpoints.
-
currency: :USDThe currency for the threshold amount.
:USD
-
interval: :monthThe time interval for evaluating spend against the threshold.
:month
-
notification_channel: NotificationChannel{ recipients, type, subject_prefix}Email notification settings for a spend alert.
-
recipients: Array[String]Email addresses that receive the spend alert notification.
-
type: :emailThe notification channel type. Currently only
emailis supported.:email
-
subject_prefix: StringOptional subject prefix for alert emails.
-
-
object: :"organization.spend_alert"The object type, which is always
organization.spend_alert.:"organization.spend_alert"
-
threshold_amount: IntegerThe alert threshold amount, in cents.
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
page = openai.admin.organization.spend_alerts.list
puts(page)
Response
{
"data": [
{
"id": "id",
"currency": "USD",
"interval": "month",
"notification_channel": {
"recipients": [
"string"
],
"type": "email",
"subject_prefix": "subject_prefix"
},
"object": "organization.spend_alert",
"threshold_amount": 0
}
],
"first_id": "first_id",
"has_more": true,
"last_id": "last_id",
"object": "list"
}
Create organization spend alert
admin.organization.spend_alerts.create(**kwargs) -> OrganizationSpendAlert
post /organization/spend_alerts
Creates an organization spend alert.
Parameters
-
currency: :USDThe currency for the threshold amount.
:USD
-
interval: :monthThe time interval for evaluating spend against the threshold.
:month
-
notification_channel: NotificationChannel{ recipients, type, subject_prefix}Email notification settings for a spend alert.
-
recipients: Array[String]Email addresses that receive the spend alert notification.
-
type: :emailThe notification channel type. Currently only
emailis supported.:email
-
subject_prefix: StringOptional subject prefix for alert emails.
-
-
threshold_amount: IntegerThe alert threshold amount, in cents.
Returns
-
class OrganizationSpendAlertRepresents a spend alert configured at the organization level.
-
id: StringThe identifier, which can be referenced in API endpoints.
-
currency: :USDThe currency for the threshold amount.
:USD
-
interval: :monthThe time interval for evaluating spend against the threshold.
:month
-
notification_channel: NotificationChannel{ recipients, type, subject_prefix}Email notification settings for a spend alert.
-
recipients: Array[String]Email addresses that receive the spend alert notification.
-
type: :emailThe notification channel type. Currently only
emailis supported.:email
-
subject_prefix: StringOptional subject prefix for alert emails.
-
-
object: :"organization.spend_alert"The object type, which is always
organization.spend_alert.:"organization.spend_alert"
-
threshold_amount: IntegerThe alert threshold amount, in cents.
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
organization_spend_alert = openai.admin.organization.spend_alerts.create(
currency: :USD,
interval: :month,
notification_channel: {recipients: ["string"], type: :email},
threshold_amount: 0
)
puts(organization_spend_alert)
Response
{
"id": "id",
"currency": "USD",
"interval": "month",
"notification_channel": {
"recipients": [
"string"
],
"type": "email",
"subject_prefix": "subject_prefix"
},
"object": "organization.spend_alert",
"threshold_amount": 0
}
Update organization spend alert
admin.organization.spend_alerts.update(alert_id, **kwargs) -> OrganizationSpendAlert
post /organization/spend_alerts/{alert_id}
Updates an organization spend alert.
Parameters
-
alert_id: String -
currency: :USDThe currency for the threshold amount.
:USD
-
interval: :monthThe time interval for evaluating spend against the threshold.
:month
-
notification_channel: NotificationChannel{ recipients, type, subject_prefix}Email notification settings for a spend alert.
-
recipients: Array[String]Email addresses that receive the spend alert notification.
-
type: :emailThe notification channel type. Currently only
emailis supported.:email
-
subject_prefix: StringOptional subject prefix for alert emails.
-
-
threshold_amount: IntegerThe alert threshold amount, in cents.
Returns
-
class OrganizationSpendAlertRepresents a spend alert configured at the organization level.
-
id: StringThe identifier, which can be referenced in API endpoints.
-
currency: :USDThe currency for the threshold amount.
:USD
-
interval: :monthThe time interval for evaluating spend against the threshold.
:month
-
notification_channel: NotificationChannel{ recipients, type, subject_prefix}Email notification settings for a spend alert.
-
recipients: Array[String]Email addresses that receive the spend alert notification.
-
type: :emailThe notification channel type. Currently only
emailis supported.:email
-
subject_prefix: StringOptional subject prefix for alert emails.
-
-
object: :"organization.spend_alert"The object type, which is always
organization.spend_alert.:"organization.spend_alert"
-
threshold_amount: IntegerThe alert threshold amount, in cents.
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
organization_spend_alert = openai.admin.organization.spend_alerts.update(
"alert_id",
currency: :USD,
interval: :month,
notification_channel: {recipients: ["string"], type: :email},
threshold_amount: 0
)
puts(organization_spend_alert)
Response
{
"id": "id",
"currency": "USD",
"interval": "month",
"notification_channel": {
"recipients": [
"string"
],
"type": "email",
"subject_prefix": "subject_prefix"
},
"object": "organization.spend_alert",
"threshold_amount": 0
}
Delete organization spend alert
admin.organization.spend_alerts.delete(alert_id) -> OrganizationSpendAlertDeleted
delete /organization/spend_alerts/{alert_id}
Deletes an organization spend alert.
Parameters
alert_id: String
Returns
-
class OrganizationSpendAlertDeletedConfirmation payload returned after deleting an organization spend alert.
-
id: StringThe deleted spend alert ID.
-
deleted: boolWhether the spend alert was deleted.
-
object: :"organization.spend_alert.deleted"Always
organization.spend_alert.deleted.:"organization.spend_alert.deleted"
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
organization_spend_alert_deleted = openai.admin.organization.spend_alerts.delete("alert_id")
puts(organization_spend_alert_deleted)
Response
{
"id": "id",
"deleted": true,
"object": "organization.spend_alert.deleted"
}
Domain Types
Organization Spend Alert
-
class OrganizationSpendAlertRepresents a spend alert configured at the organization level.
-
id: StringThe identifier, which can be referenced in API endpoints.
-
currency: :USDThe currency for the threshold amount.
:USD
-
interval: :monthThe time interval for evaluating spend against the threshold.
:month
-
notification_channel: NotificationChannel{ recipients, type, subject_prefix}Email notification settings for a spend alert.
-
recipients: Array[String]Email addresses that receive the spend alert notification.
-
type: :emailThe notification channel type. Currently only
emailis supported.:email
-
subject_prefix: StringOptional subject prefix for alert emails.
-
-
object: :"organization.spend_alert"The object type, which is always
organization.spend_alert.:"organization.spend_alert"
-
threshold_amount: IntegerThe alert threshold amount, in cents.
-
Organization Spend Alert Deleted
-
class OrganizationSpendAlertDeletedConfirmation payload returned after deleting an organization spend alert.
-
id: StringThe deleted spend alert ID.
-
deleted: boolWhether the spend alert was deleted.
-
object: :"organization.spend_alert.deleted"Always
organization.spend_alert.deleted.:"organization.spend_alert.deleted"
-
Certificates
List organization certificates
admin.organization.certificates.list(**kwargs) -> ConversationCursorPage<CertificateListResponse>
get /organization/certificates
List uploaded certificates for this organization.
Parameters
-
after: StringA cursor for use in pagination.
afteris an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. -
limit: IntegerA limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
-
order: :asc | :descSort order by the
created_attimestamp of the objects.ascfor ascending order anddescfor descending order.-
:asc -
:desc
-
Returns
-
class CertificateListResponseRepresents an individual certificate configured at the organization level.
-
id: StringThe identifier, which can be referenced in API endpoints
-
active: boolWhether the certificate is currently active at the organization level.
-
certificate_details: CertificateDetails{ expires_at, valid_at}-
expires_at: IntegerThe Unix timestamp (in seconds) of when the certificate expires.
-
valid_at: IntegerThe Unix timestamp (in seconds) of when the certificate becomes valid.
-
-
created_at: IntegerThe Unix timestamp (in seconds) of when the certificate was uploaded.
-
name: StringThe name of the certificate.
-
object: :"organization.certificate"The object type, which is always
organization.certificate.:"organization.certificate"
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
page = openai.admin.organization.certificates.list
puts(page)
Response
{
"data": [
{
"id": "id",
"active": true,
"certificate_details": {
"expires_at": 0,
"valid_at": 0
},
"created_at": 0,
"name": "name",
"object": "organization.certificate"
}
],
"first_id": "cert_abc",
"has_more": true,
"last_id": "cert_abc",
"object": "list"
}
Upload certificate
admin.organization.certificates.create(**kwargs) -> Certificate
post /organization/certificates
Upload a certificate to the organization. This does not automatically activate the certificate.
Organizations can upload up to 50 certificates.
Parameters
-
certificate: StringThe certificate content in PEM format
-
name: StringAn optional name for the certificate
Returns
-
class CertificateRepresents an individual
certificateuploaded to the organization.-
id: StringThe identifier, which can be referenced in API endpoints
-
certificate_details: CertificateDetails{ content, expires_at, valid_at}-
content: StringThe content of the certificate in PEM format.
-
expires_at: IntegerThe Unix timestamp (in seconds) of when the certificate expires.
-
valid_at: IntegerThe Unix timestamp (in seconds) of when the certificate becomes valid.
-
-
created_at: IntegerThe Unix timestamp (in seconds) of when the certificate was uploaded.
-
name: StringThe name of the certificate.
-
object: :certificate | :"organization.certificate" | :"organization.project.certificate"The object type.
-
If creating, updating, or getting a specific certificate, the object type is
certificate. -
If listing, activating, or deactivating certificates for the organization, the object type is
organization.certificate. -
If listing, activating, or deactivating certificates for a project, the object type is
organization.project.certificate. -
:certificate -
:"organization.certificate" -
:"organization.project.certificate"
-
-
active: boolWhether the certificate is currently active at the specified scope. Not returned when getting details for a specific certificate.
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
certificate = openai.admin.organization.certificates.create(certificate: "certificate")
puts(certificate)
Response
{
"id": "id",
"certificate_details": {
"content": "content",
"expires_at": 0,
"valid_at": 0
},
"created_at": 0,
"name": "name",
"object": "certificate",
"active": true
}
Get certificate
admin.organization.certificates.retrieve(certificate_id, **kwargs) -> Certificate
get /organization/certificates/{certificate_id}
Get a certificate that has been uploaded to the organization.
You can get a certificate regardless of whether it is active or not.
Parameters
-
certificate_id: String -
include: Array[:content]A list of additional fields to include in the response. Currently the only supported value is
contentto fetch the PEM content of the certificate.:content
Returns
-
class CertificateRepresents an individual
certificateuploaded to the organization.-
id: StringThe identifier, which can be referenced in API endpoints
-
certificate_details: CertificateDetails{ content, expires_at, valid_at}-
content: StringThe content of the certificate in PEM format.
-
expires_at: IntegerThe Unix timestamp (in seconds) of when the certificate expires.
-
valid_at: IntegerThe Unix timestamp (in seconds) of when the certificate becomes valid.
-
-
created_at: IntegerThe Unix timestamp (in seconds) of when the certificate was uploaded.
-
name: StringThe name of the certificate.
-
object: :certificate | :"organization.certificate" | :"organization.project.certificate"The object type.
-
If creating, updating, or getting a specific certificate, the object type is
certificate. -
If listing, activating, or deactivating certificates for the organization, the object type is
organization.certificate. -
If listing, activating, or deactivating certificates for a project, the object type is
organization.project.certificate. -
:certificate -
:"organization.certificate" -
:"organization.project.certificate"
-
-
active: boolWhether the certificate is currently active at the specified scope. Not returned when getting details for a specific certificate.
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
certificate = openai.admin.organization.certificates.retrieve("certificate_id")
puts(certificate)
Response
{
"id": "id",
"certificate_details": {
"content": "content",
"expires_at": 0,
"valid_at": 0
},
"created_at": 0,
"name": "name",
"object": "certificate",
"active": true
}
Modify certificate
admin.organization.certificates.update(certificate_id, **kwargs) -> Certificate
post /organization/certificates/{certificate_id}
Modify a certificate. Note that only the name can be modified.
Parameters
-
certificate_id: String -
name: StringThe updated name for the certificate
Returns
-
class CertificateRepresents an individual
certificateuploaded to the organization.-
id: StringThe identifier, which can be referenced in API endpoints
-
certificate_details: CertificateDetails{ content, expires_at, valid_at}-
content: StringThe content of the certificate in PEM format.
-
expires_at: IntegerThe Unix timestamp (in seconds) of when the certificate expires.
-
valid_at: IntegerThe Unix timestamp (in seconds) of when the certificate becomes valid.
-
-
created_at: IntegerThe Unix timestamp (in seconds) of when the certificate was uploaded.
-
name: StringThe name of the certificate.
-
object: :certificate | :"organization.certificate" | :"organization.project.certificate"The object type.
-
If creating, updating, or getting a specific certificate, the object type is
certificate. -
If listing, activating, or deactivating certificates for the organization, the object type is
organization.certificate. -
If listing, activating, or deactivating certificates for a project, the object type is
organization.project.certificate. -
:certificate -
:"organization.certificate" -
:"organization.project.certificate"
-
-
active: boolWhether the certificate is currently active at the specified scope. Not returned when getting details for a specific certificate.
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
certificate = openai.admin.organization.certificates.update("certificate_id")
puts(certificate)
Response
{
"id": "id",
"certificate_details": {
"content": "content",
"expires_at": 0,
"valid_at": 0
},
"created_at": 0,
"name": "name",
"object": "certificate",
"active": true
}
Delete certificate
admin.organization.certificates.delete(certificate_id) -> CertificateDeleteResponse
delete /organization/certificates/{certificate_id}
Delete a certificate from the organization.
The certificate must be inactive for the organization and all projects.
Parameters
certificate_id: String
Returns
-
class CertificateDeleteResponse-
id: StringThe ID of the certificate that was deleted.
-
object: :"certificate.deleted"The object type, must be
certificate.deleted.:"certificate.deleted"
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
certificate = openai.admin.organization.certificates.delete("certificate_id")
puts(certificate)
Response
{
"id": "id",
"object": "certificate.deleted"
}
Activate certificates for organization
admin.organization.certificates.activate(**kwargs) -> Page<CertificateActivateResponse>
post /organization/certificates/activate
Activate certificates at the organization level.
You can atomically and idempotently activate up to 10 certificates at a time.
Parameters
certificate_ids: Array[String]
Returns
-
class CertificateActivateResponseRepresents an individual certificate configured at the organization level.
-
id: StringThe identifier, which can be referenced in API endpoints
-
active: boolWhether the certificate is currently active at the organization level.
-
certificate_details: CertificateDetails{ expires_at, valid_at}-
expires_at: IntegerThe Unix timestamp (in seconds) of when the certificate expires.
-
valid_at: IntegerThe Unix timestamp (in seconds) of when the certificate becomes valid.
-
-
created_at: IntegerThe Unix timestamp (in seconds) of when the certificate was uploaded.
-
name: StringThe name of the certificate.
-
object: :"organization.certificate"The object type, which is always
organization.certificate.:"organization.certificate"
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
page = openai.admin.organization.certificates.activate(certificate_ids: ["cert_abc"])
puts(page)
Response
{
"data": [
{
"id": "id",
"active": true,
"certificate_details": {
"expires_at": 0,
"valid_at": 0
},
"created_at": 0,
"name": "name",
"object": "organization.certificate"
}
],
"object": "organization.certificate.activation"
}
Deactivate certificates for organization
admin.organization.certificates.deactivate(**kwargs) -> Page<CertificateDeactivateResponse>
post /organization/certificates/deactivate
Deactivate certificates at the organization level.
You can atomically and idempotently deactivate up to 10 certificates at a time.
Parameters
certificate_ids: Array[String]
Returns
-
class CertificateDeactivateResponseRepresents an individual certificate configured at the organization level.
-
id: StringThe identifier, which can be referenced in API endpoints
-
active: boolWhether the certificate is currently active at the organization level.
-
certificate_details: CertificateDetails{ expires_at, valid_at}-
expires_at: IntegerThe Unix timestamp (in seconds) of when the certificate expires.
-
valid_at: IntegerThe Unix timestamp (in seconds) of when the certificate becomes valid.
-
-
created_at: IntegerThe Unix timestamp (in seconds) of when the certificate was uploaded.
-
name: StringThe name of the certificate.
-
object: :"organization.certificate"The object type, which is always
organization.certificate.:"organization.certificate"
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
page = openai.admin.organization.certificates.deactivate(certificate_ids: ["cert_abc"])
puts(page)
Response
{
"data": [
{
"id": "id",
"active": true,
"certificate_details": {
"expires_at": 0,
"valid_at": 0
},
"created_at": 0,
"name": "name",
"object": "organization.certificate"
}
],
"object": "organization.certificate.deactivation"
}
Domain Types
Certificate
-
class CertificateRepresents an individual
certificateuploaded to the organization.-
id: StringThe identifier, which can be referenced in API endpoints
-
certificate_details: CertificateDetails{ content, expires_at, valid_at}-
content: StringThe content of the certificate in PEM format.
-
expires_at: IntegerThe Unix timestamp (in seconds) of when the certificate expires.
-
valid_at: IntegerThe Unix timestamp (in seconds) of when the certificate becomes valid.
-
-
created_at: IntegerThe Unix timestamp (in seconds) of when the certificate was uploaded.
-
name: StringThe name of the certificate.
-
object: :certificate | :"organization.certificate" | :"organization.project.certificate"The object type.
-
If creating, updating, or getting a specific certificate, the object type is
certificate. -
If listing, activating, or deactivating certificates for the organization, the object type is
organization.certificate. -
If listing, activating, or deactivating certificates for a project, the object type is
organization.project.certificate. -
:certificate -
:"organization.certificate" -
:"organization.project.certificate"
-
-
active: boolWhether the certificate is currently active at the specified scope. Not returned when getting details for a specific certificate.
-
Certificate List Response
-
class CertificateListResponseRepresents an individual certificate configured at the organization level.
-
id: StringThe identifier, which can be referenced in API endpoints
-
active: boolWhether the certificate is currently active at the organization level.
-
certificate_details: CertificateDetails{ expires_at, valid_at}-
expires_at: IntegerThe Unix timestamp (in seconds) of when the certificate expires.
-
valid_at: IntegerThe Unix timestamp (in seconds) of when the certificate becomes valid.
-
-
created_at: IntegerThe Unix timestamp (in seconds) of when the certificate was uploaded.
-
name: StringThe name of the certificate.
-
object: :"organization.certificate"The object type, which is always
organization.certificate.:"organization.certificate"
-
Certificate Delete Response
-
class CertificateDeleteResponse-
id: StringThe ID of the certificate that was deleted.
-
object: :"certificate.deleted"The object type, must be
certificate.deleted.:"certificate.deleted"
-
Certificate Activate Response
-
class CertificateActivateResponseRepresents an individual certificate configured at the organization level.
-
id: StringThe identifier, which can be referenced in API endpoints
-
active: boolWhether the certificate is currently active at the organization level.
-
certificate_details: CertificateDetails{ expires_at, valid_at}-
expires_at: IntegerThe Unix timestamp (in seconds) of when the certificate expires.
-
valid_at: IntegerThe Unix timestamp (in seconds) of when the certificate becomes valid.
-
-
created_at: IntegerThe Unix timestamp (in seconds) of when the certificate was uploaded.
-
name: StringThe name of the certificate.
-
object: :"organization.certificate"The object type, which is always
organization.certificate.:"organization.certificate"
-
Certificate Deactivate Response
-
class CertificateDeactivateResponseRepresents an individual certificate configured at the organization level.
-
id: StringThe identifier, which can be referenced in API endpoints
-
active: boolWhether the certificate is currently active at the organization level.
-
certificate_details: CertificateDetails{ expires_at, valid_at}-
expires_at: IntegerThe Unix timestamp (in seconds) of when the certificate expires.
-
valid_at: IntegerThe Unix timestamp (in seconds) of when the certificate becomes valid.
-
-
created_at: IntegerThe Unix timestamp (in seconds) of when the certificate was uploaded.
-
name: StringThe name of the certificate.
-
object: :"organization.certificate"The object type, which is always
organization.certificate.:"organization.certificate"
-
Projects
List projects
admin.organization.projects.list(**kwargs) -> ConversationCursorPage<Project>
get /organization/projects
Returns a list of projects.
Parameters
-
after: StringA cursor for use in pagination.
afteris an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. -
include_archived: boolIf
truereturns all projects including those that have beenarchived. Archived projects are not included by default. -
limit: IntegerA limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
Returns
-
class ProjectRepresents an individual project.
-
id: StringThe identifier, which can be referenced in API endpoints
-
created_at: IntegerThe Unix timestamp (in seconds) of when the project was created.
-
object: :"organization.project"The object type, which is always
organization.project:"organization.project"
-
archived_at: IntegerThe Unix timestamp (in seconds) of when the project was archived or
null. -
external_key_id: StringThe external key associated with the project.
-
name: StringThe name of the project. This appears in reporting.
-
status: Stringactiveorarchived
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
page = openai.admin.organization.projects.list
puts(page)
Response
{
"data": [
{
"id": "id",
"created_at": 0,
"object": "organization.project",
"archived_at": 0,
"external_key_id": "external_key_id",
"name": "name",
"status": "status"
}
],
"has_more": true,
"object": "list",
"first_id": "first_id",
"last_id": "last_id"
}
Create project
admin.organization.projects.create(**kwargs) -> Project
post /organization/projects
Create a new project in the organization. Projects can be created and archived, but cannot be deleted.
Parameters
-
name: StringThe friendly name of the project, this name appears in reports.
-
external_key_id: StringExternal key ID to associate with the project.
-
geography: StringCreate the project with the specified data residency region. Your organization must have access to Data residency functionality in order to use. See data residency controls to review the functionality and limitations of setting this field.
Returns
-
class ProjectRepresents an individual project.
-
id: StringThe identifier, which can be referenced in API endpoints
-
created_at: IntegerThe Unix timestamp (in seconds) of when the project was created.
-
object: :"organization.project"The object type, which is always
organization.project:"organization.project"
-
archived_at: IntegerThe Unix timestamp (in seconds) of when the project was archived or
null. -
external_key_id: StringThe external key associated with the project.
-
name: StringThe name of the project. This appears in reporting.
-
status: Stringactiveorarchived
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
project = openai.admin.organization.projects.create(name: "name")
puts(project)
Response
{
"id": "id",
"created_at": 0,
"object": "organization.project",
"archived_at": 0,
"external_key_id": "external_key_id",
"name": "name",
"status": "status"
}
Retrieve project
admin.organization.projects.retrieve(project_id) -> Project
get /organization/projects/{project_id}
Retrieves a project.
Parameters
project_id: String
Returns
-
class ProjectRepresents an individual project.
-
id: StringThe identifier, which can be referenced in API endpoints
-
created_at: IntegerThe Unix timestamp (in seconds) of when the project was created.
-
object: :"organization.project"The object type, which is always
organization.project:"organization.project"
-
archived_at: IntegerThe Unix timestamp (in seconds) of when the project was archived or
null. -
external_key_id: StringThe external key associated with the project.
-
name: StringThe name of the project. This appears in reporting.
-
status: Stringactiveorarchived
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
project = openai.admin.organization.projects.retrieve("project_id")
puts(project)
Response
{
"id": "id",
"created_at": 0,
"object": "organization.project",
"archived_at": 0,
"external_key_id": "external_key_id",
"name": "name",
"status": "status"
}
Modify project
admin.organization.projects.update(project_id, **kwargs) -> Project
post /organization/projects/{project_id}
Modifies a project in the organization.
Parameters
-
project_id: String -
external_key_id: StringExternal key ID to associate with the project.
-
geography: StringGeography for the project.
-
name: StringThe updated name of the project, this name appears in reports.
Returns
-
class ProjectRepresents an individual project.
-
id: StringThe identifier, which can be referenced in API endpoints
-
created_at: IntegerThe Unix timestamp (in seconds) of when the project was created.
-
object: :"organization.project"The object type, which is always
organization.project:"organization.project"
-
archived_at: IntegerThe Unix timestamp (in seconds) of when the project was archived or
null. -
external_key_id: StringThe external key associated with the project.
-
name: StringThe name of the project. This appears in reporting.
-
status: Stringactiveorarchived
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
project = openai.admin.organization.projects.update("project_id")
puts(project)
Response
{
"id": "id",
"created_at": 0,
"object": "organization.project",
"archived_at": 0,
"external_key_id": "external_key_id",
"name": "name",
"status": "status"
}
Archive project
admin.organization.projects.archive(project_id) -> Project
post /organization/projects/{project_id}/archive
Archives a project in the organization. Archived projects cannot be used or updated.
Parameters
project_id: String
Returns
-
class ProjectRepresents an individual project.
-
id: StringThe identifier, which can be referenced in API endpoints
-
created_at: IntegerThe Unix timestamp (in seconds) of when the project was created.
-
object: :"organization.project"The object type, which is always
organization.project:"organization.project"
-
archived_at: IntegerThe Unix timestamp (in seconds) of when the project was archived or
null. -
external_key_id: StringThe external key associated with the project.
-
name: StringThe name of the project. This appears in reporting.
-
status: Stringactiveorarchived
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
project = openai.admin.organization.projects.archive("project_id")
puts(project)
Response
{
"id": "id",
"created_at": 0,
"object": "organization.project",
"archived_at": 0,
"external_key_id": "external_key_id",
"name": "name",
"status": "status"
}
Domain Types
Project
-
class ProjectRepresents an individual project.
-
id: StringThe identifier, which can be referenced in API endpoints
-
created_at: IntegerThe Unix timestamp (in seconds) of when the project was created.
-
object: :"organization.project"The object type, which is always
organization.project:"organization.project"
-
archived_at: IntegerThe Unix timestamp (in seconds) of when the project was archived or
null. -
external_key_id: StringThe external key associated with the project.
-
name: StringThe name of the project. This appears in reporting.
-
status: Stringactiveorarchived
-
Users
List project users
admin.organization.projects.users.list(project_id, **kwargs) -> ConversationCursorPage<ProjectUser>
get /organization/projects/{project_id}/users
Returns a list of users in the project.
Parameters
-
project_id: String -
after: StringA cursor for use in pagination.
afteris an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. -
limit: IntegerA limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
Returns
-
class ProjectUserRepresents an individual user in a project.
-
id: StringThe identifier, which can be referenced in API endpoints
-
added_at: IntegerThe Unix timestamp (in seconds) of when the project was added.
-
object: :"organization.project.user"The object type, which is always
organization.project.user:"organization.project.user"
-
role: Stringownerormember -
email: StringThe email address of the user
-
name: StringThe name of the user
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
page = openai.admin.organization.projects.users.list("project_id")
puts(page)
Response
{
"data": [
{
"id": "id",
"added_at": 0,
"object": "organization.project.user",
"role": "role",
"email": "email",
"name": "name"
}
],
"has_more": true,
"object": "object",
"first_id": "first_id",
"last_id": "last_id"
}
Create project user
admin.organization.projects.users.create(project_id, **kwargs) -> ProjectUser
post /organization/projects/{project_id}/users
Adds a user to the project. Users must already be members of the organization to be added to a project.
Parameters
-
project_id: String -
role: Stringownerormember -
email: StringEmail of the user to add.
-
user_id: StringThe ID of the user.
Returns
-
class ProjectUserRepresents an individual user in a project.
-
id: StringThe identifier, which can be referenced in API endpoints
-
added_at: IntegerThe Unix timestamp (in seconds) of when the project was added.
-
object: :"organization.project.user"The object type, which is always
organization.project.user:"organization.project.user"
-
role: Stringownerormember -
email: StringThe email address of the user
-
name: StringThe name of the user
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
project_user = openai.admin.organization.projects.users.create("project_id", role: "role")
puts(project_user)
Response
{
"id": "id",
"added_at": 0,
"object": "organization.project.user",
"role": "role",
"email": "email",
"name": "name"
}
Retrieve project user
admin.organization.projects.users.retrieve(user_id, **kwargs) -> ProjectUser
get /organization/projects/{project_id}/users/{user_id}
Retrieves a user in the project.
Parameters
-
project_id: String -
user_id: String
Returns
-
class ProjectUserRepresents an individual user in a project.
-
id: StringThe identifier, which can be referenced in API endpoints
-
added_at: IntegerThe Unix timestamp (in seconds) of when the project was added.
-
object: :"organization.project.user"The object type, which is always
organization.project.user:"organization.project.user"
-
role: Stringownerormember -
email: StringThe email address of the user
-
name: StringThe name of the user
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
project_user = openai.admin.organization.projects.users.retrieve("user_id", project_id: "project_id")
puts(project_user)
Response
{
"id": "id",
"added_at": 0,
"object": "organization.project.user",
"role": "role",
"email": "email",
"name": "name"
}
Modify project user
admin.organization.projects.users.update(user_id, **kwargs) -> ProjectUser
post /organization/projects/{project_id}/users/{user_id}
Modifies a user's role in the project.
Parameters
-
project_id: String -
user_id: String -
role: Stringownerormember
Returns
-
class ProjectUserRepresents an individual user in a project.
-
id: StringThe identifier, which can be referenced in API endpoints
-
added_at: IntegerThe Unix timestamp (in seconds) of when the project was added.
-
object: :"organization.project.user"The object type, which is always
organization.project.user:"organization.project.user"
-
role: Stringownerormember -
email: StringThe email address of the user
-
name: StringThe name of the user
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
project_user = openai.admin.organization.projects.users.update("user_id", project_id: "project_id")
puts(project_user)
Response
{
"id": "id",
"added_at": 0,
"object": "organization.project.user",
"role": "role",
"email": "email",
"name": "name"
}
Delete project user
admin.organization.projects.users.delete(user_id, **kwargs) -> UserDeleteResponse
delete /organization/projects/{project_id}/users/{user_id}
Deletes a user from the project.
Returns confirmation of project user deletion, or an error if the project is archived (archived projects have no users).
Parameters
-
project_id: String -
user_id: String
Returns
-
class UserDeleteResponse-
id: String -
deleted: bool -
object: :"organization.project.user.deleted":"organization.project.user.deleted"
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
user = openai.admin.organization.projects.users.delete("user_id", project_id: "project_id")
puts(user)
Response
{
"id": "id",
"deleted": true,
"object": "organization.project.user.deleted"
}
Domain Types
Project User
-
class ProjectUserRepresents an individual user in a project.
-
id: StringThe identifier, which can be referenced in API endpoints
-
added_at: IntegerThe Unix timestamp (in seconds) of when the project was added.
-
object: :"organization.project.user"The object type, which is always
organization.project.user:"organization.project.user"
-
role: Stringownerormember -
email: StringThe email address of the user
-
name: StringThe name of the user
-
User Delete Response
-
class UserDeleteResponse-
id: String -
deleted: bool -
object: :"organization.project.user.deleted":"organization.project.user.deleted"
-
Roles
List project user role assignments
admin.organization.projects.users.roles.list(user_id, **kwargs) -> NextCursorPage<RoleListResponse>
get /projects/{project_id}/users/{user_id}/roles
Lists the project roles assigned to a user within a project.
Parameters
-
project_id: String -
user_id: String -
after: StringCursor for pagination. Provide the value from the previous response's
nextfield to continue listing project roles. -
limit: IntegerA limit on the number of project role assignments to return.
-
order: :asc | :descSort order for the returned project roles.
-
:asc -
:desc
-
Returns
-
class RoleListResponseDetailed information about a role assignment entry returned when listing assignments.
-
id: StringIdentifier for the role.
-
assignment_sources: Array[AssignmentSource{ principal_id, principal_type}]Principals from which the role assignment is inherited, when available.
-
principal_id: String -
principal_type: String
-
-
created_at: IntegerWhen the role was created.
-
created_by: StringIdentifier of the actor who created the role.
-
created_by_user_obj: Hash[Symbol, untyped]User details for the actor that created the role, when available.
-
description: StringDescription of the role.
-
metadata: Hash[Symbol, untyped]Arbitrary metadata stored on the role.
-
name: StringName of the role.
-
permissions: Array[String]Permissions associated with the role.
-
predefined_role: boolWhether the role is predefined by OpenAI.
-
resource_type: StringResource type the role applies to.
-
updated_at: IntegerWhen the role was last updated.
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
page = openai.admin.organization.projects.users.roles.list("user_id", project_id: "project_id")
puts(page)
Response
{
"data": [
{
"id": "id",
"assignment_sources": [
{
"principal_id": "principal_id",
"principal_type": "principal_type"
}
],
"created_at": 0,
"created_by": "created_by",
"created_by_user_obj": {
"foo": "bar"
},
"description": "description",
"metadata": {
"foo": "bar"
},
"name": "name",
"permissions": [
"string"
],
"predefined_role": true,
"resource_type": "resource_type",
"updated_at": 0
}
],
"has_more": true,
"next": "next",
"object": "list"
}
Assign project role to user
admin.organization.projects.users.roles.create(user_id, **kwargs) -> RoleCreateResponse
post /projects/{project_id}/users/{user_id}/roles
Assigns a project role to a user within a project.
Parameters
-
project_id: String -
user_id: String -
role_id: StringIdentifier of the role to assign.
Returns
-
class RoleCreateResponseRole assignment linking a user to a role.
-
object: :"user.role"Always
user.role.:"user.role"
-
role: RoleDetails about a role that can be assigned through the public Roles API.
-
id: StringIdentifier for the role.
-
description: StringOptional description of the role.
-
name: StringUnique name for the role.
-
object: :roleAlways
role.:role
-
permissions: Array[String]Permissions granted by the role.
-
predefined_role: boolWhether the role is predefined and managed by OpenAI.
-
resource_type: StringResource type the role is bound to (for example
api.organizationorapi.project).
-
-
user: OrganizationUserRepresents an individual
userwithin an organization.-
id: StringThe identifier, which can be referenced in API endpoints
-
added_at: IntegerThe Unix timestamp (in seconds) of when the user was added.
-
object: :"organization.user"The object type, which is always
organization.user:"organization.user"
-
api_key_last_used_at: IntegerThe Unix timestamp (in seconds) of the user's last API key usage.
-
created: IntegerThe Unix timestamp (in seconds) of when the user was created.
-
developer_persona: StringThe developer persona metadata for the user.
-
email: StringThe email address of the user
-
is_default: boolWhether this is the organization's default user.
-
is_scale_tier_authorized_purchaser: boolWhether the user is an authorized purchaser for Scale Tier.
-
is_scim_managed: boolWhether the user is managed through SCIM.
-
is_service_account: boolWhether the user is a service account.
-
name: StringThe name of the user
-
projects: Projects{ data, object}Projects associated with the user, if included.
-
data: Array[Data{ id, name, role}]-
id: String -
name: String -
role: String
-
-
object: :list:list
-
-
role: Stringownerorreader -
technical_level: StringThe technical level metadata for the user.
-
user: User{ id, object, banned, 5 more}Nested user details.
-
id: String -
object: :user:user
-
banned: bool -
banned_at: Integer -
email: String -
enabled: bool -
name: String -
picture: String
-
-
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
role = openai.admin.organization.projects.users.roles.create(
"user_id",
project_id: "project_id",
role_id: "role_id"
)
puts(role)
Response
{
"object": "user.role",
"role": {
"id": "id",
"description": "description",
"name": "name",
"object": "role",
"permissions": [
"string"
],
"predefined_role": true,
"resource_type": "resource_type"
},
"user": {
"id": "id",
"added_at": 0,
"object": "organization.user",
"api_key_last_used_at": 0,
"created": 0,
"developer_persona": "developer_persona",
"email": "email",
"is_default": true,
"is_scale_tier_authorized_purchaser": true,
"is_scim_managed": true,
"is_service_account": true,
"name": "name",
"projects": {
"data": [
{
"id": "id",
"name": "name",
"role": "role"
}
],
"object": "list"
},
"role": "role",
"technical_level": "technical_level",
"user": {
"id": "id",
"object": "user",
"banned": true,
"banned_at": 0,
"email": "email",
"enabled": true,
"name": "name",
"picture": "picture"
}
}
}
Retrieve project user role
admin.organization.projects.users.roles.retrieve(role_id, **kwargs) -> RoleRetrieveResponse
get /projects/{project_id}/users/{user_id}/roles/{role_id}
Retrieves a project role assigned to a user.
Parameters
-
project_id: String -
user_id: String -
role_id: String
Returns
-
class RoleRetrieveResponseDetailed information about a role assignment entry returned when listing assignments.
-
id: StringIdentifier for the role.
-
assignment_sources: Array[AssignmentSource{ principal_id, principal_type}]Principals from which the role assignment is inherited, when available.
-
principal_id: String -
principal_type: String
-
-
created_at: IntegerWhen the role was created.
-
created_by: StringIdentifier of the actor who created the role.
-
created_by_user_obj: Hash[Symbol, untyped]User details for the actor that created the role, when available.
-
description: StringDescription of the role.
-
metadata: Hash[Symbol, untyped]Arbitrary metadata stored on the role.
-
name: StringName of the role.
-
permissions: Array[String]Permissions associated with the role.
-
predefined_role: boolWhether the role is predefined by OpenAI.
-
resource_type: StringResource type the role applies to.
-
updated_at: IntegerWhen the role was last updated.
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
role = openai.admin.organization.projects.users.roles.retrieve(
"role_id",
project_id: "project_id",
user_id: "user_id"
)
puts(role)
Response
{
"id": "id",
"assignment_sources": [
{
"principal_id": "principal_id",
"principal_type": "principal_type"
}
],
"created_at": 0,
"created_by": "created_by",
"created_by_user_obj": {
"foo": "bar"
},
"description": "description",
"metadata": {
"foo": "bar"
},
"name": "name",
"permissions": [
"string"
],
"predefined_role": true,
"resource_type": "resource_type",
"updated_at": 0
}
Unassign project role from user
admin.organization.projects.users.roles.delete(role_id, **kwargs) -> RoleDeleteResponse
delete /projects/{project_id}/users/{user_id}/roles/{role_id}
Unassigns a project role from a user within a project.
Parameters
-
project_id: String -
user_id: String -
role_id: String
Returns
-
class RoleDeleteResponseConfirmation payload returned after unassigning a role.
-
deleted: boolWhether the assignment was removed.
-
object: StringIdentifier for the deleted assignment, such as
group.role.deletedoruser.role.deleted.
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
role = openai.admin.organization.projects.users.roles.delete(
"role_id",
project_id: "project_id",
user_id: "user_id"
)
puts(role)
Response
{
"deleted": true,
"object": "object"
}
Domain Types
Role List Response
-
class RoleListResponseDetailed information about a role assignment entry returned when listing assignments.
-
id: StringIdentifier for the role.
-
assignment_sources: Array[AssignmentSource{ principal_id, principal_type}]Principals from which the role assignment is inherited, when available.
-
principal_id: String -
principal_type: String
-
-
created_at: IntegerWhen the role was created.
-
created_by: StringIdentifier of the actor who created the role.
-
created_by_user_obj: Hash[Symbol, untyped]User details for the actor that created the role, when available.
-
description: StringDescription of the role.
-
metadata: Hash[Symbol, untyped]Arbitrary metadata stored on the role.
-
name: StringName of the role.
-
permissions: Array[String]Permissions associated with the role.
-
predefined_role: boolWhether the role is predefined by OpenAI.
-
resource_type: StringResource type the role applies to.
-
updated_at: IntegerWhen the role was last updated.
-
Role Create Response
-
class RoleCreateResponseRole assignment linking a user to a role.
-
object: :"user.role"Always
user.role.:"user.role"
-
role: RoleDetails about a role that can be assigned through the public Roles API.
-
id: StringIdentifier for the role.
-
description: StringOptional description of the role.
-
name: StringUnique name for the role.
-
object: :roleAlways
role.:role
-
permissions: Array[String]Permissions granted by the role.
-
predefined_role: boolWhether the role is predefined and managed by OpenAI.
-
resource_type: StringResource type the role is bound to (for example
api.organizationorapi.project).
-
-
user: OrganizationUserRepresents an individual
userwithin an organization.-
id: StringThe identifier, which can be referenced in API endpoints
-
added_at: IntegerThe Unix timestamp (in seconds) of when the user was added.
-
object: :"organization.user"The object type, which is always
organization.user:"organization.user"
-
api_key_last_used_at: IntegerThe Unix timestamp (in seconds) of the user's last API key usage.
-
created: IntegerThe Unix timestamp (in seconds) of when the user was created.
-
developer_persona: StringThe developer persona metadata for the user.
-
email: StringThe email address of the user
-
is_default: boolWhether this is the organization's default user.
-
is_scale_tier_authorized_purchaser: boolWhether the user is an authorized purchaser for Scale Tier.
-
is_scim_managed: boolWhether the user is managed through SCIM.
-
is_service_account: boolWhether the user is a service account.
-
name: StringThe name of the user
-
projects: Projects{ data, object}Projects associated with the user, if included.
-
data: Array[Data{ id, name, role}]-
id: String -
name: String -
role: String
-
-
object: :list:list
-
-
role: Stringownerorreader -
technical_level: StringThe technical level metadata for the user.
-
user: User{ id, object, banned, 5 more}Nested user details.
-
id: String -
object: :user:user
-
banned: bool -
banned_at: Integer -
email: String -
enabled: bool -
name: String -
picture: String
-
-
-
Role Retrieve Response
-
class RoleRetrieveResponseDetailed information about a role assignment entry returned when listing assignments.
-
id: StringIdentifier for the role.
-
assignment_sources: Array[AssignmentSource{ principal_id, principal_type}]Principals from which the role assignment is inherited, when available.
-
principal_id: String -
principal_type: String
-
-
created_at: IntegerWhen the role was created.
-
created_by: StringIdentifier of the actor who created the role.
-
created_by_user_obj: Hash[Symbol, untyped]User details for the actor that created the role, when available.
-
description: StringDescription of the role.
-
metadata: Hash[Symbol, untyped]Arbitrary metadata stored on the role.
-
name: StringName of the role.
-
permissions: Array[String]Permissions associated with the role.
-
predefined_role: boolWhether the role is predefined by OpenAI.
-
resource_type: StringResource type the role applies to.
-
updated_at: IntegerWhen the role was last updated.
-
Role Delete Response
-
class RoleDeleteResponseConfirmation payload returned after unassigning a role.
-
deleted: boolWhether the assignment was removed.
-
object: StringIdentifier for the deleted assignment, such as
group.role.deletedoruser.role.deleted.
-
Service Accounts
List project service accounts
admin.organization.projects.service_accounts.list(project_id, **kwargs) -> ConversationCursorPage<ProjectServiceAccount>
get /organization/projects/{project_id}/service_accounts
Returns a list of service accounts in the project.
Parameters
-
project_id: String -
after: StringA cursor for use in pagination.
afteris an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. -
limit: IntegerA limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
Returns
-
class ProjectServiceAccountRepresents an individual service account in a project.
-
id: StringThe identifier, which can be referenced in API endpoints
-
created_at: IntegerThe Unix timestamp (in seconds) of when the service account was created
-
name: StringThe name of the service account
-
object: :"organization.project.service_account"The object type, which is always
organization.project.service_account:"organization.project.service_account"
-
role: :owner | :memberownerormember-
:owner -
:member
-
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
page = openai.admin.organization.projects.service_accounts.list("project_id")
puts(page)
Response
{
"data": [
{
"id": "id",
"created_at": 0,
"name": "name",
"object": "organization.project.service_account",
"role": "owner"
}
],
"has_more": true,
"object": "list",
"first_id": "first_id",
"last_id": "last_id"
}
Create project service account
admin.organization.projects.service_accounts.create(project_id, **kwargs) -> ServiceAccountCreateResponse
post /organization/projects/{project_id}/service_accounts
Creates a new service account in the project. This also returns an unredacted API key for the service account.
Parameters
-
project_id: String -
name: StringThe name of the service account being created.
Returns
-
class ServiceAccountCreateResponse-
id: String -
api_key: APIKey{ id, created_at, name, 2 more}-
id: String -
created_at: Integer -
name: String -
object: :"organization.project.service_account.api_key"The object type, which is always
organization.project.service_account.api_key:"organization.project.service_account.api_key"
-
value: String
-
-
created_at: Integer -
name: String -
object: :"organization.project.service_account":"organization.project.service_account"
-
role: :memberService accounts can only have one role of type
member:member
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
service_account = openai.admin.organization.projects.service_accounts.create("project_id", name: "name")
puts(service_account)
Response
{
"id": "id",
"api_key": {
"id": "id",
"created_at": 0,
"name": "name",
"object": "organization.project.service_account.api_key",
"value": "value"
},
"created_at": 0,
"name": "name",
"object": "organization.project.service_account",
"role": "member"
}
Retrieve project service account
admin.organization.projects.service_accounts.retrieve(service_account_id, **kwargs) -> ProjectServiceAccount
get /organization/projects/{project_id}/service_accounts/{service_account_id}
Retrieves a service account in the project.
Parameters
-
project_id: String -
service_account_id: String
Returns
-
class ProjectServiceAccountRepresents an individual service account in a project.
-
id: StringThe identifier, which can be referenced in API endpoints
-
created_at: IntegerThe Unix timestamp (in seconds) of when the service account was created
-
name: StringThe name of the service account
-
object: :"organization.project.service_account"The object type, which is always
organization.project.service_account:"organization.project.service_account"
-
role: :owner | :memberownerormember-
:owner -
:member
-
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
project_service_account = openai.admin.organization.projects.service_accounts.retrieve(
"service_account_id",
project_id: "project_id"
)
puts(project_service_account)
Response
{
"id": "id",
"created_at": 0,
"name": "name",
"object": "organization.project.service_account",
"role": "owner"
}
Update project service account
admin.organization.projects.service_accounts.update(service_account_id, **kwargs) -> ProjectServiceAccount
post /organization/projects/{project_id}/service_accounts/{service_account_id}
Updates a service account in the project.
Parameters
-
project_id: String -
service_account_id: String -
name: StringThe updated service account name.
-
role: :member | :ownerThe updated service account role.
-
:member -
:owner
-
Returns
-
class ProjectServiceAccountRepresents an individual service account in a project.
-
id: StringThe identifier, which can be referenced in API endpoints
-
created_at: IntegerThe Unix timestamp (in seconds) of when the service account was created
-
name: StringThe name of the service account
-
object: :"organization.project.service_account"The object type, which is always
organization.project.service_account:"organization.project.service_account"
-
role: :owner | :memberownerormember-
:owner -
:member
-
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
project_service_account = openai.admin.organization.projects.service_accounts.update("service_account_id", project_id: "project_id")
puts(project_service_account)
Response
{
"id": "id",
"created_at": 0,
"name": "name",
"object": "organization.project.service_account",
"role": "owner"
}
Delete project service account
admin.organization.projects.service_accounts.delete(service_account_id, **kwargs) -> ServiceAccountDeleteResponse
delete /organization/projects/{project_id}/service_accounts/{service_account_id}
Deletes a service account from the project.
Returns confirmation of service account deletion, or an error if the project is archived (archived projects have no service accounts).
Parameters
-
project_id: String -
service_account_id: String
Returns
-
class ServiceAccountDeleteResponse-
id: String -
deleted: bool -
object: :"organization.project.service_account.deleted":"organization.project.service_account.deleted"
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
service_account = openai.admin.organization.projects.service_accounts.delete("service_account_id", project_id: "project_id")
puts(service_account)
Response
{
"id": "id",
"deleted": true,
"object": "organization.project.service_account.deleted"
}
Domain Types
Project Service Account
-
class ProjectServiceAccountRepresents an individual service account in a project.
-
id: StringThe identifier, which can be referenced in API endpoints
-
created_at: IntegerThe Unix timestamp (in seconds) of when the service account was created
-
name: StringThe name of the service account
-
object: :"organization.project.service_account"The object type, which is always
organization.project.service_account:"organization.project.service_account"
-
role: :owner | :memberownerormember-
:owner -
:member
-
-
Service Account Create Response
-
class ServiceAccountCreateResponse-
id: String -
api_key: APIKey{ id, created_at, name, 2 more}-
id: String -
created_at: Integer -
name: String -
object: :"organization.project.service_account.api_key"The object type, which is always
organization.project.service_account.api_key:"organization.project.service_account.api_key"
-
value: String
-
-
created_at: Integer -
name: String -
object: :"organization.project.service_account":"organization.project.service_account"
-
role: :memberService accounts can only have one role of type
member:member
-
Service Account Delete Response
-
class ServiceAccountDeleteResponse-
id: String -
deleted: bool -
object: :"organization.project.service_account.deleted":"organization.project.service_account.deleted"
-
API Keys
List project API keys
admin.organization.projects.api_keys.list(project_id, **kwargs) -> ConversationCursorPage<ProjectAPIKey>
get /organization/projects/{project_id}/api_keys
Returns a list of API keys in the project.
Parameters
-
project_id: String -
after: StringA cursor for use in pagination.
afteris an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. -
limit: IntegerA limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
Returns
-
class ProjectAPIKeyRepresents an individual API key in a project.
-
id: StringThe identifier, which can be referenced in API endpoints
-
created_at: IntegerThe Unix timestamp (in seconds) of when the API key was created
-
last_used_at: IntegerThe Unix timestamp (in seconds) of when the API key was last used.
-
name: StringThe name of the API key
-
object: :"organization.project.api_key"The object type, which is always
organization.project.api_key:"organization.project.api_key"
-
owner: Owner{ service_account, type, user}-
service_account: ServiceAccount{ id, created_at, name, role}The service account that owns a project API key.
-
id: StringThe identifier, which can be referenced in API endpoints
-
created_at: IntegerThe Unix timestamp (in seconds) of when the service account was created.
-
name: StringThe name of the service account.
-
role: StringThe service account's project role.
-
-
type: :user | :service_accountuserorservice_account-
:user -
:service_account
-
-
user: User{ id, created_at, email, 2 more}The user that owns a project API key.
-
id: StringThe identifier, which can be referenced in API endpoints
-
created_at: IntegerThe Unix timestamp (in seconds) of when the user was created.
-
email: StringThe email address of the user.
-
name: StringThe name of the user.
-
role: StringThe user's project role.
-
-
-
redacted_value: StringThe redacted value of the API key
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
page = openai.admin.organization.projects.api_keys.list("project_id")
puts(page)
Response
{
"data": [
{
"id": "id",
"created_at": 0,
"last_used_at": 0,
"name": "name",
"object": "organization.project.api_key",
"owner": {
"service_account": {
"id": "id",
"created_at": 0,
"name": "name",
"role": "role"
},
"type": "user",
"user": {
"id": "id",
"created_at": 0,
"email": "email",
"name": "name",
"role": "role"
}
},
"redacted_value": "redacted_value"
}
],
"has_more": true,
"object": "list",
"first_id": "first_id",
"last_id": "last_id"
}
Retrieve project API key
admin.organization.projects.api_keys.retrieve(api_key_id, **kwargs) -> ProjectAPIKey
get /organization/projects/{project_id}/api_keys/{api_key_id}
Retrieves an API key in the project.
Parameters
-
project_id: String -
api_key_id: String
Returns
-
class ProjectAPIKeyRepresents an individual API key in a project.
-
id: StringThe identifier, which can be referenced in API endpoints
-
created_at: IntegerThe Unix timestamp (in seconds) of when the API key was created
-
last_used_at: IntegerThe Unix timestamp (in seconds) of when the API key was last used.
-
name: StringThe name of the API key
-
object: :"organization.project.api_key"The object type, which is always
organization.project.api_key:"organization.project.api_key"
-
owner: Owner{ service_account, type, user}-
service_account: ServiceAccount{ id, created_at, name, role}The service account that owns a project API key.
-
id: StringThe identifier, which can be referenced in API endpoints
-
created_at: IntegerThe Unix timestamp (in seconds) of when the service account was created.
-
name: StringThe name of the service account.
-
role: StringThe service account's project role.
-
-
type: :user | :service_accountuserorservice_account-
:user -
:service_account
-
-
user: User{ id, created_at, email, 2 more}The user that owns a project API key.
-
id: StringThe identifier, which can be referenced in API endpoints
-
created_at: IntegerThe Unix timestamp (in seconds) of when the user was created.
-
email: StringThe email address of the user.
-
name: StringThe name of the user.
-
role: StringThe user's project role.
-
-
-
redacted_value: StringThe redacted value of the API key
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
project_api_key = openai.admin.organization.projects.api_keys.retrieve("api_key_id", project_id: "project_id")
puts(project_api_key)
Response
{
"id": "id",
"created_at": 0,
"last_used_at": 0,
"name": "name",
"object": "organization.project.api_key",
"owner": {
"service_account": {
"id": "id",
"created_at": 0,
"name": "name",
"role": "role"
},
"type": "user",
"user": {
"id": "id",
"created_at": 0,
"email": "email",
"name": "name",
"role": "role"
}
},
"redacted_value": "redacted_value"
}
Delete project API key
admin.organization.projects.api_keys.delete(api_key_id, **kwargs) -> APIKeyDeleteResponse
delete /organization/projects/{project_id}/api_keys/{api_key_id}
Deletes an API key from the project.
Returns confirmation of the key deletion, or an error if the key belonged to a service account.
Parameters
-
project_id: String -
api_key_id: String
Returns
-
class APIKeyDeleteResponse-
id: String -
deleted: bool -
object: :"organization.project.api_key.deleted":"organization.project.api_key.deleted"
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
api_key = openai.admin.organization.projects.api_keys.delete("api_key_id", project_id: "project_id")
puts(api_key)
Response
{
"id": "id",
"deleted": true,
"object": "organization.project.api_key.deleted"
}
Domain Types
Project API Key
-
class ProjectAPIKeyRepresents an individual API key in a project.
-
id: StringThe identifier, which can be referenced in API endpoints
-
created_at: IntegerThe Unix timestamp (in seconds) of when the API key was created
-
last_used_at: IntegerThe Unix timestamp (in seconds) of when the API key was last used.
-
name: StringThe name of the API key
-
object: :"organization.project.api_key"The object type, which is always
organization.project.api_key:"organization.project.api_key"
-
owner: Owner{ service_account, type, user}-
service_account: ServiceAccount{ id, created_at, name, role}The service account that owns a project API key.
-
id: StringThe identifier, which can be referenced in API endpoints
-
created_at: IntegerThe Unix timestamp (in seconds) of when the service account was created.
-
name: StringThe name of the service account.
-
role: StringThe service account's project role.
-
-
type: :user | :service_accountuserorservice_account-
:user -
:service_account
-
-
user: User{ id, created_at, email, 2 more}The user that owns a project API key.
-
id: StringThe identifier, which can be referenced in API endpoints
-
created_at: IntegerThe Unix timestamp (in seconds) of when the user was created.
-
email: StringThe email address of the user.
-
name: StringThe name of the user.
-
role: StringThe user's project role.
-
-
-
redacted_value: StringThe redacted value of the API key
-
API Key Delete Response
-
class APIKeyDeleteResponse-
id: String -
deleted: bool -
object: :"organization.project.api_key.deleted":"organization.project.api_key.deleted"
-
Rate Limits
List project rate limits
admin.organization.projects.rate_limits.list_rate_limits(project_id, **kwargs) -> ConversationCursorPage<ProjectRateLimit>
get /organization/projects/{project_id}/rate_limits
Returns the rate limits per model for a project.
Parameters
-
project_id: String -
after: StringA cursor for use in pagination.
afteris an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. -
before: StringA cursor for use in pagination.
beforeis an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, beginning with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. -
limit: IntegerA limit on the number of objects to be returned. The default is 100.
Returns
-
class ProjectRateLimitRepresents a project rate limit config.
-
id: StringThe identifier, which can be referenced in API endpoints.
-
max_requests_per_1_minute: IntegerThe maximum requests per minute.
-
max_tokens_per_1_minute: IntegerThe maximum tokens per minute.
-
model: StringThe model this rate limit applies to.
-
object: :"project.rate_limit"The object type, which is always
project.rate_limit:"project.rate_limit"
-
batch_1_day_max_input_tokens: IntegerThe maximum batch input tokens per day. Only present for relevant models.
-
max_audio_megabytes_per_1_minute: IntegerThe maximum audio megabytes per minute. Only present for relevant models.
-
max_images_per_1_minute: IntegerThe maximum images per minute. Only present for relevant models.
-
max_requests_per_1_day: IntegerThe maximum requests per day. Only present for relevant models.
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
page = openai.admin.organization.projects.rate_limits.list_rate_limits("project_id")
puts(page)
Response
{
"data": [
{
"id": "id",
"max_requests_per_1_minute": 0,
"max_tokens_per_1_minute": 0,
"model": "model",
"object": "project.rate_limit",
"batch_1_day_max_input_tokens": 0,
"max_audio_megabytes_per_1_minute": 0,
"max_images_per_1_minute": 0,
"max_requests_per_1_day": 0
}
],
"has_more": true,
"object": "list",
"first_id": "first_id",
"last_id": "last_id"
}
Modify project rate limit
admin.organization.projects.rate_limits.update_rate_limit(rate_limit_id, **kwargs) -> ProjectRateLimit
post /organization/projects/{project_id}/rate_limits/{rate_limit_id}
Updates a project rate limit.
Parameters
-
project_id: String -
rate_limit_id: String -
batch_1_day_max_input_tokens: IntegerThe maximum batch input tokens per day. Only relevant for certain models.
-
max_audio_megabytes_per_1_minute: IntegerThe maximum audio megabytes per minute. Only relevant for certain models.
-
max_images_per_1_minute: IntegerThe maximum images per minute. Only relevant for certain models.
-
max_requests_per_1_day: IntegerThe maximum requests per day. Only relevant for certain models.
-
max_requests_per_1_minute: IntegerThe maximum requests per minute.
-
max_tokens_per_1_minute: IntegerThe maximum tokens per minute.
Returns
-
class ProjectRateLimitRepresents a project rate limit config.
-
id: StringThe identifier, which can be referenced in API endpoints.
-
max_requests_per_1_minute: IntegerThe maximum requests per minute.
-
max_tokens_per_1_minute: IntegerThe maximum tokens per minute.
-
model: StringThe model this rate limit applies to.
-
object: :"project.rate_limit"The object type, which is always
project.rate_limit:"project.rate_limit"
-
batch_1_day_max_input_tokens: IntegerThe maximum batch input tokens per day. Only present for relevant models.
-
max_audio_megabytes_per_1_minute: IntegerThe maximum audio megabytes per minute. Only present for relevant models.
-
max_images_per_1_minute: IntegerThe maximum images per minute. Only present for relevant models.
-
max_requests_per_1_day: IntegerThe maximum requests per day. Only present for relevant models.
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
project_rate_limit = openai.admin.organization.projects.rate_limits.update_rate_limit(
"rate_limit_id",
project_id: "project_id"
)
puts(project_rate_limit)
Response
{
"id": "id",
"max_requests_per_1_minute": 0,
"max_tokens_per_1_minute": 0,
"model": "model",
"object": "project.rate_limit",
"batch_1_day_max_input_tokens": 0,
"max_audio_megabytes_per_1_minute": 0,
"max_images_per_1_minute": 0,
"max_requests_per_1_day": 0
}
Domain Types
Project Rate Limit
-
class ProjectRateLimitRepresents a project rate limit config.
-
id: StringThe identifier, which can be referenced in API endpoints.
-
max_requests_per_1_minute: IntegerThe maximum requests per minute.
-
max_tokens_per_1_minute: IntegerThe maximum tokens per minute.
-
model: StringThe model this rate limit applies to.
-
object: :"project.rate_limit"The object type, which is always
project.rate_limit:"project.rate_limit"
-
batch_1_day_max_input_tokens: IntegerThe maximum batch input tokens per day. Only present for relevant models.
-
max_audio_megabytes_per_1_minute: IntegerThe maximum audio megabytes per minute. Only present for relevant models.
-
max_images_per_1_minute: IntegerThe maximum images per minute. Only present for relevant models.
-
max_requests_per_1_day: IntegerThe maximum requests per day. Only present for relevant models.
-
Model Permissions
Retrieve project model permissions
admin.organization.projects.model_permissions.retrieve(project_id) -> ProjectModelPermissions
get /organization/projects/{project_id}/model_permissions
Returns model permissions for a project.
Parameters
project_id: String
Returns
-
class ProjectModelPermissionsRepresents the model allowlist or denylist policy for a project.
-
mode: :allow_list | :deny_listWhether the project uses an allowlist or a denylist.
-
:allow_list -
:deny_list
-
-
model_ids: Array[String]The model IDs included in the model permissions policy.
-
object: :"project.model_permissions"The object type, which is always
project.model_permissions.:"project.model_permissions"
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
project_model_permissions = openai.admin.organization.projects.model_permissions.retrieve("project_id")
puts(project_model_permissions)
Response
{
"mode": "allow_list",
"model_ids": [
"string"
],
"object": "project.model_permissions"
}
Modify project model permissions
admin.organization.projects.model_permissions.update(project_id, **kwargs) -> ProjectModelPermissions
post /organization/projects/{project_id}/model_permissions
Updates model permissions for a project.
Parameters
-
project_id: String -
mode: :allow_list | :deny_listThe model permissions mode to apply.
-
:allow_list -
:deny_list
-
-
model_ids: Array[String]The model IDs included in this permissions policy.
Returns
-
class ProjectModelPermissionsRepresents the model allowlist or denylist policy for a project.
-
mode: :allow_list | :deny_listWhether the project uses an allowlist or a denylist.
-
:allow_list -
:deny_list
-
-
model_ids: Array[String]The model IDs included in the model permissions policy.
-
object: :"project.model_permissions"The object type, which is always
project.model_permissions.:"project.model_permissions"
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
project_model_permissions = openai.admin.organization.projects.model_permissions.update(
"project_id",
mode: :allow_list,
model_ids: ["string"]
)
puts(project_model_permissions)
Response
{
"mode": "allow_list",
"model_ids": [
"string"
],
"object": "project.model_permissions"
}
Delete project model permissions
admin.organization.projects.model_permissions.delete(project_id) -> ProjectModelPermissionsDeleted
delete /organization/projects/{project_id}/model_permissions
Deletes model permissions for a project.
Parameters
project_id: String
Returns
-
class ProjectModelPermissionsDeletedConfirmation payload returned after deleting project model permissions.
-
deleted: boolWhether the project model permissions were deleted.
-
object: :"project.model_permissions.deleted"The object type, which is always
project.model_permissions.deleted.:"project.model_permissions.deleted"
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
project_model_permissions_deleted = openai.admin.organization.projects.model_permissions.delete("project_id")
puts(project_model_permissions_deleted)
Response
{
"deleted": true,
"object": "project.model_permissions.deleted"
}
Domain Types
Project Model Permissions
-
class ProjectModelPermissionsRepresents the model allowlist or denylist policy for a project.
-
mode: :allow_list | :deny_listWhether the project uses an allowlist or a denylist.
-
:allow_list -
:deny_list
-
-
model_ids: Array[String]The model IDs included in the model permissions policy.
-
object: :"project.model_permissions"The object type, which is always
project.model_permissions.:"project.model_permissions"
-
Project Model Permissions Deleted
-
class ProjectModelPermissionsDeletedConfirmation payload returned after deleting project model permissions.
-
deleted: boolWhether the project model permissions were deleted.
-
object: :"project.model_permissions.deleted"The object type, which is always
project.model_permissions.deleted.:"project.model_permissions.deleted"
-
Hosted Tool Permissions
Retrieve project hosted tool permissions
admin.organization.projects.hosted_tool_permissions.retrieve(project_id) -> ProjectHostedToolPermissions
get /organization/projects/{project_id}/hosted_tool_permissions
Returns hosted tool permissions for a project.
Parameters
project_id: String
Returns
-
class ProjectHostedToolPermissionsRepresents hosted tool permissions for a project.
-
code_interpreter: CodeInterpreter{ enabled}Permission state for a single hosted tool on a project.
-
enabled: boolWhether the hosted tool is enabled for the project.
-
-
file_search: FileSearch{ enabled}Permission state for a single hosted tool on a project.
-
enabled: boolWhether the hosted tool is enabled for the project.
-
-
image_generation: ImageGeneration{ enabled}Permission state for a single hosted tool on a project.
-
enabled: boolWhether the hosted tool is enabled for the project.
-
-
mcp: Mcp{ enabled}Permission state for a single hosted tool on a project.
-
enabled: boolWhether the hosted tool is enabled for the project.
-
-
web_search: WebSearch{ enabled}Permission state for a single hosted tool on a project.
-
enabled: boolWhether the hosted tool is enabled for the project.
-
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
project_hosted_tool_permissions = openai.admin.organization.projects.hosted_tool_permissions.retrieve("project_id")
puts(project_hosted_tool_permissions)
Response
{
"code_interpreter": {
"enabled": true
},
"file_search": {
"enabled": true
},
"image_generation": {
"enabled": true
},
"mcp": {
"enabled": true
},
"web_search": {
"enabled": true
}
}
Modify project hosted tool permissions
admin.organization.projects.hosted_tool_permissions.update(project_id, **kwargs) -> ProjectHostedToolPermissions
post /organization/projects/{project_id}/hosted_tool_permissions
Updates hosted tool permissions for a project.
Parameters
-
project_id: String -
code_interpreter: CodeInterpreter{ enabled}The code interpreter permission update.
-
enabled: boolWhether to enable the hosted tool for the project.
-
-
file_search: FileSearch{ enabled}The file search permission update.
-
enabled: boolWhether to enable the hosted tool for the project.
-
-
image_generation: ImageGeneration{ enabled}The image generation permission update.
-
enabled: boolWhether to enable the hosted tool for the project.
-
-
mcp: Mcp{ enabled}The MCP permission update.
-
enabled: boolWhether to enable the hosted tool for the project.
-
-
web_search: WebSearch{ enabled}The web search permission update.
-
enabled: boolWhether to enable the hosted tool for the project.
-
Returns
-
class ProjectHostedToolPermissionsRepresents hosted tool permissions for a project.
-
code_interpreter: CodeInterpreter{ enabled}Permission state for a single hosted tool on a project.
-
enabled: boolWhether the hosted tool is enabled for the project.
-
-
file_search: FileSearch{ enabled}Permission state for a single hosted tool on a project.
-
enabled: boolWhether the hosted tool is enabled for the project.
-
-
image_generation: ImageGeneration{ enabled}Permission state for a single hosted tool on a project.
-
enabled: boolWhether the hosted tool is enabled for the project.
-
-
mcp: Mcp{ enabled}Permission state for a single hosted tool on a project.
-
enabled: boolWhether the hosted tool is enabled for the project.
-
-
web_search: WebSearch{ enabled}Permission state for a single hosted tool on a project.
-
enabled: boolWhether the hosted tool is enabled for the project.
-
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
project_hosted_tool_permissions = openai.admin.organization.projects.hosted_tool_permissions.update("project_id")
puts(project_hosted_tool_permissions)
Response
{
"code_interpreter": {
"enabled": true
},
"file_search": {
"enabled": true
},
"image_generation": {
"enabled": true
},
"mcp": {
"enabled": true
},
"web_search": {
"enabled": true
}
}
Domain Types
Project Hosted Tool Permissions
-
class ProjectHostedToolPermissionsRepresents hosted tool permissions for a project.
-
code_interpreter: CodeInterpreter{ enabled}Permission state for a single hosted tool on a project.
-
enabled: boolWhether the hosted tool is enabled for the project.
-
-
file_search: FileSearch{ enabled}Permission state for a single hosted tool on a project.
-
enabled: boolWhether the hosted tool is enabled for the project.
-
-
image_generation: ImageGeneration{ enabled}Permission state for a single hosted tool on a project.
-
enabled: boolWhether the hosted tool is enabled for the project.
-
-
mcp: Mcp{ enabled}Permission state for a single hosted tool on a project.
-
enabled: boolWhether the hosted tool is enabled for the project.
-
-
web_search: WebSearch{ enabled}Permission state for a single hosted tool on a project.
-
enabled: boolWhether the hosted tool is enabled for the project.
-
-
Groups
List project groups
admin.organization.projects.groups.list(project_id, **kwargs) -> NextCursorPage<ProjectGroup>
get /organization/projects/{project_id}/groups
Lists the groups that have access to a project.
Parameters
-
project_id: String -
after: StringCursor for pagination. Provide the ID of the last group from the previous response to fetch the next page.
-
limit: IntegerA limit on the number of project groups to return. Defaults to 20.
-
order: :asc | :descSort order for the returned groups.
-
:asc -
:desc
-
Returns
-
class ProjectGroupDetails about a group's membership in a project.
-
created_at: IntegerUnix timestamp (in seconds) when the group was granted project access.
-
group_id: StringIdentifier of the group that has access to the project.
-
group_name: StringDisplay name of the group.
-
group_type: :group | :tenant_groupThe type of the group.
-
:group -
:tenant_group
-
-
object: :"project.group"Always
project.group.:"project.group"
-
project_id: StringIdentifier of the project.
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
page = openai.admin.organization.projects.groups.list("project_id")
puts(page)
Response
{
"data": [
{
"created_at": 0,
"group_id": "group_id",
"group_name": "group_name",
"group_type": "group",
"object": "project.group",
"project_id": "project_id"
}
],
"has_more": true,
"next": "next",
"object": "list"
}
Add project group
admin.organization.projects.groups.create(project_id, **kwargs) -> ProjectGroup
post /organization/projects/{project_id}/groups
Grants a group access to a project.
Parameters
-
project_id: String -
group_id: StringIdentifier of the group to add to the project.
-
role: StringIdentifier of the project role to grant to the group.
Returns
-
class ProjectGroupDetails about a group's membership in a project.
-
created_at: IntegerUnix timestamp (in seconds) when the group was granted project access.
-
group_id: StringIdentifier of the group that has access to the project.
-
group_name: StringDisplay name of the group.
-
group_type: :group | :tenant_groupThe type of the group.
-
:group -
:tenant_group
-
-
object: :"project.group"Always
project.group.:"project.group"
-
project_id: StringIdentifier of the project.
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
project_group = openai.admin.organization.projects.groups.create("project_id", group_id: "group_id", role: "role")
puts(project_group)
Response
{
"created_at": 0,
"group_id": "group_id",
"group_name": "group_name",
"group_type": "group",
"object": "project.group",
"project_id": "project_id"
}
Retrieve project group
admin.organization.projects.groups.retrieve(group_id, **kwargs) -> ProjectGroup
get /organization/projects/{project_id}/groups/{group_id}
Retrieves a project's group.
Parameters
-
project_id: String -
group_id: String -
group_type: :group | :tenant_groupThe type of group to retrieve.
-
:group -
:tenant_group
-
Returns
-
class ProjectGroupDetails about a group's membership in a project.
-
created_at: IntegerUnix timestamp (in seconds) when the group was granted project access.
-
group_id: StringIdentifier of the group that has access to the project.
-
group_name: StringDisplay name of the group.
-
group_type: :group | :tenant_groupThe type of the group.
-
:group -
:tenant_group
-
-
object: :"project.group"Always
project.group.:"project.group"
-
project_id: StringIdentifier of the project.
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
project_group = openai.admin.organization.projects.groups.retrieve("group_id", project_id: "project_id")
puts(project_group)
Response
{
"created_at": 0,
"group_id": "group_id",
"group_name": "group_name",
"group_type": "group",
"object": "project.group",
"project_id": "project_id"
}
Remove project group
admin.organization.projects.groups.delete(group_id, **kwargs) -> GroupDeleteResponse
delete /organization/projects/{project_id}/groups/{group_id}
Revokes a group's access to a project.
Parameters
-
project_id: String -
group_id: String
Returns
-
class GroupDeleteResponseConfirmation payload returned after removing a group from a project.
-
deleted: boolWhether the group membership in the project was removed.
-
object: :"project.group.deleted"Always
project.group.deleted.:"project.group.deleted"
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
group = openai.admin.organization.projects.groups.delete("group_id", project_id: "project_id")
puts(group)
Response
{
"deleted": true,
"object": "project.group.deleted"
}
Domain Types
Project Group
-
class ProjectGroupDetails about a group's membership in a project.
-
created_at: IntegerUnix timestamp (in seconds) when the group was granted project access.
-
group_id: StringIdentifier of the group that has access to the project.
-
group_name: StringDisplay name of the group.
-
group_type: :group | :tenant_groupThe type of the group.
-
:group -
:tenant_group
-
-
object: :"project.group"Always
project.group.:"project.group"
-
project_id: StringIdentifier of the project.
-
Group Delete Response
-
class GroupDeleteResponseConfirmation payload returned after removing a group from a project.
-
deleted: boolWhether the group membership in the project was removed.
-
object: :"project.group.deleted"Always
project.group.deleted.:"project.group.deleted"
-
Roles
List project group role assignments
admin.organization.projects.groups.roles.list(group_id, **kwargs) -> NextCursorPage<RoleListResponse>
get /projects/{project_id}/groups/{group_id}/roles
Lists the project roles assigned to a group within a project.
Parameters
-
project_id: String -
group_id: String -
after: StringCursor for pagination. Provide the value from the previous response's
nextfield to continue listing project roles. -
limit: IntegerA limit on the number of project role assignments to return.
-
order: :asc | :descSort order for the returned project roles.
-
:asc -
:desc
-
Returns
-
class RoleListResponseDetailed information about a role assignment entry returned when listing assignments.
-
id: StringIdentifier for the role.
-
assignment_sources: Array[AssignmentSource{ principal_id, principal_type}]Principals from which the role assignment is inherited, when available.
-
principal_id: String -
principal_type: String
-
-
created_at: IntegerWhen the role was created.
-
created_by: StringIdentifier of the actor who created the role.
-
created_by_user_obj: Hash[Symbol, untyped]User details for the actor that created the role, when available.
-
description: StringDescription of the role.
-
metadata: Hash[Symbol, untyped]Arbitrary metadata stored on the role.
-
name: StringName of the role.
-
permissions: Array[String]Permissions associated with the role.
-
predefined_role: boolWhether the role is predefined by OpenAI.
-
resource_type: StringResource type the role applies to.
-
updated_at: IntegerWhen the role was last updated.
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
page = openai.admin.organization.projects.groups.roles.list("group_id", project_id: "project_id")
puts(page)
Response
{
"data": [
{
"id": "id",
"assignment_sources": [
{
"principal_id": "principal_id",
"principal_type": "principal_type"
}
],
"created_at": 0,
"created_by": "created_by",
"created_by_user_obj": {
"foo": "bar"
},
"description": "description",
"metadata": {
"foo": "bar"
},
"name": "name",
"permissions": [
"string"
],
"predefined_role": true,
"resource_type": "resource_type",
"updated_at": 0
}
],
"has_more": true,
"next": "next",
"object": "list"
}
Assign project role to group
admin.organization.projects.groups.roles.create(group_id, **kwargs) -> RoleCreateResponse
post /projects/{project_id}/groups/{group_id}/roles
Assigns a project role to a group within a project.
Parameters
-
project_id: String -
group_id: String -
role_id: StringIdentifier of the role to assign.
Returns
-
class RoleCreateResponseRole assignment linking a group to a role.
-
group: Group{ id, created_at, name, 2 more}Summary information about a group returned in role assignment responses.
-
id: StringIdentifier for the group.
-
created_at: IntegerUnix timestamp (in seconds) when the group was created.
-
name: StringDisplay name of the group.
-
object: :groupAlways
group.:group
-
scim_managed: boolWhether the group is managed through SCIM.
-
-
object: :"group.role"Always
group.role.:"group.role"
-
role: RoleDetails about a role that can be assigned through the public Roles API.
-
id: StringIdentifier for the role.
-
description: StringOptional description of the role.
-
name: StringUnique name for the role.
-
object: :roleAlways
role.:role
-
permissions: Array[String]Permissions granted by the role.
-
predefined_role: boolWhether the role is predefined and managed by OpenAI.
-
resource_type: StringResource type the role is bound to (for example
api.organizationorapi.project).
-
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
role = openai.admin.organization.projects.groups.roles.create(
"group_id",
project_id: "project_id",
role_id: "role_id"
)
puts(role)
Response
{
"group": {
"id": "id",
"created_at": 0,
"name": "name",
"object": "group",
"scim_managed": true
},
"object": "group.role",
"role": {
"id": "id",
"description": "description",
"name": "name",
"object": "role",
"permissions": [
"string"
],
"predefined_role": true,
"resource_type": "resource_type"
}
}
Retrieve project group role
admin.organization.projects.groups.roles.retrieve(role_id, **kwargs) -> RoleRetrieveResponse
get /projects/{project_id}/groups/{group_id}/roles/{role_id}
Retrieves a project role assigned to a group.
Parameters
-
project_id: String -
group_id: String -
role_id: String
Returns
-
class RoleRetrieveResponseDetailed information about a role assignment entry returned when listing assignments.
-
id: StringIdentifier for the role.
-
assignment_sources: Array[AssignmentSource{ principal_id, principal_type}]Principals from which the role assignment is inherited, when available.
-
principal_id: String -
principal_type: String
-
-
created_at: IntegerWhen the role was created.
-
created_by: StringIdentifier of the actor who created the role.
-
created_by_user_obj: Hash[Symbol, untyped]User details for the actor that created the role, when available.
-
description: StringDescription of the role.
-
metadata: Hash[Symbol, untyped]Arbitrary metadata stored on the role.
-
name: StringName of the role.
-
permissions: Array[String]Permissions associated with the role.
-
predefined_role: boolWhether the role is predefined by OpenAI.
-
resource_type: StringResource type the role applies to.
-
updated_at: IntegerWhen the role was last updated.
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
role = openai.admin.organization.projects.groups.roles.retrieve(
"role_id",
project_id: "project_id",
group_id: "group_id"
)
puts(role)
Response
{
"id": "id",
"assignment_sources": [
{
"principal_id": "principal_id",
"principal_type": "principal_type"
}
],
"created_at": 0,
"created_by": "created_by",
"created_by_user_obj": {
"foo": "bar"
},
"description": "description",
"metadata": {
"foo": "bar"
},
"name": "name",
"permissions": [
"string"
],
"predefined_role": true,
"resource_type": "resource_type",
"updated_at": 0
}
Unassign project role from group
admin.organization.projects.groups.roles.delete(role_id, **kwargs) -> RoleDeleteResponse
delete /projects/{project_id}/groups/{group_id}/roles/{role_id}
Unassigns a project role from a group within a project.
Parameters
-
project_id: String -
group_id: String -
role_id: String
Returns
-
class RoleDeleteResponseConfirmation payload returned after unassigning a role.
-
deleted: boolWhether the assignment was removed.
-
object: StringIdentifier for the deleted assignment, such as
group.role.deletedoruser.role.deleted.
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
role = openai.admin.organization.projects.groups.roles.delete(
"role_id",
project_id: "project_id",
group_id: "group_id"
)
puts(role)
Response
{
"deleted": true,
"object": "object"
}
Domain Types
Role List Response
-
class RoleListResponseDetailed information about a role assignment entry returned when listing assignments.
-
id: StringIdentifier for the role.
-
assignment_sources: Array[AssignmentSource{ principal_id, principal_type}]Principals from which the role assignment is inherited, when available.
-
principal_id: String -
principal_type: String
-
-
created_at: IntegerWhen the role was created.
-
created_by: StringIdentifier of the actor who created the role.
-
created_by_user_obj: Hash[Symbol, untyped]User details for the actor that created the role, when available.
-
description: StringDescription of the role.
-
metadata: Hash[Symbol, untyped]Arbitrary metadata stored on the role.
-
name: StringName of the role.
-
permissions: Array[String]Permissions associated with the role.
-
predefined_role: boolWhether the role is predefined by OpenAI.
-
resource_type: StringResource type the role applies to.
-
updated_at: IntegerWhen the role was last updated.
-
Role Create Response
-
class RoleCreateResponseRole assignment linking a group to a role.
-
group: Group{ id, created_at, name, 2 more}Summary information about a group returned in role assignment responses.
-
id: StringIdentifier for the group.
-
created_at: IntegerUnix timestamp (in seconds) when the group was created.
-
name: StringDisplay name of the group.
-
object: :groupAlways
group.:group
-
scim_managed: boolWhether the group is managed through SCIM.
-
-
object: :"group.role"Always
group.role.:"group.role"
-
role: RoleDetails about a role that can be assigned through the public Roles API.
-
id: StringIdentifier for the role.
-
description: StringOptional description of the role.
-
name: StringUnique name for the role.
-
object: :roleAlways
role.:role
-
permissions: Array[String]Permissions granted by the role.
-
predefined_role: boolWhether the role is predefined and managed by OpenAI.
-
resource_type: StringResource type the role is bound to (for example
api.organizationorapi.project).
-
-
Role Retrieve Response
-
class RoleRetrieveResponseDetailed information about a role assignment entry returned when listing assignments.
-
id: StringIdentifier for the role.
-
assignment_sources: Array[AssignmentSource{ principal_id, principal_type}]Principals from which the role assignment is inherited, when available.
-
principal_id: String -
principal_type: String
-
-
created_at: IntegerWhen the role was created.
-
created_by: StringIdentifier of the actor who created the role.
-
created_by_user_obj: Hash[Symbol, untyped]User details for the actor that created the role, when available.
-
description: StringDescription of the role.
-
metadata: Hash[Symbol, untyped]Arbitrary metadata stored on the role.
-
name: StringName of the role.
-
permissions: Array[String]Permissions associated with the role.
-
predefined_role: boolWhether the role is predefined by OpenAI.
-
resource_type: StringResource type the role applies to.
-
updated_at: IntegerWhen the role was last updated.
-
Role Delete Response
-
class RoleDeleteResponseConfirmation payload returned after unassigning a role.
-
deleted: boolWhether the assignment was removed.
-
object: StringIdentifier for the deleted assignment, such as
group.role.deletedoruser.role.deleted.
-
Roles
List project roles
admin.organization.projects.roles.list(project_id, **kwargs) -> NextCursorPage<Role>
get /projects/{project_id}/roles
Lists the roles configured for a project.
Parameters
-
project_id: String -
after: StringCursor for pagination. Provide the value from the previous response's
nextfield to continue listing roles. -
limit: IntegerA limit on the number of roles to return. Defaults to 1000.
-
order: :asc | :descSort order for the returned roles.
-
:asc -
:desc
-
Returns
-
class RoleDetails about a role that can be assigned through the public Roles API.
-
id: StringIdentifier for the role.
-
description: StringOptional description of the role.
-
name: StringUnique name for the role.
-
object: :roleAlways
role.:role
-
permissions: Array[String]Permissions granted by the role.
-
predefined_role: boolWhether the role is predefined and managed by OpenAI.
-
resource_type: StringResource type the role is bound to (for example
api.organizationorapi.project).
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
page = openai.admin.organization.projects.roles.list("project_id")
puts(page)
Response
{
"data": [
{
"id": "id",
"description": "description",
"name": "name",
"object": "role",
"permissions": [
"string"
],
"predefined_role": true,
"resource_type": "resource_type"
}
],
"has_more": true,
"next": "next",
"object": "list"
}
Create project role
admin.organization.projects.roles.create(project_id, **kwargs) -> Role
post /projects/{project_id}/roles
Creates a custom role for a project.
Parameters
-
project_id: String -
permissions: Array[String]Permissions to grant to the role.
-
role_name: StringUnique name for the role.
-
description: StringOptional description of the role.
Returns
-
class RoleDetails about a role that can be assigned through the public Roles API.
-
id: StringIdentifier for the role.
-
description: StringOptional description of the role.
-
name: StringUnique name for the role.
-
object: :roleAlways
role.:role
-
permissions: Array[String]Permissions granted by the role.
-
predefined_role: boolWhether the role is predefined and managed by OpenAI.
-
resource_type: StringResource type the role is bound to (for example
api.organizationorapi.project).
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
role = openai.admin.organization.projects.roles.create(
"project_id",
permissions: ["string"],
role_name: "role_name"
)
puts(role)
Response
{
"id": "id",
"description": "description",
"name": "name",
"object": "role",
"permissions": [
"string"
],
"predefined_role": true,
"resource_type": "resource_type"
}
Retrieve project role
admin.organization.projects.roles.retrieve(role_id, **kwargs) -> Role
get /projects/{project_id}/roles/{role_id}
Retrieves a project role.
Parameters
-
project_id: String -
role_id: String
Returns
-
class RoleDetails about a role that can be assigned through the public Roles API.
-
id: StringIdentifier for the role.
-
description: StringOptional description of the role.
-
name: StringUnique name for the role.
-
object: :roleAlways
role.:role
-
permissions: Array[String]Permissions granted by the role.
-
predefined_role: boolWhether the role is predefined and managed by OpenAI.
-
resource_type: StringResource type the role is bound to (for example
api.organizationorapi.project).
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
role = openai.admin.organization.projects.roles.retrieve("role_id", project_id: "project_id")
puts(role)
Response
{
"id": "id",
"description": "description",
"name": "name",
"object": "role",
"permissions": [
"string"
],
"predefined_role": true,
"resource_type": "resource_type"
}
Update project role
admin.organization.projects.roles.update(role_id, **kwargs) -> Role
post /projects/{project_id}/roles/{role_id}
Updates an existing project role.
Parameters
-
project_id: String -
role_id: String -
description: StringNew description for the role.
-
permissions: Array[String]Updated set of permissions for the role.
-
role_name: StringNew name for the role.
Returns
-
class RoleDetails about a role that can be assigned through the public Roles API.
-
id: StringIdentifier for the role.
-
description: StringOptional description of the role.
-
name: StringUnique name for the role.
-
object: :roleAlways
role.:role
-
permissions: Array[String]Permissions granted by the role.
-
predefined_role: boolWhether the role is predefined and managed by OpenAI.
-
resource_type: StringResource type the role is bound to (for example
api.organizationorapi.project).
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
role = openai.admin.organization.projects.roles.update("role_id", project_id: "project_id")
puts(role)
Response
{
"id": "id",
"description": "description",
"name": "name",
"object": "role",
"permissions": [
"string"
],
"predefined_role": true,
"resource_type": "resource_type"
}
Delete project role
admin.organization.projects.roles.delete(role_id, **kwargs) -> RoleDeleteResponse
delete /projects/{project_id}/roles/{role_id}
Deletes a custom role from a project.
Parameters
-
project_id: String -
role_id: String
Returns
-
class RoleDeleteResponseConfirmation payload returned after deleting a role.
-
id: StringIdentifier of the deleted role.
-
deleted: boolWhether the role was deleted.
-
object: :"role.deleted"Always
role.deleted.:"role.deleted"
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
role = openai.admin.organization.projects.roles.delete("role_id", project_id: "project_id")
puts(role)
Response
{
"id": "id",
"deleted": true,
"object": "role.deleted"
}
Domain Types
Role Delete Response
-
class RoleDeleteResponseConfirmation payload returned after deleting a role.
-
id: StringIdentifier of the deleted role.
-
deleted: boolWhether the role was deleted.
-
object: :"role.deleted"Always
role.deleted.:"role.deleted"
-
Data Retention
Retrieve project data retention
admin.organization.projects.data_retention.retrieve(project_id) -> ProjectDataRetention
get /organization/projects/{project_id}/data_retention
Retrieves project data retention controls.
Parameters
project_id: String
Returns
-
class ProjectDataRetentionRepresents a project's data retention control setting.
-
object: :"project.data_retention"The object type, which is always
project.data_retention.:"project.data_retention"
-
type: :organization_default | :none | :zero_data_retention | 3 moreThe configured project data retention type.
-
:organization_default -
:none -
:zero_data_retention -
:modified_abuse_monitoring -
:enhanced_zero_data_retention -
:enhanced_modified_abuse_monitoring
-
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
project_data_retention = openai.admin.organization.projects.data_retention.retrieve("project_id")
puts(project_data_retention)
Response
{
"object": "project.data_retention",
"type": "organization_default"
}
Update project data retention
admin.organization.projects.data_retention.update(project_id, **kwargs) -> ProjectDataRetention
post /organization/projects/{project_id}/data_retention
Updates project data retention controls.
Parameters
-
project_id: String -
retention_type: :organization_default | :none | :zero_data_retention | 3 moreThe desired project data retention type.
-
:organization_default -
:none -
:zero_data_retention -
:modified_abuse_monitoring -
:enhanced_zero_data_retention -
:enhanced_modified_abuse_monitoring
-
Returns
-
class ProjectDataRetentionRepresents a project's data retention control setting.
-
object: :"project.data_retention"The object type, which is always
project.data_retention.:"project.data_retention"
-
type: :organization_default | :none | :zero_data_retention | 3 moreThe configured project data retention type.
-
:organization_default -
:none -
:zero_data_retention -
:modified_abuse_monitoring -
:enhanced_zero_data_retention -
:enhanced_modified_abuse_monitoring
-
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
project_data_retention = openai.admin.organization.projects.data_retention.update(
"project_id",
retention_type: :organization_default
)
puts(project_data_retention)
Response
{
"object": "project.data_retention",
"type": "organization_default"
}
Domain Types
Project Data Retention
-
class ProjectDataRetentionRepresents a project's data retention control setting.
-
object: :"project.data_retention"The object type, which is always
project.data_retention.:"project.data_retention"
-
type: :organization_default | :none | :zero_data_retention | 3 moreThe configured project data retention type.
-
:organization_default -
:none -
:zero_data_retention -
:modified_abuse_monitoring -
:enhanced_zero_data_retention -
:enhanced_modified_abuse_monitoring
-
-
Spend Alerts
List project spend alerts
admin.organization.projects.spend_alerts.list(project_id, **kwargs) -> ConversationCursorPage<ProjectSpendAlert>
get /organization/projects/{project_id}/spend_alerts
Lists project spend alerts.
Parameters
-
project_id: String -
after: StringCursor for pagination. Provide the ID of the last spend alert from the previous response to fetch the next page.
-
before: StringCursor for pagination. Provide the ID of the first spend alert from the previous response to fetch the previous page.
-
limit: IntegerA limit on the number of spend alerts to return. Defaults to 20.
-
order: :asc | :descSort order for the returned spend alerts.
-
:asc -
:desc
-
Returns
-
class ProjectSpendAlertRepresents a spend alert configured at the project level.
-
id: StringThe identifier, which can be referenced in API endpoints.
-
currency: :USDThe currency for the threshold amount.
:USD
-
interval: :monthThe time interval for evaluating spend against the threshold.
:month
-
notification_channel: NotificationChannel{ recipients, type, subject_prefix}Email notification settings for a spend alert.
-
recipients: Array[String]Email addresses that receive the spend alert notification.
-
type: :emailThe notification channel type. Currently only
emailis supported.:email
-
subject_prefix: StringOptional subject prefix for alert emails.
-
-
object: :"project.spend_alert"The object type, which is always
project.spend_alert.:"project.spend_alert"
-
threshold_amount: IntegerThe alert threshold amount, in cents.
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
page = openai.admin.organization.projects.spend_alerts.list("project_id")
puts(page)
Response
{
"data": [
{
"id": "id",
"currency": "USD",
"interval": "month",
"notification_channel": {
"recipients": [
"string"
],
"type": "email",
"subject_prefix": "subject_prefix"
},
"object": "project.spend_alert",
"threshold_amount": 0
}
],
"first_id": "first_id",
"has_more": true,
"last_id": "last_id",
"object": "list"
}
Create project spend alert
admin.organization.projects.spend_alerts.create(project_id, **kwargs) -> ProjectSpendAlert
post /organization/projects/{project_id}/spend_alerts
Creates a project spend alert.
Parameters
-
project_id: String -
currency: :USDThe currency for the threshold amount.
:USD
-
interval: :monthThe time interval for evaluating spend against the threshold.
:month
-
notification_channel: NotificationChannel{ recipients, type, subject_prefix}Email notification settings for a spend alert.
-
recipients: Array[String]Email addresses that receive the spend alert notification.
-
type: :emailThe notification channel type. Currently only
emailis supported.:email
-
subject_prefix: StringOptional subject prefix for alert emails.
-
-
threshold_amount: IntegerThe alert threshold amount, in cents.
Returns
-
class ProjectSpendAlertRepresents a spend alert configured at the project level.
-
id: StringThe identifier, which can be referenced in API endpoints.
-
currency: :USDThe currency for the threshold amount.
:USD
-
interval: :monthThe time interval for evaluating spend against the threshold.
:month
-
notification_channel: NotificationChannel{ recipients, type, subject_prefix}Email notification settings for a spend alert.
-
recipients: Array[String]Email addresses that receive the spend alert notification.
-
type: :emailThe notification channel type. Currently only
emailis supported.:email
-
subject_prefix: StringOptional subject prefix for alert emails.
-
-
object: :"project.spend_alert"The object type, which is always
project.spend_alert.:"project.spend_alert"
-
threshold_amount: IntegerThe alert threshold amount, in cents.
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
project_spend_alert = openai.admin.organization.projects.spend_alerts.create(
"project_id",
currency: :USD,
interval: :month,
notification_channel: {recipients: ["string"], type: :email},
threshold_amount: 0
)
puts(project_spend_alert)
Response
{
"id": "id",
"currency": "USD",
"interval": "month",
"notification_channel": {
"recipients": [
"string"
],
"type": "email",
"subject_prefix": "subject_prefix"
},
"object": "project.spend_alert",
"threshold_amount": 0
}
Update project spend alert
admin.organization.projects.spend_alerts.update(alert_id, **kwargs) -> ProjectSpendAlert
post /organization/projects/{project_id}/spend_alerts/{alert_id}
Updates a project spend alert.
Parameters
-
project_id: String -
alert_id: String -
currency: :USDThe currency for the threshold amount.
:USD
-
interval: :monthThe time interval for evaluating spend against the threshold.
:month
-
notification_channel: NotificationChannel{ recipients, type, subject_prefix}Email notification settings for a spend alert.
-
recipients: Array[String]Email addresses that receive the spend alert notification.
-
type: :emailThe notification channel type. Currently only
emailis supported.:email
-
subject_prefix: StringOptional subject prefix for alert emails.
-
-
threshold_amount: IntegerThe alert threshold amount, in cents.
Returns
-
class ProjectSpendAlertRepresents a spend alert configured at the project level.
-
id: StringThe identifier, which can be referenced in API endpoints.
-
currency: :USDThe currency for the threshold amount.
:USD
-
interval: :monthThe time interval for evaluating spend against the threshold.
:month
-
notification_channel: NotificationChannel{ recipients, type, subject_prefix}Email notification settings for a spend alert.
-
recipients: Array[String]Email addresses that receive the spend alert notification.
-
type: :emailThe notification channel type. Currently only
emailis supported.:email
-
subject_prefix: StringOptional subject prefix for alert emails.
-
-
object: :"project.spend_alert"The object type, which is always
project.spend_alert.:"project.spend_alert"
-
threshold_amount: IntegerThe alert threshold amount, in cents.
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
project_spend_alert = openai.admin.organization.projects.spend_alerts.update(
"alert_id",
project_id: "project_id",
currency: :USD,
interval: :month,
notification_channel: {recipients: ["string"], type: :email},
threshold_amount: 0
)
puts(project_spend_alert)
Response
{
"id": "id",
"currency": "USD",
"interval": "month",
"notification_channel": {
"recipients": [
"string"
],
"type": "email",
"subject_prefix": "subject_prefix"
},
"object": "project.spend_alert",
"threshold_amount": 0
}
Delete project spend alert
admin.organization.projects.spend_alerts.delete(alert_id, **kwargs) -> ProjectSpendAlertDeleted
delete /organization/projects/{project_id}/spend_alerts/{alert_id}
Deletes a project spend alert.
Parameters
-
project_id: String -
alert_id: String
Returns
-
class ProjectSpendAlertDeletedConfirmation payload returned after deleting a project spend alert.
-
id: StringThe deleted spend alert ID.
-
deleted: boolWhether the spend alert was deleted.
-
object: :"project.spend_alert.deleted"Always
project.spend_alert.deleted.:"project.spend_alert.deleted"
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
project_spend_alert_deleted = openai.admin.organization.projects.spend_alerts.delete("alert_id", project_id: "project_id")
puts(project_spend_alert_deleted)
Response
{
"id": "id",
"deleted": true,
"object": "project.spend_alert.deleted"
}
Domain Types
Project Spend Alert
-
class ProjectSpendAlertRepresents a spend alert configured at the project level.
-
id: StringThe identifier, which can be referenced in API endpoints.
-
currency: :USDThe currency for the threshold amount.
:USD
-
interval: :monthThe time interval for evaluating spend against the threshold.
:month
-
notification_channel: NotificationChannel{ recipients, type, subject_prefix}Email notification settings for a spend alert.
-
recipients: Array[String]Email addresses that receive the spend alert notification.
-
type: :emailThe notification channel type. Currently only
emailis supported.:email
-
subject_prefix: StringOptional subject prefix for alert emails.
-
-
object: :"project.spend_alert"The object type, which is always
project.spend_alert.:"project.spend_alert"
-
threshold_amount: IntegerThe alert threshold amount, in cents.
-
Project Spend Alert Deleted
-
class ProjectSpendAlertDeletedConfirmation payload returned after deleting a project spend alert.
-
id: StringThe deleted spend alert ID.
-
deleted: boolWhether the spend alert was deleted.
-
object: :"project.spend_alert.deleted"Always
project.spend_alert.deleted.:"project.spend_alert.deleted"
-
Certificates
List project certificates
admin.organization.projects.certificates.list(project_id, **kwargs) -> ConversationCursorPage<CertificateListResponse>
get /organization/projects/{project_id}/certificates
List certificates for this project.
Parameters
-
project_id: String -
after: StringA cursor for use in pagination.
afteris an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. -
limit: IntegerA limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
-
order: :asc | :descSort order by the
created_attimestamp of the objects.ascfor ascending order anddescfor descending order.-
:asc -
:desc
-
Returns
-
class CertificateListResponseRepresents an individual certificate configured at the project level.
-
id: StringThe identifier, which can be referenced in API endpoints
-
active: boolWhether the certificate is currently active at the project level.
-
certificate_details: CertificateDetails{ expires_at, valid_at}-
expires_at: IntegerThe Unix timestamp (in seconds) of when the certificate expires.
-
valid_at: IntegerThe Unix timestamp (in seconds) of when the certificate becomes valid.
-
-
created_at: IntegerThe Unix timestamp (in seconds) of when the certificate was uploaded.
-
name: StringThe name of the certificate.
-
object: :"organization.project.certificate"The object type, which is always
organization.project.certificate.:"organization.project.certificate"
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
page = openai.admin.organization.projects.certificates.list("project_id")
puts(page)
Response
{
"data": [
{
"id": "id",
"active": true,
"certificate_details": {
"expires_at": 0,
"valid_at": 0
},
"created_at": 0,
"name": "name",
"object": "organization.project.certificate"
}
],
"first_id": "cert_abc",
"has_more": true,
"last_id": "cert_abc",
"object": "list"
}
Activate certificates for project
admin.organization.projects.certificates.activate(project_id, **kwargs) -> Page<CertificateActivateResponse>
post /organization/projects/{project_id}/certificates/activate
Activate certificates at the project level.
You can atomically and idempotently activate up to 10 certificates at a time.
Parameters
-
project_id: String -
certificate_ids: Array[String]
Returns
-
class CertificateActivateResponseRepresents an individual certificate configured at the project level.
-
id: StringThe identifier, which can be referenced in API endpoints
-
active: boolWhether the certificate is currently active at the project level.
-
certificate_details: CertificateDetails{ expires_at, valid_at}-
expires_at: IntegerThe Unix timestamp (in seconds) of when the certificate expires.
-
valid_at: IntegerThe Unix timestamp (in seconds) of when the certificate becomes valid.
-
-
created_at: IntegerThe Unix timestamp (in seconds) of when the certificate was uploaded.
-
name: StringThe name of the certificate.
-
object: :"organization.project.certificate"The object type, which is always
organization.project.certificate.:"organization.project.certificate"
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
page = openai.admin.organization.projects.certificates.activate("project_id", certificate_ids: ["cert_abc"])
puts(page)
Response
{
"data": [
{
"id": "id",
"active": true,
"certificate_details": {
"expires_at": 0,
"valid_at": 0
},
"created_at": 0,
"name": "name",
"object": "organization.project.certificate"
}
],
"object": "organization.project.certificate.activation"
}
Deactivate certificates for project
admin.organization.projects.certificates.deactivate(project_id, **kwargs) -> Page<CertificateDeactivateResponse>
post /organization/projects/{project_id}/certificates/deactivate
Deactivate certificates at the project level. You can atomically and idempotently deactivate up to 10 certificates at a time.
Parameters
-
project_id: String -
certificate_ids: Array[String]
Returns
-
class CertificateDeactivateResponseRepresents an individual certificate configured at the project level.
-
id: StringThe identifier, which can be referenced in API endpoints
-
active: boolWhether the certificate is currently active at the project level.
-
certificate_details: CertificateDetails{ expires_at, valid_at}-
expires_at: IntegerThe Unix timestamp (in seconds) of when the certificate expires.
-
valid_at: IntegerThe Unix timestamp (in seconds) of when the certificate becomes valid.
-
-
created_at: IntegerThe Unix timestamp (in seconds) of when the certificate was uploaded.
-
name: StringThe name of the certificate.
-
object: :"organization.project.certificate"The object type, which is always
organization.project.certificate.:"organization.project.certificate"
-
Example
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
page = openai.admin.organization.projects.certificates.deactivate("project_id", certificate_ids: ["cert_abc"])
puts(page)
Response
{
"data": [
{
"id": "id",
"active": true,
"certificate_details": {
"expires_at": 0,
"valid_at": 0
},
"created_at": 0,
"name": "name",
"object": "organization.project.certificate"
}
],
"object": "organization.project.certificate.deactivation"
}
Domain Types
Certificate List Response
-
class CertificateListResponseRepresents an individual certificate configured at the project level.
-
id: StringThe identifier, which can be referenced in API endpoints
-
active: boolWhether the certificate is currently active at the project level.
-
certificate_details: CertificateDetails{ expires_at, valid_at}-
expires_at: IntegerThe Unix timestamp (in seconds) of when the certificate expires.
-
valid_at: IntegerThe Unix timestamp (in seconds) of when the certificate becomes valid.
-
-
created_at: IntegerThe Unix timestamp (in seconds) of when the certificate was uploaded.
-
name: StringThe name of the certificate.
-
object: :"organization.project.certificate"The object type, which is always
organization.project.certificate.:"organization.project.certificate"
-
Certificate Activate Response
-
class CertificateActivateResponseRepresents an individual certificate configured at the project level.
-
id: StringThe identifier, which can be referenced in API endpoints
-
active: boolWhether the certificate is currently active at the project level.
-
certificate_details: CertificateDetails{ expires_at, valid_at}-
expires_at: IntegerThe Unix timestamp (in seconds) of when the certificate expires.
-
valid_at: IntegerThe Unix timestamp (in seconds) of when the certificate becomes valid.
-
-
created_at: IntegerThe Unix timestamp (in seconds) of when the certificate was uploaded.
-
name: StringThe name of the certificate.
-
object: :"organization.project.certificate"The object type, which is always
organization.project.certificate.:"organization.project.certificate"
-
Certificate Deactivate Response
-
class CertificateDeactivateResponseRepresents an individual certificate configured at the project level.
-
id: StringThe identifier, which can be referenced in API endpoints
-
active: boolWhether the certificate is currently active at the project level.
-
certificate_details: CertificateDetails{ expires_at, valid_at}-
expires_at: IntegerThe Unix timestamp (in seconds) of when the certificate expires.
-
valid_at: IntegerThe Unix timestamp (in seconds) of when the certificate becomes valid.
-
-
created_at: IntegerThe Unix timestamp (in seconds) of when the certificate was uploaded.
-
name: StringThe name of the certificate.
-
object: :"organization.project.certificate"The object type, which is always
organization.project.certificate.:"organization.project.certificate"
-