Admin
Organization
Audit Logs
List audit logs
AuditLogListPage admin().organization().auditLogs().list(AuditLogListParamsparams = AuditLogListParams.none(), RequestOptionsrequestOptions = RequestOptions.none())
get /organization/audit_logs
List user actions and configuration changes within this organization.
Parameters
-
AuditLogListParams params-
Optional<List<String>> actorEmailsReturn only events performed by users with these emails.
-
Optional<List<String>> actorIdsReturn only events performed by these actors. Can be a user ID, a service account ID, or an api key tracking ID.
-
Optional<String> afterA 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. -
Optional<String> beforeA 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. -
Optional<EffectiveAt> effectiveAtReturn only events whose
effective_at(Unix seconds) is in this range.-
Optional<Long> gtReturn only events whose
effective_at(Unix seconds) is greater than this value. -
Optional<Long> gteReturn only events whose
effective_at(Unix seconds) is greater than or equal to this value. -
Optional<Long> ltReturn only events whose
effective_at(Unix seconds) is less than this value. -
Optional<Long> lteReturn only events whose
effective_at(Unix seconds) is less than or equal to this value.
-
-
Optional<List<EventType>> eventTypesReturn 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.created") -
API_KEY_UPDATED("api_key.updated") -
API_KEY_DELETED("api_key.deleted") -
CERTIFICATE_CREATED("certificate.created") -
CERTIFICATE_UPDATED("certificate.updated") -
CERTIFICATE_DELETED("certificate.deleted") -
CERTIFICATES_ACTIVATED("certificates.activated") -
CERTIFICATES_DEACTIVATED("certificates.deactivated") -
CHECKPOINT_PERMISSION_CREATED("checkpoint.permission.created") -
CHECKPOINT_PERMISSION_DELETED("checkpoint.permission.deleted") -
EXTERNAL_KEY_REGISTERED("external_key.registered") -
EXTERNAL_KEY_REMOVED("external_key.removed") -
GROUP_CREATED("group.created") -
GROUP_UPDATED("group.updated") -
GROUP_DELETED("group.deleted") -
INVITE_SENT("invite.sent") -
INVITE_ACCEPTED("invite.accepted") -
INVITE_DELETED("invite.deleted") -
IP_ALLOWLIST_CREATED("ip_allowlist.created") -
IP_ALLOWLIST_UPDATED("ip_allowlist.updated") -
IP_ALLOWLIST_DELETED("ip_allowlist.deleted") -
IP_ALLOWLIST_CONFIG_ACTIVATED("ip_allowlist.config.activated") -
IP_ALLOWLIST_CONFIG_DEACTIVATED("ip_allowlist.config.deactivated") -
LOGIN_SUCCEEDED("login.succeeded") -
LOGIN_FAILED("login.failed") -
LOGOUT_SUCCEEDED("logout.succeeded") -
LOGOUT_FAILED("logout.failed") -
ORGANIZATION_UPDATED("organization.updated") -
PROJECT_CREATED("project.created") -
PROJECT_UPDATED("project.updated") -
PROJECT_ARCHIVED("project.archived") -
PROJECT_DELETED("project.deleted") -
RATE_LIMIT_UPDATED("rate_limit.updated") -
RATE_LIMIT_DELETED("rate_limit.deleted") -
RESOURCE_DELETED("resource.deleted") -
TUNNEL_CREATED("tunnel.created") -
TUNNEL_UPDATED("tunnel.updated") -
TUNNEL_DELETED("tunnel.deleted") -
WORKLOAD_IDENTITY_PROVIDER_CREATED("workload_identity_provider.created") -
WORKLOAD_IDENTITY_PROVIDER_UPDATED("workload_identity_provider.updated") -
WORKLOAD_IDENTITY_PROVIDER_DELETED("workload_identity_provider.deleted") -
WORKLOAD_IDENTITY_PROVIDER_MAPPING_CREATED("workload_identity_provider_mapping.created") -
WORKLOAD_IDENTITY_PROVIDER_MAPPING_UPDATED("workload_identity_provider_mapping.updated") -
WORKLOAD_IDENTITY_PROVIDER_MAPPING_DELETED("workload_identity_provider_mapping.deleted") -
ROLE_CREATED("role.created") -
ROLE_UPDATED("role.updated") -
ROLE_DELETED("role.deleted") -
ROLE_ASSIGNMENT_CREATED("role.assignment.created") -
ROLE_ASSIGNMENT_DELETED("role.assignment.deleted") -
SCIM_ENABLED("scim.enabled") -
SCIM_DISABLED("scim.disabled") -
SERVICE_ACCOUNT_CREATED("service_account.created") -
SERVICE_ACCOUNT_UPDATED("service_account.updated") -
SERVICE_ACCOUNT_DELETED("service_account.deleted") -
USER_ADDED("user.added") -
USER_UPDATED("user.updated") -
USER_DELETED("user.deleted")
-
-
Optional<Long> limitA limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
-
Optional<List<String>> projectIdsReturn only events for these projects.
-
Optional<List<String>> resourceIdsReturn only events performed on these targets. For example, a project ID updated.
-
Returns
-
class AuditLogListResponse:A log of a user action or configuration change within this organization.
-
String idThe ID of this log.
-
long effectiveAtThe Unix timestamp (in seconds) of the event.
-
Type typeThe event type.
-
API_KEY_CREATED("api_key.created") -
API_KEY_UPDATED("api_key.updated") -
API_KEY_DELETED("api_key.deleted") -
CERTIFICATE_CREATED("certificate.created") -
CERTIFICATE_UPDATED("certificate.updated") -
CERTIFICATE_DELETED("certificate.deleted") -
CERTIFICATES_ACTIVATED("certificates.activated") -
CERTIFICATES_DEACTIVATED("certificates.deactivated") -
CHECKPOINT_PERMISSION_CREATED("checkpoint.permission.created") -
CHECKPOINT_PERMISSION_DELETED("checkpoint.permission.deleted") -
EXTERNAL_KEY_REGISTERED("external_key.registered") -
EXTERNAL_KEY_REMOVED("external_key.removed") -
GROUP_CREATED("group.created") -
GROUP_UPDATED("group.updated") -
GROUP_DELETED("group.deleted") -
INVITE_SENT("invite.sent") -
INVITE_ACCEPTED("invite.accepted") -
INVITE_DELETED("invite.deleted") -
IP_ALLOWLIST_CREATED("ip_allowlist.created") -
IP_ALLOWLIST_UPDATED("ip_allowlist.updated") -
IP_ALLOWLIST_DELETED("ip_allowlist.deleted") -
IP_ALLOWLIST_CONFIG_ACTIVATED("ip_allowlist.config.activated") -
IP_ALLOWLIST_CONFIG_DEACTIVATED("ip_allowlist.config.deactivated") -
LOGIN_SUCCEEDED("login.succeeded") -
LOGIN_FAILED("login.failed") -
LOGOUT_SUCCEEDED("logout.succeeded") -
LOGOUT_FAILED("logout.failed") -
ORGANIZATION_UPDATED("organization.updated") -
PROJECT_CREATED("project.created") -
PROJECT_UPDATED("project.updated") -
PROJECT_ARCHIVED("project.archived") -
PROJECT_DELETED("project.deleted") -
RATE_LIMIT_UPDATED("rate_limit.updated") -
RATE_LIMIT_DELETED("rate_limit.deleted") -
RESOURCE_DELETED("resource.deleted") -
TUNNEL_CREATED("tunnel.created") -
TUNNEL_UPDATED("tunnel.updated") -
TUNNEL_DELETED("tunnel.deleted") -
WORKLOAD_IDENTITY_PROVIDER_CREATED("workload_identity_provider.created") -
WORKLOAD_IDENTITY_PROVIDER_UPDATED("workload_identity_provider.updated") -
WORKLOAD_IDENTITY_PROVIDER_DELETED("workload_identity_provider.deleted") -
WORKLOAD_IDENTITY_PROVIDER_MAPPING_CREATED("workload_identity_provider_mapping.created") -
WORKLOAD_IDENTITY_PROVIDER_MAPPING_UPDATED("workload_identity_provider_mapping.updated") -
WORKLOAD_IDENTITY_PROVIDER_MAPPING_DELETED("workload_identity_provider_mapping.deleted") -
ROLE_CREATED("role.created") -
ROLE_UPDATED("role.updated") -
ROLE_DELETED("role.deleted") -
ROLE_ASSIGNMENT_CREATED("role.assignment.created") -
ROLE_ASSIGNMENT_DELETED("role.assignment.deleted") -
SCIM_ENABLED("scim.enabled") -
SCIM_DISABLED("scim.disabled") -
SERVICE_ACCOUNT_CREATED("service_account.created") -
SERVICE_ACCOUNT_UPDATED("service_account.updated") -
SERVICE_ACCOUNT_DELETED("service_account.deleted") -
USER_ADDED("user.added") -
USER_UPDATED("user.updated") -
USER_DELETED("user.deleted")
-
-
Optional<Actor> actorThe actor who performed the audit logged action.
-
Optional<ApiKey> apiKeyThe API Key used to perform the audit logged action.
-
Optional<String> idThe tracking id of the API key.
-
Optional<ServiceAccount> serviceAccountThe service account that performed the audit logged action.
-
Optional<String> idThe service account id.
-
-
Optional<Type> typeThe type of API key. Can be either
userorservice_account.-
USER("user") -
SERVICE_ACCOUNT("service_account")
-
-
Optional<User> userThe user who performed the audit logged action.
-
Optional<String> idThe user id.
-
Optional<String> emailThe user email.
-
-
-
Optional<Session> sessionThe session in which the audit logged action was performed.
-
Optional<String> ipAddressThe IP address from which the action was performed.
-
Optional<User> userThe user who performed the audit logged action.
-
Optional<String> idThe user id.
-
Optional<String> emailThe user email.
-
-
-
Optional<Type> typeThe type of actor. Is either
sessionorapi_key.-
SESSION("session") -
API_KEY("api_key")
-
-
-
Optional<ApiKeyCreated> apiKeyCreatedThe details for events with this
type.-
Optional<String> idThe tracking ID of the API key.
-
Optional<Data> dataThe payload used to create the API key.
-
Optional<List<String>> scopesA list of scopes allowed for the API key, e.g.
["api.model.request"]
-
-
-
Optional<ApiKeyDeleted> apiKeyDeletedThe details for events with this
type.-
Optional<String> idThe tracking ID of the API key.
-
-
Optional<ApiKeyUpdated> apiKeyUpdatedThe details for events with this
type.-
Optional<String> idThe tracking ID of the API key.
-
Optional<ChangesRequested> changesRequestedThe payload used to update the API key.
-
Optional<List<String>> scopesA list of scopes allowed for the API key, e.g.
["api.model.request"]
-
-
-
Optional<CertificateCreated> certificateCreatedThe details for events with this
type.-
Optional<String> idThe certificate ID.
-
Optional<String> nameThe name of the certificate.
-
-
Optional<CertificateDeleted> certificateDeletedThe details for events with this
type.-
Optional<String> idThe certificate ID.
-
Optional<String> certificateThe certificate content in PEM format.
-
Optional<String> nameThe name of the certificate.
-
-
Optional<CertificateUpdated> certificateUpdatedThe details for events with this
type.-
Optional<String> idThe certificate ID.
-
Optional<String> nameThe name of the certificate.
-
-
Optional<CertificatesActivated> certificatesActivatedThe details for events with this
type.-
Optional<List<Certificate>> certificates-
Optional<String> idThe certificate ID.
-
Optional<String> nameThe name of the certificate.
-
-
-
Optional<CertificatesDeactivated> certificatesDeactivatedThe details for events with this
type.-
Optional<List<Certificate>> certificates-
Optional<String> idThe certificate ID.
-
Optional<String> nameThe name of the certificate.
-
-
-
Optional<CheckpointPermissionCreated> checkpointPermissionCreatedThe project and fine-tuned model checkpoint that the checkpoint permission was created for.
-
Optional<String> idThe ID of the checkpoint permission.
-
Optional<Data> dataThe payload used to create the checkpoint permission.
-
Optional<String> fineTunedModelCheckpointThe ID of the fine-tuned model checkpoint.
-
Optional<String> projectIdThe ID of the project that the checkpoint permission was created for.
-
-
-
Optional<CheckpointPermissionDeleted> checkpointPermissionDeletedThe details for events with this
type.-
Optional<String> idThe ID of the checkpoint permission.
-
-
Optional<ExternalKeyRegistered> externalKeyRegisteredThe details for events with this
type.-
Optional<String> idThe ID of the external key configuration.
-
Optional<JsonValue> dataThe configuration for the external key.
-
-
Optional<ExternalKeyRemoved> externalKeyRemovedThe details for events with this
type.-
Optional<String> idThe ID of the external key configuration.
-
-
Optional<GroupCreated> groupCreatedThe details for events with this
type.-
Optional<String> idThe ID of the group.
-
Optional<Data> dataInformation about the created group.
-
Optional<String> groupNameThe group name.
-
-
-
Optional<GroupDeleted> groupDeletedThe details for events with this
type.-
Optional<String> idThe ID of the group.
-
-
Optional<GroupUpdated> groupUpdatedThe details for events with this
type.-
Optional<String> idThe ID of the group.
-
Optional<ChangesRequested> changesRequestedThe payload used to update the group.
-
Optional<String> groupNameThe updated group name.
-
-
-
Optional<InviteAccepted> inviteAcceptedThe details for events with this
type.-
Optional<String> idThe ID of the invite.
-
-
Optional<InviteDeleted> inviteDeletedThe details for events with this
type.-
Optional<String> idThe ID of the invite.
-
-
Optional<InviteSent> inviteSentThe details for events with this
type.-
Optional<String> idThe ID of the invite.
-
Optional<Data> dataThe payload used to create the invite.
-
Optional<String> emailThe email invited to the organization.
-
Optional<String> roleThe role the email was invited to be. Is either
ownerormember.
-
-
-
Optional<IpAllowlistConfigActivated> ipAllowlistConfigActivatedThe details for events with this
type.-
Optional<List<Config>> configsThe configurations that were activated.
-
Optional<String> idThe ID of the IP allowlist configuration.
-
Optional<String> nameThe name of the IP allowlist configuration.
-
-
-
Optional<IpAllowlistConfigDeactivated> ipAllowlistConfigDeactivatedThe details for events with this
type.-
Optional<List<Config>> configsThe configurations that were deactivated.
-
Optional<String> idThe ID of the IP allowlist configuration.
-
Optional<String> nameThe name of the IP allowlist configuration.
-
-
-
Optional<IpAllowlistCreated> ipAllowlistCreatedThe details for events with this
type.-
Optional<String> idThe ID of the IP allowlist configuration.
-
Optional<List<String>> allowedIpsThe IP addresses or CIDR ranges included in the configuration.
-
Optional<String> nameThe name of the IP allowlist configuration.
-
-
Optional<IpAllowlistDeleted> ipAllowlistDeletedThe details for events with this
type.-
Optional<String> idThe ID of the IP allowlist configuration.
-
Optional<List<String>> allowedIpsThe IP addresses or CIDR ranges that were in the configuration.
-
Optional<String> nameThe name of the IP allowlist configuration.
-
-
Optional<IpAllowlistUpdated> ipAllowlistUpdatedThe details for events with this
type.-
Optional<String> idThe ID of the IP allowlist configuration.
-
Optional<List<String>> allowedIpsThe updated set of IP addresses or CIDR ranges in the configuration.
-
-
Optional<LoginFailed> loginFailedThe details for events with this
type.-
Optional<String> errorCodeThe error code of the failure.
-
Optional<String> errorMessageThe error message of the failure.
-
-
Optional<JsonValue> loginSucceededThis event has no additional fields beyond the standard audit log attributes.
-
Optional<LogoutFailed> logoutFailedThe details for events with this
type.-
Optional<String> errorCodeThe error code of the failure.
-
Optional<String> errorMessageThe error message of the failure.
-
-
Optional<JsonValue> logoutSucceededThis event has no additional fields beyond the standard audit log attributes.
-
Optional<OrganizationUpdated> organizationUpdatedThe details for events with this
type.-
Optional<String> idThe organization ID.
-
Optional<ChangesRequested> changesRequestedThe payload used to update the organization settings.
-
Optional<String> apiCallLoggingHow your organization logs data from supported API calls. One of
disabled,enabled_per_call,enabled_for_all_projects, orenabled_for_selected_projects -
Optional<String> apiCallLoggingProjectIdsThe list of project ids if api_call_logging is set to
enabled_for_selected_projects -
Optional<String> descriptionThe organization description.
-
Optional<String> nameThe organization name.
-
Optional<String> threadsUiVisibilityVisibility of the threads page which shows messages created with the Assistants API and Playground. One of
ANY_ROLE,OWNERS, orNONE. -
Optional<String> titleThe organization title.
-
Optional<String> usageDashboardVisibilityVisibility of the usage dashboard which shows activity and costs for your organization. One of
ANY_ROLEorOWNERS.
-
-
-
Optional<Project> projectThe 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.
-
Optional<String> idThe project ID.
-
Optional<String> nameThe project title.
-
-
Optional<ProjectArchived> projectArchivedThe details for events with this
type.-
Optional<String> idThe project ID.
-
-
Optional<ProjectCreated> projectCreatedThe details for events with this
type.-
Optional<String> idThe project ID.
-
Optional<Data> dataThe payload used to create the project.
-
Optional<String> nameThe project name.
-
Optional<String> titleThe title of the project as seen on the dashboard.
-
-
-
Optional<ProjectDeleted> projectDeletedThe details for events with this
type.-
Optional<String> idThe project ID.
-
-
Optional<ProjectUpdated> projectUpdatedThe details for events with this
type.-
Optional<String> idThe project ID.
-
Optional<ChangesRequested> changesRequestedThe payload used to update the project.
-
Optional<String> titleThe title of the project as seen on the dashboard.
-
-
-
Optional<RateLimitDeleted> rateLimitDeletedThe details for events with this
type.-
Optional<String> idThe rate limit ID
-
-
Optional<RateLimitUpdated> rateLimitUpdatedThe details for events with this
type.-
Optional<String> idThe rate limit ID
-
Optional<ChangesRequested> changesRequestedThe payload used to update the rate limits.
-
Optional<Long> batch1DayMaxInputTokensThe maximum batch input tokens per day. Only relevant for certain models.
-
Optional<Long> maxAudioMegabytesPer1MinuteThe maximum audio megabytes per minute. Only relevant for certain models.
-
Optional<Long> maxImagesPer1MinuteThe maximum images per minute. Only relevant for certain models.
-
Optional<Long> maxRequestsPer1DayThe maximum requests per day. Only relevant for certain models.
-
Optional<Long> maxRequestsPer1MinuteThe maximum requests per minute.
-
Optional<Long> maxTokensPer1MinuteThe maximum tokens per minute.
-
-
-
Optional<RoleAssignmentCreated> roleAssignmentCreatedThe details for events with this
type.-
Optional<String> idThe identifier of the role assignment.
-
Optional<String> principalIdThe principal (user or group) that received the role.
-
Optional<String> principalTypeThe type of principal (user or group) that received the role.
-
Optional<String> resourceIdThe resource the role assignment is scoped to.
-
Optional<String> resourceTypeThe type of resource the role assignment is scoped to.
-
-
Optional<RoleAssignmentDeleted> roleAssignmentDeletedThe details for events with this
type.-
Optional<String> idThe identifier of the role assignment.
-
Optional<String> principalIdThe principal (user or group) that had the role removed.
-
Optional<String> principalTypeThe type of principal (user or group) that had the role removed.
-
Optional<String> resourceIdThe resource the role assignment was scoped to.
-
Optional<String> resourceTypeThe type of resource the role assignment was scoped to.
-
-
Optional<RoleCreated> roleCreatedThe details for events with this
type.-
Optional<String> idThe role ID.
-
Optional<List<String>> permissionsThe permissions granted by the role.
-
Optional<String> resourceIdThe resource the role is scoped to.
-
Optional<String> resourceTypeThe type of resource the role belongs to.
-
Optional<String> roleNameThe name of the role.
-
-
Optional<RoleDeleted> roleDeletedThe details for events with this
type.-
Optional<String> idThe role ID.
-
-
Optional<RoleUpdated> roleUpdatedThe details for events with this
type.-
Optional<String> idThe role ID.
-
Optional<ChangesRequested> changesRequestedThe payload used to update the role.
-
Optional<String> descriptionThe updated role description, when provided.
-
Optional<JsonValue> metadataAdditional metadata stored on the role.
-
Optional<List<String>> permissionsAddedThe permissions added to the role.
-
Optional<List<String>> permissionsRemovedThe permissions removed from the role.
-
Optional<String> resourceIdThe resource the role is scoped to.
-
Optional<String> resourceTypeThe type of resource the role belongs to.
-
Optional<String> roleNameThe updated role name, when provided.
-
-
-
Optional<ScimDisabled> scimDisabledThe details for events with this
type.-
Optional<String> idThe ID of the SCIM was disabled for.
-
-
Optional<ScimEnabled> scimEnabledThe details for events with this
type.-
Optional<String> idThe ID of the SCIM was enabled for.
-
-
Optional<ServiceAccountCreated> serviceAccountCreatedThe details for events with this
type.-
Optional<String> idThe service account ID.
-
Optional<Data> dataThe payload used to create the service account.
-
Optional<String> roleThe role of the service account. Is either
ownerormember.
-
-
-
Optional<ServiceAccountDeleted> serviceAccountDeletedThe details for events with this
type.-
Optional<String> idThe service account ID.
-
-
Optional<ServiceAccountUpdated> serviceAccountUpdatedThe details for events with this
type.-
Optional<String> idThe service account ID.
-
Optional<ChangesRequested> changesRequestedThe payload used to updated the service account.
-
Optional<String> roleThe role of the service account. Is either
ownerormember.
-
-
-
Optional<UserAdded> userAddedThe details for events with this
type.-
Optional<String> idThe user ID.
-
Optional<Data> dataThe payload used to add the user to the project.
-
Optional<String> roleThe role of the user. Is either
ownerormember.
-
-
-
Optional<UserDeleted> userDeletedThe details for events with this
type.-
Optional<String> idThe user ID.
-
-
Optional<UserUpdated> userUpdatedThe details for events with this
type.-
Optional<String> idThe project ID.
-
Optional<ChangesRequested> changesRequestedThe payload used to update the user.
-
Optional<String> roleThe role of the user. Is either
ownerormember.
-
-
-
Optional<WorkloadIdentityProviderMappingCreated> workloadIdentityProviderMappingCreatedThe details for events with this
type.-
Optional<String> idThe workload identity provider mapping ID.
-
Optional<JsonValue> dataThe payload used to create the workload identity provider mapping.
-
Optional<String> identityProviderIdThe workload identity provider ID.
-
-
Optional<WorkloadIdentityProviderMappingDeleted> workloadIdentityProviderMappingDeletedThe details for events with this
type.-
Optional<String> idThe workload identity provider mapping ID.
-
Optional<String> identityProviderIdThe workload identity provider ID.
-
Optional<String> projectIdThe project ID.
-
Optional<String> serviceAccountIdThe mapped service account ID.
-
-
Optional<WorkloadIdentityProviderMappingUpdated> workloadIdentityProviderMappingUpdatedThe details for events with this
type.-
Optional<String> idThe workload identity provider mapping ID.
-
Optional<JsonValue> changesRequestedThe payload used to update the workload identity provider mapping.
-
Optional<String> identityProviderIdThe workload identity provider ID.
-
-
Optional<WorkloadIdentityProviderCreated> workloadIdentityProviderCreatedThe details for events with this
type.-
Optional<String> idThe workload identity provider ID.
-
Optional<JsonValue> dataThe payload used to create the workload identity provider.
-
-
Optional<WorkloadIdentityProviderDeleted> workloadIdentityProviderDeletedThe details for events with this
type.-
Optional<String> idThe workload identity provider ID.
-
Optional<String> nameThe workload identity provider name.
-
-
Optional<WorkloadIdentityProviderUpdated> workloadIdentityProviderUpdatedThe details for events with this
type.-
Optional<String> idThe workload identity provider ID.
-
Optional<JsonValue> changesRequestedThe payload used to update the workload identity provider.
-
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.auditlogs.AuditLogListPage;
import com.openai.models.admin.organization.auditlogs.AuditLogListParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
AuditLogListPage page = client.admin().organization().auditLogs().list();
}
}
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"
}
Admin API Keys
List all organization and project API keys.
AdminApiKeyListPage admin().organization().adminApiKeys().list(AdminApiKeyListParamsparams = AdminApiKeyListParams.none(), RequestOptionsrequestOptions = RequestOptions.none())
get /organization/admin_api_keys
List organization API keys
Parameters
-
AdminApiKeyListParams params-
Optional<String> afterReturn keys with IDs that come after this ID in the pagination order.
-
Optional<Long> limitMaximum number of keys to return.
-
Optional<Order> orderOrder results by creation time, ascending or descending.
-
ASC("asc") -
DESC("desc")
-
-
Returns
-
class AdminApiKey:Represents an individual Admin API key in an org.
-
String idThe identifier, which can be referenced in API endpoints
-
long createdAtThe Unix timestamp (in seconds) of when the API key was created
-
JsonValue; object_ "organization.admin_api_key"constantThe object type, which is always
organization.admin_api_keyORGANIZATION_ADMIN_API_KEY("organization.admin_api_key")
-
Owner owner-
Optional<String> idThe identifier, which can be referenced in API endpoints
-
Optional<Long> createdAtThe Unix timestamp (in seconds) of when the user was created
-
Optional<String> nameThe name of the user
-
Optional<String> object_The object type, which is always organization.user
-
Optional<String> roleAlways
owner -
Optional<String> typeAlways
user
-
-
String redactedValueThe redacted value of the API key
-
Optional<Long> lastUsedAtThe Unix timestamp (in seconds) of when the API key was last used
-
Optional<String> nameThe name of the API key
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.adminapikeys.AdminApiKeyListPage;
import com.openai.models.admin.organization.adminapikeys.AdminApiKeyListParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
AdminApiKeyListPage page = client.admin().organization().adminApiKeys().list();
}
}
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
AdminApiKeyCreateResponse admin().organization().adminApiKeys().create(AdminApiKeyCreateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
post /organization/admin_api_keys
Create an organization admin API key
Parameters
-
AdminApiKeyCreateParams paramsString name
Returns
-
class AdminApiKeyCreateResponse:Represents an individual Admin API key in an org.
-
String valueThe value of the API key. Only shown on create.
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.adminapikeys.AdminApiKeyCreateParams;
import com.openai.models.admin.organization.adminapikeys.AdminApiKeyCreateResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
AdminApiKeyCreateParams params = AdminApiKeyCreateParams.builder()
.name("New Admin Key")
.build();
AdminApiKeyCreateResponse adminApiKey = client.admin().organization().adminApiKeys().create(params);
}
}
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
AdminApiKey admin().organization().adminApiKeys().retrieve(AdminApiKeyRetrieveParamsparams = AdminApiKeyRetrieveParams.none(), RequestOptionsrequestOptions = RequestOptions.none())
get /organization/admin_api_keys/{key_id}
Retrieve a single organization API key
Parameters
-
AdminApiKeyRetrieveParams params-
Optional<String> keyIdThe ID of the API key.
-
Returns
-
class AdminApiKey:Represents an individual Admin API key in an org.
-
String idThe identifier, which can be referenced in API endpoints
-
long createdAtThe Unix timestamp (in seconds) of when the API key was created
-
JsonValue; object_ "organization.admin_api_key"constantThe object type, which is always
organization.admin_api_keyORGANIZATION_ADMIN_API_KEY("organization.admin_api_key")
-
Owner owner-
Optional<String> idThe identifier, which can be referenced in API endpoints
-
Optional<Long> createdAtThe Unix timestamp (in seconds) of when the user was created
-
Optional<String> nameThe name of the user
-
Optional<String> object_The object type, which is always organization.user
-
Optional<String> roleAlways
owner -
Optional<String> typeAlways
user
-
-
String redactedValueThe redacted value of the API key
-
Optional<Long> lastUsedAtThe Unix timestamp (in seconds) of when the API key was last used
-
Optional<String> nameThe name of the API key
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.adminapikeys.AdminApiKey;
import com.openai.models.admin.organization.adminapikeys.AdminApiKeyRetrieveParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
AdminApiKey adminApiKey = client.admin().organization().adminApiKeys().retrieve("key_id");
}
}
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
AdminApiKeyDeleteResponse admin().organization().adminApiKeys().delete(AdminApiKeyDeleteParamsparams = AdminApiKeyDeleteParams.none(), RequestOptionsrequestOptions = RequestOptions.none())
delete /organization/admin_api_keys/{key_id}
Delete an organization admin API key
Parameters
-
AdminApiKeyDeleteParams params-
Optional<String> keyIdThe ID of the API key to be deleted.
-
Returns
-
class AdminApiKeyDeleteResponse:-
String id -
boolean deleted -
JsonValue; object_ "organization.admin_api_key.deleted"constantORGANIZATION_ADMIN_API_KEY_DELETED("organization.admin_api_key.deleted")
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.adminapikeys.AdminApiKeyDeleteParams;
import com.openai.models.admin.organization.adminapikeys.AdminApiKeyDeleteResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
AdminApiKeyDeleteResponse adminApiKey = client.admin().organization().adminApiKeys().delete("key_id");
}
}
Response
{
"id": "key_abc",
"deleted": true,
"object": "organization.admin_api_key.deleted"
}
Domain Types
Admin API Key
-
class AdminApiKey:Represents an individual Admin API key in an org.
-
String idThe identifier, which can be referenced in API endpoints
-
long createdAtThe Unix timestamp (in seconds) of when the API key was created
-
JsonValue; object_ "organization.admin_api_key"constantThe object type, which is always
organization.admin_api_keyORGANIZATION_ADMIN_API_KEY("organization.admin_api_key")
-
Owner owner-
Optional<String> idThe identifier, which can be referenced in API endpoints
-
Optional<Long> createdAtThe Unix timestamp (in seconds) of when the user was created
-
Optional<String> nameThe name of the user
-
Optional<String> object_The object type, which is always organization.user
-
Optional<String> roleAlways
owner -
Optional<String> typeAlways
user
-
-
String redactedValueThe redacted value of the API key
-
Optional<Long> lastUsedAtThe Unix timestamp (in seconds) of when the API key was last used
-
Optional<String> nameThe name of the API key
-
Usage
Audio speeches
UsageAudioSpeechesResponse admin().organization().usage().audioSpeeches(UsageAudioSpeechesParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
get /organization/usage/audio_speeches
Get audio speeches usage details for the organization.
Parameters
-
UsageAudioSpeechesParams params-
long startTimeStart time (Unix seconds) of the query time range, inclusive.
-
Optional<List<String>> apiKeyIdsReturn only usage for these API keys.
-
Optional<BucketWidth> bucketWidthWidth of each time bucket in response. Currently
1m,1hand1dare supported, default to1d.-
_1M("1m") -
_1H("1h") -
_1D("1d")
-
-
Optional<Long> endTimeEnd time (Unix seconds) of the query time range, exclusive.
-
Optional<List<GroupBy>> groupByGroup the usage data by the specified fields. Support fields include
project_id,user_id,api_key_id,modelor any combination of them.-
PROJECT_ID("project_id") -
USER_ID("user_id") -
API_KEY_ID("api_key_id") -
MODEL("model")
-
-
Optional<Long> limitSpecifies 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
-
Optional<List<String>> modelsReturn only usage for these models.
-
Optional<String> pageA cursor for use in pagination. Corresponding to the
next_pagefield from the previous response. -
Optional<List<String>> projectIdsReturn only usage for these projects.
-
Optional<List<String>> userIdsReturn only usage for these users.
-
Returns
-
class UsageAudioSpeechesResponse:-
List<Data> data-
long endTime -
JsonValue; object_ "bucket"constantBUCKET("bucket")
-
List<Result> results-
class OrganizationUsageCompletionsResult:The aggregated completions usage details of the specific time bucket.
-
long inputTokensThe aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens.
-
long numModelRequestsThe count of requests made to the model.
-
JsonValue; object_ "organization.usage.completions.result"constantORGANIZATION_USAGE_COMPLETIONS_RESULT("organization.usage.completions.result")
-
long outputTokensThe aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens.
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Optional<Boolean> batchWhen
group_by=batch, this field tells whether the grouped usage result is batch or not. -
Optional<Long> inputAudioTokensThe aggregated number of audio input tokens used, including cached tokens.
-
Optional<Long> inputCachedTokensThe aggregated number of text input tokens that has been cached from previous requests. For customers subscribe to scale tier, this includes scale tier tokens.
-
Optional<String> modelWhen
group_by=model, this field provides the model name of the grouped usage result. -
Optional<Long> outputAudioTokensThe aggregated number of audio output tokens used.
-
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Optional<String> serviceTierWhen
group_by=service_tier, this field provides the service tier of the grouped usage result. -
Optional<String> userIdWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageEmbeddingsResult:The aggregated embeddings usage details of the specific time bucket.
-
long inputTokensThe aggregated number of input tokens used.
-
long numModelRequestsThe count of requests made to the model.
-
JsonValue; object_ "organization.usage.embeddings.result"constantORGANIZATION_USAGE_EMBEDDINGS_RESULT("organization.usage.embeddings.result")
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Optional<String> modelWhen
group_by=model, this field provides the model name of the grouped usage result. -
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Optional<String> userIdWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageModerationsResult:The aggregated moderations usage details of the specific time bucket.
-
long inputTokensThe aggregated number of input tokens used.
-
long numModelRequestsThe count of requests made to the model.
-
JsonValue; object_ "organization.usage.moderations.result"constantORGANIZATION_USAGE_MODERATIONS_RESULT("organization.usage.moderations.result")
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Optional<String> modelWhen
group_by=model, this field provides the model name of the grouped usage result. -
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Optional<String> userIdWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageImagesResult:The aggregated images usage details of the specific time bucket.
-
long imagesThe number of images processed.
-
long numModelRequestsThe count of requests made to the model.
-
JsonValue; object_ "organization.usage.images.result"constantORGANIZATION_USAGE_IMAGES_RESULT("organization.usage.images.result")
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Optional<String> modelWhen
group_by=model, this field provides the model name of the grouped usage result. -
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Optional<String> sizeWhen
group_by=size, this field provides the image size of the grouped usage result. -
Optional<String> sourceWhen
group_by=source, this field provides the source of the grouped usage result, possible values areimage.generation,image.edit,image.variation. -
Optional<String> userIdWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageAudioSpeechesResult:The aggregated audio speeches usage details of the specific time bucket.
-
long charactersThe number of characters processed.
-
long numModelRequestsThe count of requests made to the model.
-
JsonValue; object_ "organization.usage.audio_speeches.result"constantORGANIZATION_USAGE_AUDIO_SPEECHES_RESULT("organization.usage.audio_speeches.result")
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Optional<String> modelWhen
group_by=model, this field provides the model name of the grouped usage result. -
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Optional<String> userIdWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageAudioTranscriptionsResult:The aggregated audio transcriptions usage details of the specific time bucket.
-
long numModelRequestsThe count of requests made to the model.
-
JsonValue; object_ "organization.usage.audio_transcriptions.result"constantORGANIZATION_USAGE_AUDIO_TRANSCRIPTIONS_RESULT("organization.usage.audio_transcriptions.result")
-
long secondsThe number of seconds processed.
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Optional<String> modelWhen
group_by=model, this field provides the model name of the grouped usage result. -
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Optional<String> userIdWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageVectorStoresResult:The aggregated vector stores usage details of the specific time bucket.
-
JsonValue; object_ "organization.usage.vector_stores.result"constantORGANIZATION_USAGE_VECTOR_STORES_RESULT("organization.usage.vector_stores.result")
-
long usageBytesThe vector stores usage in bytes.
-
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
class OrganizationUsageCodeInterpreterSessionsResult:The aggregated code interpreter sessions usage details of the specific time bucket.
-
long numSessionsThe number of code interpreter sessions.
-
JsonValue; object_ "organization.usage.code_interpreter_sessions.result"constantORGANIZATION_USAGE_CODE_INTERPRETER_SESSIONS_RESULT("organization.usage.code_interpreter_sessions.result")
-
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
class OrganizationUsageFileSearchesResult:The aggregated file search calls usage details of the specific time bucket.
-
long numRequestsThe count of file search calls.
-
JsonValue; object_ "organization.usage.file_searches.result"constantORGANIZATION_USAGE_FILE_SEARCHES_RESULT("organization.usage.file_searches.result")
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Optional<String> userIdWhen
group_by=user_id, this field provides the user ID of the grouped usage result. -
Optional<String> vectorStoreIdWhen
group_by=vector_store_id, this field provides the vector store ID of the grouped usage result.
-
-
class OrganizationUsageWebSearchesResult:The aggregated web search calls usage details of the specific time bucket.
-
long numModelRequestsThe count of model requests.
-
long numRequestsThe count of web search calls.
-
JsonValue; object_ "organization.usage.web_searches.result"constantORGANIZATION_USAGE_WEB_SEARCHES_RESULT("organization.usage.web_searches.result")
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Optional<String> contextLevelWhen
group_by=context_level, this field provides the search context size of the grouped usage result. -
Optional<String> modelWhen
group_by=model, this field provides the model name of the grouped usage result. -
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Optional<String> userIdWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationCostsResult:The aggregated costs details of the specific time bucket.
-
JsonValue; object_ "organization.costs.result"constantORGANIZATION_COSTS_RESULT("organization.costs.result")
-
Optional<Amount> amountThe monetary value in its associated currency.
-
Optional<String> currencyLowercase ISO-4217 currency e.g. "usd"
-
Optional<Double> valueThe numeric value of the cost.
-
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API Key ID of the grouped costs result. -
Optional<String> lineItemWhen
group_by=line_item, this field provides the line item of the grouped costs result. -
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped costs result. -
Optional<Double> quantityWhen
group_by=line_item, this field provides the quantity of the grouped costs result.
-
-
-
long startTime
-
-
boolean hasMore -
Optional<String> nextPage -
JsonValue; object_ "page"constantPAGE("page")
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.usage.UsageAudioSpeechesParams;
import com.openai.models.admin.organization.usage.UsageAudioSpeechesResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
UsageAudioSpeechesParams params = UsageAudioSpeechesParams.builder()
.startTime(0L)
.build();
UsageAudioSpeechesResponse response = client.admin().organization().usage().audioSpeeches(params);
}
}
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
UsageAudioTranscriptionsResponse admin().organization().usage().audioTranscriptions(UsageAudioTranscriptionsParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
get /organization/usage/audio_transcriptions
Get audio transcriptions usage details for the organization.
Parameters
-
UsageAudioTranscriptionsParams params-
long startTimeStart time (Unix seconds) of the query time range, inclusive.
-
Optional<List<String>> apiKeyIdsReturn only usage for these API keys.
-
Optional<BucketWidth> bucketWidthWidth of each time bucket in response. Currently
1m,1hand1dare supported, default to1d.-
_1M("1m") -
_1H("1h") -
_1D("1d")
-
-
Optional<Long> endTimeEnd time (Unix seconds) of the query time range, exclusive.
-
Optional<List<GroupBy>> groupByGroup the usage data by the specified fields. Support fields include
project_id,user_id,api_key_id,modelor any combination of them.-
PROJECT_ID("project_id") -
USER_ID("user_id") -
API_KEY_ID("api_key_id") -
MODEL("model")
-
-
Optional<Long> limitSpecifies 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
-
Optional<List<String>> modelsReturn only usage for these models.
-
Optional<String> pageA cursor for use in pagination. Corresponding to the
next_pagefield from the previous response. -
Optional<List<String>> projectIdsReturn only usage for these projects.
-
Optional<List<String>> userIdsReturn only usage for these users.
-
Returns
-
class UsageAudioTranscriptionsResponse:-
List<Data> data-
long endTime -
JsonValue; object_ "bucket"constantBUCKET("bucket")
-
List<Result> results-
class OrganizationUsageCompletionsResult:The aggregated completions usage details of the specific time bucket.
-
long inputTokensThe aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens.
-
long numModelRequestsThe count of requests made to the model.
-
JsonValue; object_ "organization.usage.completions.result"constantORGANIZATION_USAGE_COMPLETIONS_RESULT("organization.usage.completions.result")
-
long outputTokensThe aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens.
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Optional<Boolean> batchWhen
group_by=batch, this field tells whether the grouped usage result is batch or not. -
Optional<Long> inputAudioTokensThe aggregated number of audio input tokens used, including cached tokens.
-
Optional<Long> inputCachedTokensThe aggregated number of text input tokens that has been cached from previous requests. For customers subscribe to scale tier, this includes scale tier tokens.
-
Optional<String> modelWhen
group_by=model, this field provides the model name of the grouped usage result. -
Optional<Long> outputAudioTokensThe aggregated number of audio output tokens used.
-
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Optional<String> serviceTierWhen
group_by=service_tier, this field provides the service tier of the grouped usage result. -
Optional<String> userIdWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageEmbeddingsResult:The aggregated embeddings usage details of the specific time bucket.
-
long inputTokensThe aggregated number of input tokens used.
-
long numModelRequestsThe count of requests made to the model.
-
JsonValue; object_ "organization.usage.embeddings.result"constantORGANIZATION_USAGE_EMBEDDINGS_RESULT("organization.usage.embeddings.result")
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Optional<String> modelWhen
group_by=model, this field provides the model name of the grouped usage result. -
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Optional<String> userIdWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageModerationsResult:The aggregated moderations usage details of the specific time bucket.
-
long inputTokensThe aggregated number of input tokens used.
-
long numModelRequestsThe count of requests made to the model.
-
JsonValue; object_ "organization.usage.moderations.result"constantORGANIZATION_USAGE_MODERATIONS_RESULT("organization.usage.moderations.result")
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Optional<String> modelWhen
group_by=model, this field provides the model name of the grouped usage result. -
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Optional<String> userIdWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageImagesResult:The aggregated images usage details of the specific time bucket.
-
long imagesThe number of images processed.
-
long numModelRequestsThe count of requests made to the model.
-
JsonValue; object_ "organization.usage.images.result"constantORGANIZATION_USAGE_IMAGES_RESULT("organization.usage.images.result")
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Optional<String> modelWhen
group_by=model, this field provides the model name of the grouped usage result. -
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Optional<String> sizeWhen
group_by=size, this field provides the image size of the grouped usage result. -
Optional<String> sourceWhen
group_by=source, this field provides the source of the grouped usage result, possible values areimage.generation,image.edit,image.variation. -
Optional<String> userIdWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageAudioSpeechesResult:The aggregated audio speeches usage details of the specific time bucket.
-
long charactersThe number of characters processed.
-
long numModelRequestsThe count of requests made to the model.
-
JsonValue; object_ "organization.usage.audio_speeches.result"constantORGANIZATION_USAGE_AUDIO_SPEECHES_RESULT("organization.usage.audio_speeches.result")
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Optional<String> modelWhen
group_by=model, this field provides the model name of the grouped usage result. -
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Optional<String> userIdWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageAudioTranscriptionsResult:The aggregated audio transcriptions usage details of the specific time bucket.
-
long numModelRequestsThe count of requests made to the model.
-
JsonValue; object_ "organization.usage.audio_transcriptions.result"constantORGANIZATION_USAGE_AUDIO_TRANSCRIPTIONS_RESULT("organization.usage.audio_transcriptions.result")
-
long secondsThe number of seconds processed.
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Optional<String> modelWhen
group_by=model, this field provides the model name of the grouped usage result. -
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Optional<String> userIdWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageVectorStoresResult:The aggregated vector stores usage details of the specific time bucket.
-
JsonValue; object_ "organization.usage.vector_stores.result"constantORGANIZATION_USAGE_VECTOR_STORES_RESULT("organization.usage.vector_stores.result")
-
long usageBytesThe vector stores usage in bytes.
-
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
class OrganizationUsageCodeInterpreterSessionsResult:The aggregated code interpreter sessions usage details of the specific time bucket.
-
long numSessionsThe number of code interpreter sessions.
-
JsonValue; object_ "organization.usage.code_interpreter_sessions.result"constantORGANIZATION_USAGE_CODE_INTERPRETER_SESSIONS_RESULT("organization.usage.code_interpreter_sessions.result")
-
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
class OrganizationUsageFileSearchesResult:The aggregated file search calls usage details of the specific time bucket.
-
long numRequestsThe count of file search calls.
-
JsonValue; object_ "organization.usage.file_searches.result"constantORGANIZATION_USAGE_FILE_SEARCHES_RESULT("organization.usage.file_searches.result")
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Optional<String> userIdWhen
group_by=user_id, this field provides the user ID of the grouped usage result. -
Optional<String> vectorStoreIdWhen
group_by=vector_store_id, this field provides the vector store ID of the grouped usage result.
-
-
class OrganizationUsageWebSearchesResult:The aggregated web search calls usage details of the specific time bucket.
-
long numModelRequestsThe count of model requests.
-
long numRequestsThe count of web search calls.
-
JsonValue; object_ "organization.usage.web_searches.result"constantORGANIZATION_USAGE_WEB_SEARCHES_RESULT("organization.usage.web_searches.result")
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Optional<String> contextLevelWhen
group_by=context_level, this field provides the search context size of the grouped usage result. -
Optional<String> modelWhen
group_by=model, this field provides the model name of the grouped usage result. -
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Optional<String> userIdWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationCostsResult:The aggregated costs details of the specific time bucket.
-
JsonValue; object_ "organization.costs.result"constantORGANIZATION_COSTS_RESULT("organization.costs.result")
-
Optional<Amount> amountThe monetary value in its associated currency.
-
Optional<String> currencyLowercase ISO-4217 currency e.g. "usd"
-
Optional<Double> valueThe numeric value of the cost.
-
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API Key ID of the grouped costs result. -
Optional<String> lineItemWhen
group_by=line_item, this field provides the line item of the grouped costs result. -
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped costs result. -
Optional<Double> quantityWhen
group_by=line_item, this field provides the quantity of the grouped costs result.
-
-
-
long startTime
-
-
boolean hasMore -
Optional<String> nextPage -
JsonValue; object_ "page"constantPAGE("page")
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.usage.UsageAudioTranscriptionsParams;
import com.openai.models.admin.organization.usage.UsageAudioTranscriptionsResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
UsageAudioTranscriptionsParams params = UsageAudioTranscriptionsParams.builder()
.startTime(0L)
.build();
UsageAudioTranscriptionsResponse response = client.admin().organization().usage().audioTranscriptions(params);
}
}
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
UsageCodeInterpreterSessionsResponse admin().organization().usage().codeInterpreterSessions(UsageCodeInterpreterSessionsParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
get /organization/usage/code_interpreter_sessions
Get code interpreter sessions usage details for the organization.
Parameters
-
UsageCodeInterpreterSessionsParams params-
long startTimeStart time (Unix seconds) of the query time range, inclusive.
-
Optional<BucketWidth> bucketWidthWidth of each time bucket in response. Currently
1m,1hand1dare supported, default to1d.-
_1M("1m") -
_1H("1h") -
_1D("1d")
-
-
Optional<Long> endTimeEnd time (Unix seconds) of the query time range, exclusive.
-
Optional<List<GroupBy>> groupByGroup the usage data by the specified fields. Support fields include
project_id.PROJECT_ID("project_id")
-
Optional<Long> limitSpecifies 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
-
Optional<String> pageA cursor for use in pagination. Corresponding to the
next_pagefield from the previous response. -
Optional<List<String>> projectIdsReturn only usage for these projects.
-
Returns
-
class UsageCodeInterpreterSessionsResponse:-
List<Data> data-
long endTime -
JsonValue; object_ "bucket"constantBUCKET("bucket")
-
List<Result> results-
class OrganizationUsageCompletionsResult:The aggregated completions usage details of the specific time bucket.
-
long inputTokensThe aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens.
-
long numModelRequestsThe count of requests made to the model.
-
JsonValue; object_ "organization.usage.completions.result"constantORGANIZATION_USAGE_COMPLETIONS_RESULT("organization.usage.completions.result")
-
long outputTokensThe aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens.
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Optional<Boolean> batchWhen
group_by=batch, this field tells whether the grouped usage result is batch or not. -
Optional<Long> inputAudioTokensThe aggregated number of audio input tokens used, including cached tokens.
-
Optional<Long> inputCachedTokensThe aggregated number of text input tokens that has been cached from previous requests. For customers subscribe to scale tier, this includes scale tier tokens.
-
Optional<String> modelWhen
group_by=model, this field provides the model name of the grouped usage result. -
Optional<Long> outputAudioTokensThe aggregated number of audio output tokens used.
-
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Optional<String> serviceTierWhen
group_by=service_tier, this field provides the service tier of the grouped usage result. -
Optional<String> userIdWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageEmbeddingsResult:The aggregated embeddings usage details of the specific time bucket.
-
long inputTokensThe aggregated number of input tokens used.
-
long numModelRequestsThe count of requests made to the model.
-
JsonValue; object_ "organization.usage.embeddings.result"constantORGANIZATION_USAGE_EMBEDDINGS_RESULT("organization.usage.embeddings.result")
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Optional<String> modelWhen
group_by=model, this field provides the model name of the grouped usage result. -
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Optional<String> userIdWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageModerationsResult:The aggregated moderations usage details of the specific time bucket.
-
long inputTokensThe aggregated number of input tokens used.
-
long numModelRequestsThe count of requests made to the model.
-
JsonValue; object_ "organization.usage.moderations.result"constantORGANIZATION_USAGE_MODERATIONS_RESULT("organization.usage.moderations.result")
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Optional<String> modelWhen
group_by=model, this field provides the model name of the grouped usage result. -
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Optional<String> userIdWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageImagesResult:The aggregated images usage details of the specific time bucket.
-
long imagesThe number of images processed.
-
long numModelRequestsThe count of requests made to the model.
-
JsonValue; object_ "organization.usage.images.result"constantORGANIZATION_USAGE_IMAGES_RESULT("organization.usage.images.result")
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Optional<String> modelWhen
group_by=model, this field provides the model name of the grouped usage result. -
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Optional<String> sizeWhen
group_by=size, this field provides the image size of the grouped usage result. -
Optional<String> sourceWhen
group_by=source, this field provides the source of the grouped usage result, possible values areimage.generation,image.edit,image.variation. -
Optional<String> userIdWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageAudioSpeechesResult:The aggregated audio speeches usage details of the specific time bucket.
-
long charactersThe number of characters processed.
-
long numModelRequestsThe count of requests made to the model.
-
JsonValue; object_ "organization.usage.audio_speeches.result"constantORGANIZATION_USAGE_AUDIO_SPEECHES_RESULT("organization.usage.audio_speeches.result")
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Optional<String> modelWhen
group_by=model, this field provides the model name of the grouped usage result. -
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Optional<String> userIdWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageAudioTranscriptionsResult:The aggregated audio transcriptions usage details of the specific time bucket.
-
long numModelRequestsThe count of requests made to the model.
-
JsonValue; object_ "organization.usage.audio_transcriptions.result"constantORGANIZATION_USAGE_AUDIO_TRANSCRIPTIONS_RESULT("organization.usage.audio_transcriptions.result")
-
long secondsThe number of seconds processed.
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Optional<String> modelWhen
group_by=model, this field provides the model name of the grouped usage result. -
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Optional<String> userIdWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageVectorStoresResult:The aggregated vector stores usage details of the specific time bucket.
-
JsonValue; object_ "organization.usage.vector_stores.result"constantORGANIZATION_USAGE_VECTOR_STORES_RESULT("organization.usage.vector_stores.result")
-
long usageBytesThe vector stores usage in bytes.
-
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
class OrganizationUsageCodeInterpreterSessionsResult:The aggregated code interpreter sessions usage details of the specific time bucket.
-
long numSessionsThe number of code interpreter sessions.
-
JsonValue; object_ "organization.usage.code_interpreter_sessions.result"constantORGANIZATION_USAGE_CODE_INTERPRETER_SESSIONS_RESULT("organization.usage.code_interpreter_sessions.result")
-
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
class OrganizationUsageFileSearchesResult:The aggregated file search calls usage details of the specific time bucket.
-
long numRequestsThe count of file search calls.
-
JsonValue; object_ "organization.usage.file_searches.result"constantORGANIZATION_USAGE_FILE_SEARCHES_RESULT("organization.usage.file_searches.result")
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Optional<String> userIdWhen
group_by=user_id, this field provides the user ID of the grouped usage result. -
Optional<String> vectorStoreIdWhen
group_by=vector_store_id, this field provides the vector store ID of the grouped usage result.
-
-
class OrganizationUsageWebSearchesResult:The aggregated web search calls usage details of the specific time bucket.
-
long numModelRequestsThe count of model requests.
-
long numRequestsThe count of web search calls.
-
JsonValue; object_ "organization.usage.web_searches.result"constantORGANIZATION_USAGE_WEB_SEARCHES_RESULT("organization.usage.web_searches.result")
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Optional<String> contextLevelWhen
group_by=context_level, this field provides the search context size of the grouped usage result. -
Optional<String> modelWhen
group_by=model, this field provides the model name of the grouped usage result. -
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Optional<String> userIdWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationCostsResult:The aggregated costs details of the specific time bucket.
-
JsonValue; object_ "organization.costs.result"constantORGANIZATION_COSTS_RESULT("organization.costs.result")
-
Optional<Amount> amountThe monetary value in its associated currency.
-
Optional<String> currencyLowercase ISO-4217 currency e.g. "usd"
-
Optional<Double> valueThe numeric value of the cost.
-
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API Key ID of the grouped costs result. -
Optional<String> lineItemWhen
group_by=line_item, this field provides the line item of the grouped costs result. -
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped costs result. -
Optional<Double> quantityWhen
group_by=line_item, this field provides the quantity of the grouped costs result.
-
-
-
long startTime
-
-
boolean hasMore -
Optional<String> nextPage -
JsonValue; object_ "page"constantPAGE("page")
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.usage.UsageCodeInterpreterSessionsParams;
import com.openai.models.admin.organization.usage.UsageCodeInterpreterSessionsResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
UsageCodeInterpreterSessionsParams params = UsageCodeInterpreterSessionsParams.builder()
.startTime(0L)
.build();
UsageCodeInterpreterSessionsResponse response = client.admin().organization().usage().codeInterpreterSessions(params);
}
}
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
UsageCompletionsResponse admin().organization().usage().completions(UsageCompletionsParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
get /organization/usage/completions
Get completions usage details for the organization.
Parameters
-
UsageCompletionsParams params-
long startTimeStart time (Unix seconds) of the query time range, inclusive.
-
Optional<List<String>> apiKeyIdsReturn only usage for these API keys.
-
Optional<Boolean> batchIf
true, return batch jobs only. Iffalse, return non-batch jobs only. By default, return both. -
Optional<BucketWidth> bucketWidthWidth of each time bucket in response. Currently
1m,1hand1dare supported, default to1d.-
_1M("1m") -
_1H("1h") -
_1D("1d")
-
-
Optional<Long> endTimeEnd time (Unix seconds) of the query time range, exclusive.
-
Optional<List<GroupBy>> groupByGroup 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("project_id") -
USER_ID("user_id") -
API_KEY_ID("api_key_id") -
MODEL("model") -
BATCH("batch") -
SERVICE_TIER("service_tier")
-
-
Optional<Long> limitSpecifies 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
-
Optional<List<String>> modelsReturn only usage for these models.
-
Optional<String> pageA cursor for use in pagination. Corresponding to the
next_pagefield from the previous response. -
Optional<List<String>> projectIdsReturn only usage for these projects.
-
Optional<List<String>> userIdsReturn only usage for these users.
-
Returns
-
class UsageCompletionsResponse:-
List<Data> data-
long endTime -
JsonValue; object_ "bucket"constantBUCKET("bucket")
-
List<Result> results-
class OrganizationUsageCompletionsResult:The aggregated completions usage details of the specific time bucket.
-
long inputTokensThe aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens.
-
long numModelRequestsThe count of requests made to the model.
-
JsonValue; object_ "organization.usage.completions.result"constantORGANIZATION_USAGE_COMPLETIONS_RESULT("organization.usage.completions.result")
-
long outputTokensThe aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens.
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Optional<Boolean> batchWhen
group_by=batch, this field tells whether the grouped usage result is batch or not. -
Optional<Long> inputAudioTokensThe aggregated number of audio input tokens used, including cached tokens.
-
Optional<Long> inputCachedTokensThe aggregated number of text input tokens that has been cached from previous requests. For customers subscribe to scale tier, this includes scale tier tokens.
-
Optional<String> modelWhen
group_by=model, this field provides the model name of the grouped usage result. -
Optional<Long> outputAudioTokensThe aggregated number of audio output tokens used.
-
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Optional<String> serviceTierWhen
group_by=service_tier, this field provides the service tier of the grouped usage result. -
Optional<String> userIdWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageEmbeddingsResult:The aggregated embeddings usage details of the specific time bucket.
-
long inputTokensThe aggregated number of input tokens used.
-
long numModelRequestsThe count of requests made to the model.
-
JsonValue; object_ "organization.usage.embeddings.result"constantORGANIZATION_USAGE_EMBEDDINGS_RESULT("organization.usage.embeddings.result")
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Optional<String> modelWhen
group_by=model, this field provides the model name of the grouped usage result. -
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Optional<String> userIdWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageModerationsResult:The aggregated moderations usage details of the specific time bucket.
-
long inputTokensThe aggregated number of input tokens used.
-
long numModelRequestsThe count of requests made to the model.
-
JsonValue; object_ "organization.usage.moderations.result"constantORGANIZATION_USAGE_MODERATIONS_RESULT("organization.usage.moderations.result")
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Optional<String> modelWhen
group_by=model, this field provides the model name of the grouped usage result. -
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Optional<String> userIdWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageImagesResult:The aggregated images usage details of the specific time bucket.
-
long imagesThe number of images processed.
-
long numModelRequestsThe count of requests made to the model.
-
JsonValue; object_ "organization.usage.images.result"constantORGANIZATION_USAGE_IMAGES_RESULT("organization.usage.images.result")
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Optional<String> modelWhen
group_by=model, this field provides the model name of the grouped usage result. -
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Optional<String> sizeWhen
group_by=size, this field provides the image size of the grouped usage result. -
Optional<String> sourceWhen
group_by=source, this field provides the source of the grouped usage result, possible values areimage.generation,image.edit,image.variation. -
Optional<String> userIdWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageAudioSpeechesResult:The aggregated audio speeches usage details of the specific time bucket.
-
long charactersThe number of characters processed.
-
long numModelRequestsThe count of requests made to the model.
-
JsonValue; object_ "organization.usage.audio_speeches.result"constantORGANIZATION_USAGE_AUDIO_SPEECHES_RESULT("organization.usage.audio_speeches.result")
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Optional<String> modelWhen
group_by=model, this field provides the model name of the grouped usage result. -
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Optional<String> userIdWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageAudioTranscriptionsResult:The aggregated audio transcriptions usage details of the specific time bucket.
-
long numModelRequestsThe count of requests made to the model.
-
JsonValue; object_ "organization.usage.audio_transcriptions.result"constantORGANIZATION_USAGE_AUDIO_TRANSCRIPTIONS_RESULT("organization.usage.audio_transcriptions.result")
-
long secondsThe number of seconds processed.
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Optional<String> modelWhen
group_by=model, this field provides the model name of the grouped usage result. -
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Optional<String> userIdWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageVectorStoresResult:The aggregated vector stores usage details of the specific time bucket.
-
JsonValue; object_ "organization.usage.vector_stores.result"constantORGANIZATION_USAGE_VECTOR_STORES_RESULT("organization.usage.vector_stores.result")
-
long usageBytesThe vector stores usage in bytes.
-
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
class OrganizationUsageCodeInterpreterSessionsResult:The aggregated code interpreter sessions usage details of the specific time bucket.
-
long numSessionsThe number of code interpreter sessions.
-
JsonValue; object_ "organization.usage.code_interpreter_sessions.result"constantORGANIZATION_USAGE_CODE_INTERPRETER_SESSIONS_RESULT("organization.usage.code_interpreter_sessions.result")
-
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
class OrganizationUsageFileSearchesResult:The aggregated file search calls usage details of the specific time bucket.
-
long numRequestsThe count of file search calls.
-
JsonValue; object_ "organization.usage.file_searches.result"constantORGANIZATION_USAGE_FILE_SEARCHES_RESULT("organization.usage.file_searches.result")
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Optional<String> userIdWhen
group_by=user_id, this field provides the user ID of the grouped usage result. -
Optional<String> vectorStoreIdWhen
group_by=vector_store_id, this field provides the vector store ID of the grouped usage result.
-
-
class OrganizationUsageWebSearchesResult:The aggregated web search calls usage details of the specific time bucket.
-
long numModelRequestsThe count of model requests.
-
long numRequestsThe count of web search calls.
-
JsonValue; object_ "organization.usage.web_searches.result"constantORGANIZATION_USAGE_WEB_SEARCHES_RESULT("organization.usage.web_searches.result")
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Optional<String> contextLevelWhen
group_by=context_level, this field provides the search context size of the grouped usage result. -
Optional<String> modelWhen
group_by=model, this field provides the model name of the grouped usage result. -
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Optional<String> userIdWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationCostsResult:The aggregated costs details of the specific time bucket.
-
JsonValue; object_ "organization.costs.result"constantORGANIZATION_COSTS_RESULT("organization.costs.result")
-
Optional<Amount> amountThe monetary value in its associated currency.
-
Optional<String> currencyLowercase ISO-4217 currency e.g. "usd"
-
Optional<Double> valueThe numeric value of the cost.
-
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API Key ID of the grouped costs result. -
Optional<String> lineItemWhen
group_by=line_item, this field provides the line item of the grouped costs result. -
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped costs result. -
Optional<Double> quantityWhen
group_by=line_item, this field provides the quantity of the grouped costs result.
-
-
-
long startTime
-
-
boolean hasMore -
Optional<String> nextPage -
JsonValue; object_ "page"constantPAGE("page")
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.usage.UsageCompletionsParams;
import com.openai.models.admin.organization.usage.UsageCompletionsResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
UsageCompletionsParams params = UsageCompletionsParams.builder()
.startTime(0L)
.build();
UsageCompletionsResponse response = client.admin().organization().usage().completions(params);
}
}
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
UsageEmbeddingsResponse admin().organization().usage().embeddings(UsageEmbeddingsParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
get /organization/usage/embeddings
Get embeddings usage details for the organization.
Parameters
-
UsageEmbeddingsParams params-
long startTimeStart time (Unix seconds) of the query time range, inclusive.
-
Optional<List<String>> apiKeyIdsReturn only usage for these API keys.
-
Optional<BucketWidth> bucketWidthWidth of each time bucket in response. Currently
1m,1hand1dare supported, default to1d.-
_1M("1m") -
_1H("1h") -
_1D("1d")
-
-
Optional<Long> endTimeEnd time (Unix seconds) of the query time range, exclusive.
-
Optional<List<GroupBy>> groupByGroup the usage data by the specified fields. Support fields include
project_id,user_id,api_key_id,modelor any combination of them.-
PROJECT_ID("project_id") -
USER_ID("user_id") -
API_KEY_ID("api_key_id") -
MODEL("model")
-
-
Optional<Long> limitSpecifies 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
-
Optional<List<String>> modelsReturn only usage for these models.
-
Optional<String> pageA cursor for use in pagination. Corresponding to the
next_pagefield from the previous response. -
Optional<List<String>> projectIdsReturn only usage for these projects.
-
Optional<List<String>> userIdsReturn only usage for these users.
-
Returns
-
class UsageEmbeddingsResponse:-
List<Data> data-
long endTime -
JsonValue; object_ "bucket"constantBUCKET("bucket")
-
List<Result> results-
class OrganizationUsageCompletionsResult:The aggregated completions usage details of the specific time bucket.
-
long inputTokensThe aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens.
-
long numModelRequestsThe count of requests made to the model.
-
JsonValue; object_ "organization.usage.completions.result"constantORGANIZATION_USAGE_COMPLETIONS_RESULT("organization.usage.completions.result")
-
long outputTokensThe aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens.
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Optional<Boolean> batchWhen
group_by=batch, this field tells whether the grouped usage result is batch or not. -
Optional<Long> inputAudioTokensThe aggregated number of audio input tokens used, including cached tokens.
-
Optional<Long> inputCachedTokensThe aggregated number of text input tokens that has been cached from previous requests. For customers subscribe to scale tier, this includes scale tier tokens.
-
Optional<String> modelWhen
group_by=model, this field provides the model name of the grouped usage result. -
Optional<Long> outputAudioTokensThe aggregated number of audio output tokens used.
-
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Optional<String> serviceTierWhen
group_by=service_tier, this field provides the service tier of the grouped usage result. -
Optional<String> userIdWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageEmbeddingsResult:The aggregated embeddings usage details of the specific time bucket.
-
long inputTokensThe aggregated number of input tokens used.
-
long numModelRequestsThe count of requests made to the model.
-
JsonValue; object_ "organization.usage.embeddings.result"constantORGANIZATION_USAGE_EMBEDDINGS_RESULT("organization.usage.embeddings.result")
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Optional<String> modelWhen
group_by=model, this field provides the model name of the grouped usage result. -
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Optional<String> userIdWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageModerationsResult:The aggregated moderations usage details of the specific time bucket.
-
long inputTokensThe aggregated number of input tokens used.
-
long numModelRequestsThe count of requests made to the model.
-
JsonValue; object_ "organization.usage.moderations.result"constantORGANIZATION_USAGE_MODERATIONS_RESULT("organization.usage.moderations.result")
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Optional<String> modelWhen
group_by=model, this field provides the model name of the grouped usage result. -
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Optional<String> userIdWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageImagesResult:The aggregated images usage details of the specific time bucket.
-
long imagesThe number of images processed.
-
long numModelRequestsThe count of requests made to the model.
-
JsonValue; object_ "organization.usage.images.result"constantORGANIZATION_USAGE_IMAGES_RESULT("organization.usage.images.result")
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Optional<String> modelWhen
group_by=model, this field provides the model name of the grouped usage result. -
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Optional<String> sizeWhen
group_by=size, this field provides the image size of the grouped usage result. -
Optional<String> sourceWhen
group_by=source, this field provides the source of the grouped usage result, possible values areimage.generation,image.edit,image.variation. -
Optional<String> userIdWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageAudioSpeechesResult:The aggregated audio speeches usage details of the specific time bucket.
-
long charactersThe number of characters processed.
-
long numModelRequestsThe count of requests made to the model.
-
JsonValue; object_ "organization.usage.audio_speeches.result"constantORGANIZATION_USAGE_AUDIO_SPEECHES_RESULT("organization.usage.audio_speeches.result")
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Optional<String> modelWhen
group_by=model, this field provides the model name of the grouped usage result. -
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Optional<String> userIdWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageAudioTranscriptionsResult:The aggregated audio transcriptions usage details of the specific time bucket.
-
long numModelRequestsThe count of requests made to the model.
-
JsonValue; object_ "organization.usage.audio_transcriptions.result"constantORGANIZATION_USAGE_AUDIO_TRANSCRIPTIONS_RESULT("organization.usage.audio_transcriptions.result")
-
long secondsThe number of seconds processed.
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Optional<String> modelWhen
group_by=model, this field provides the model name of the grouped usage result. -
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Optional<String> userIdWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageVectorStoresResult:The aggregated vector stores usage details of the specific time bucket.
-
JsonValue; object_ "organization.usage.vector_stores.result"constantORGANIZATION_USAGE_VECTOR_STORES_RESULT("organization.usage.vector_stores.result")
-
long usageBytesThe vector stores usage in bytes.
-
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
class OrganizationUsageCodeInterpreterSessionsResult:The aggregated code interpreter sessions usage details of the specific time bucket.
-
long numSessionsThe number of code interpreter sessions.
-
JsonValue; object_ "organization.usage.code_interpreter_sessions.result"constantORGANIZATION_USAGE_CODE_INTERPRETER_SESSIONS_RESULT("organization.usage.code_interpreter_sessions.result")
-
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
class OrganizationUsageFileSearchesResult:The aggregated file search calls usage details of the specific time bucket.
-
long numRequestsThe count of file search calls.
-
JsonValue; object_ "organization.usage.file_searches.result"constantORGANIZATION_USAGE_FILE_SEARCHES_RESULT("organization.usage.file_searches.result")
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Optional<String> userIdWhen
group_by=user_id, this field provides the user ID of the grouped usage result. -
Optional<String> vectorStoreIdWhen
group_by=vector_store_id, this field provides the vector store ID of the grouped usage result.
-
-
class OrganizationUsageWebSearchesResult:The aggregated web search calls usage details of the specific time bucket.
-
long numModelRequestsThe count of model requests.
-
long numRequestsThe count of web search calls.
-
JsonValue; object_ "organization.usage.web_searches.result"constantORGANIZATION_USAGE_WEB_SEARCHES_RESULT("organization.usage.web_searches.result")
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Optional<String> contextLevelWhen
group_by=context_level, this field provides the search context size of the grouped usage result. -
Optional<String> modelWhen
group_by=model, this field provides the model name of the grouped usage result. -
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Optional<String> userIdWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationCostsResult:The aggregated costs details of the specific time bucket.
-
JsonValue; object_ "organization.costs.result"constantORGANIZATION_COSTS_RESULT("organization.costs.result")
-
Optional<Amount> amountThe monetary value in its associated currency.
-
Optional<String> currencyLowercase ISO-4217 currency e.g. "usd"
-
Optional<Double> valueThe numeric value of the cost.
-
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API Key ID of the grouped costs result. -
Optional<String> lineItemWhen
group_by=line_item, this field provides the line item of the grouped costs result. -
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped costs result. -
Optional<Double> quantityWhen
group_by=line_item, this field provides the quantity of the grouped costs result.
-
-
-
long startTime
-
-
boolean hasMore -
Optional<String> nextPage -
JsonValue; object_ "page"constantPAGE("page")
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.usage.UsageEmbeddingsParams;
import com.openai.models.admin.organization.usage.UsageEmbeddingsResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
UsageEmbeddingsParams params = UsageEmbeddingsParams.builder()
.startTime(0L)
.build();
UsageEmbeddingsResponse response = client.admin().organization().usage().embeddings(params);
}
}
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
UsageImagesResponse admin().organization().usage().images(UsageImagesParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
get /organization/usage/images
Get images usage details for the organization.
Parameters
-
UsageImagesParams params-
long startTimeStart time (Unix seconds) of the query time range, inclusive.
-
Optional<List<String>> apiKeyIdsReturn only usage for these API keys.
-
Optional<BucketWidth> bucketWidthWidth of each time bucket in response. Currently
1m,1hand1dare supported, default to1d.-
_1M("1m") -
_1H("1h") -
_1D("1d")
-
-
Optional<Long> endTimeEnd time (Unix seconds) of the query time range, exclusive.
-
Optional<List<GroupBy>> groupByGroup 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("project_id") -
USER_ID("user_id") -
API_KEY_ID("api_key_id") -
MODEL("model") -
SIZE("size") -
SOURCE("source")
-
-
Optional<Long> limitSpecifies 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
-
Optional<List<String>> modelsReturn only usage for these models.
-
Optional<String> pageA cursor for use in pagination. Corresponding to the
next_pagefield from the previous response. -
Optional<List<String>> projectIdsReturn only usage for these projects.
-
Optional<List<Size>> sizesReturn only usages for these image sizes. Possible values are
256x256,512x512,1024x1024,1792x1792,1024x1792or any combination of them.-
_256X256("256x256") -
_512X512("512x512") -
_1024X1024("1024x1024") -
_1792X1792("1792x1792") -
_1024X1792("1024x1792")
-
-
Optional<List<Source>> sourcesReturn only usages for these sources. Possible values are
image.generation,image.edit,image.variationor any combination of them.-
IMAGE_GENERATION("image.generation") -
IMAGE_EDIT("image.edit") -
IMAGE_VARIATION("image.variation")
-
-
Optional<List<String>> userIdsReturn only usage for these users.
-
Returns
-
class UsageImagesResponse:-
List<Data> data-
long endTime -
JsonValue; object_ "bucket"constantBUCKET("bucket")
-
List<Result> results-
class OrganizationUsageCompletionsResult:The aggregated completions usage details of the specific time bucket.
-
long inputTokensThe aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens.
-
long numModelRequestsThe count of requests made to the model.
-
JsonValue; object_ "organization.usage.completions.result"constantORGANIZATION_USAGE_COMPLETIONS_RESULT("organization.usage.completions.result")
-
long outputTokensThe aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens.
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Optional<Boolean> batchWhen
group_by=batch, this field tells whether the grouped usage result is batch or not. -
Optional<Long> inputAudioTokensThe aggregated number of audio input tokens used, including cached tokens.
-
Optional<Long> inputCachedTokensThe aggregated number of text input tokens that has been cached from previous requests. For customers subscribe to scale tier, this includes scale tier tokens.
-
Optional<String> modelWhen
group_by=model, this field provides the model name of the grouped usage result. -
Optional<Long> outputAudioTokensThe aggregated number of audio output tokens used.
-
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Optional<String> serviceTierWhen
group_by=service_tier, this field provides the service tier of the grouped usage result. -
Optional<String> userIdWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageEmbeddingsResult:The aggregated embeddings usage details of the specific time bucket.
-
long inputTokensThe aggregated number of input tokens used.
-
long numModelRequestsThe count of requests made to the model.
-
JsonValue; object_ "organization.usage.embeddings.result"constantORGANIZATION_USAGE_EMBEDDINGS_RESULT("organization.usage.embeddings.result")
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Optional<String> modelWhen
group_by=model, this field provides the model name of the grouped usage result. -
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Optional<String> userIdWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageModerationsResult:The aggregated moderations usage details of the specific time bucket.
-
long inputTokensThe aggregated number of input tokens used.
-
long numModelRequestsThe count of requests made to the model.
-
JsonValue; object_ "organization.usage.moderations.result"constantORGANIZATION_USAGE_MODERATIONS_RESULT("organization.usage.moderations.result")
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Optional<String> modelWhen
group_by=model, this field provides the model name of the grouped usage result. -
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Optional<String> userIdWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageImagesResult:The aggregated images usage details of the specific time bucket.
-
long imagesThe number of images processed.
-
long numModelRequestsThe count of requests made to the model.
-
JsonValue; object_ "organization.usage.images.result"constantORGANIZATION_USAGE_IMAGES_RESULT("organization.usage.images.result")
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Optional<String> modelWhen
group_by=model, this field provides the model name of the grouped usage result. -
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Optional<String> sizeWhen
group_by=size, this field provides the image size of the grouped usage result. -
Optional<String> sourceWhen
group_by=source, this field provides the source of the grouped usage result, possible values areimage.generation,image.edit,image.variation. -
Optional<String> userIdWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageAudioSpeechesResult:The aggregated audio speeches usage details of the specific time bucket.
-
long charactersThe number of characters processed.
-
long numModelRequestsThe count of requests made to the model.
-
JsonValue; object_ "organization.usage.audio_speeches.result"constantORGANIZATION_USAGE_AUDIO_SPEECHES_RESULT("organization.usage.audio_speeches.result")
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Optional<String> modelWhen
group_by=model, this field provides the model name of the grouped usage result. -
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Optional<String> userIdWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageAudioTranscriptionsResult:The aggregated audio transcriptions usage details of the specific time bucket.
-
long numModelRequestsThe count of requests made to the model.
-
JsonValue; object_ "organization.usage.audio_transcriptions.result"constantORGANIZATION_USAGE_AUDIO_TRANSCRIPTIONS_RESULT("organization.usage.audio_transcriptions.result")
-
long secondsThe number of seconds processed.
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Optional<String> modelWhen
group_by=model, this field provides the model name of the grouped usage result. -
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Optional<String> userIdWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageVectorStoresResult:The aggregated vector stores usage details of the specific time bucket.
-
JsonValue; object_ "organization.usage.vector_stores.result"constantORGANIZATION_USAGE_VECTOR_STORES_RESULT("organization.usage.vector_stores.result")
-
long usageBytesThe vector stores usage in bytes.
-
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
class OrganizationUsageCodeInterpreterSessionsResult:The aggregated code interpreter sessions usage details of the specific time bucket.
-
long numSessionsThe number of code interpreter sessions.
-
JsonValue; object_ "organization.usage.code_interpreter_sessions.result"constantORGANIZATION_USAGE_CODE_INTERPRETER_SESSIONS_RESULT("organization.usage.code_interpreter_sessions.result")
-
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
class OrganizationUsageFileSearchesResult:The aggregated file search calls usage details of the specific time bucket.
-
long numRequestsThe count of file search calls.
-
JsonValue; object_ "organization.usage.file_searches.result"constantORGANIZATION_USAGE_FILE_SEARCHES_RESULT("organization.usage.file_searches.result")
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Optional<String> userIdWhen
group_by=user_id, this field provides the user ID of the grouped usage result. -
Optional<String> vectorStoreIdWhen
group_by=vector_store_id, this field provides the vector store ID of the grouped usage result.
-
-
class OrganizationUsageWebSearchesResult:The aggregated web search calls usage details of the specific time bucket.
-
long numModelRequestsThe count of model requests.
-
long numRequestsThe count of web search calls.
-
JsonValue; object_ "organization.usage.web_searches.result"constantORGANIZATION_USAGE_WEB_SEARCHES_RESULT("organization.usage.web_searches.result")
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Optional<String> contextLevelWhen
group_by=context_level, this field provides the search context size of the grouped usage result. -
Optional<String> modelWhen
group_by=model, this field provides the model name of the grouped usage result. -
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Optional<String> userIdWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationCostsResult:The aggregated costs details of the specific time bucket.
-
JsonValue; object_ "organization.costs.result"constantORGANIZATION_COSTS_RESULT("organization.costs.result")
-
Optional<Amount> amountThe monetary value in its associated currency.
-
Optional<String> currencyLowercase ISO-4217 currency e.g. "usd"
-
Optional<Double> valueThe numeric value of the cost.
-
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API Key ID of the grouped costs result. -
Optional<String> lineItemWhen
group_by=line_item, this field provides the line item of the grouped costs result. -
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped costs result. -
Optional<Double> quantityWhen
group_by=line_item, this field provides the quantity of the grouped costs result.
-
-
-
long startTime
-
-
boolean hasMore -
Optional<String> nextPage -
JsonValue; object_ "page"constantPAGE("page")
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.usage.UsageImagesParams;
import com.openai.models.admin.organization.usage.UsageImagesResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
UsageImagesParams params = UsageImagesParams.builder()
.startTime(0L)
.build();
UsageImagesResponse response = client.admin().organization().usage().images(params);
}
}
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
UsageModerationsResponse admin().organization().usage().moderations(UsageModerationsParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
get /organization/usage/moderations
Get moderations usage details for the organization.
Parameters
-
UsageModerationsParams params-
long startTimeStart time (Unix seconds) of the query time range, inclusive.
-
Optional<List<String>> apiKeyIdsReturn only usage for these API keys.
-
Optional<BucketWidth> bucketWidthWidth of each time bucket in response. Currently
1m,1hand1dare supported, default to1d.-
_1M("1m") -
_1H("1h") -
_1D("1d")
-
-
Optional<Long> endTimeEnd time (Unix seconds) of the query time range, exclusive.
-
Optional<List<GroupBy>> groupByGroup the usage data by the specified fields. Support fields include
project_id,user_id,api_key_id,modelor any combination of them.-
PROJECT_ID("project_id") -
USER_ID("user_id") -
API_KEY_ID("api_key_id") -
MODEL("model")
-
-
Optional<Long> limitSpecifies 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
-
Optional<List<String>> modelsReturn only usage for these models.
-
Optional<String> pageA cursor for use in pagination. Corresponding to the
next_pagefield from the previous response. -
Optional<List<String>> projectIdsReturn only usage for these projects.
-
Optional<List<String>> userIdsReturn only usage for these users.
-
Returns
-
class UsageModerationsResponse:-
List<Data> data-
long endTime -
JsonValue; object_ "bucket"constantBUCKET("bucket")
-
List<Result> results-
class OrganizationUsageCompletionsResult:The aggregated completions usage details of the specific time bucket.
-
long inputTokensThe aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens.
-
long numModelRequestsThe count of requests made to the model.
-
JsonValue; object_ "organization.usage.completions.result"constantORGANIZATION_USAGE_COMPLETIONS_RESULT("organization.usage.completions.result")
-
long outputTokensThe aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens.
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Optional<Boolean> batchWhen
group_by=batch, this field tells whether the grouped usage result is batch or not. -
Optional<Long> inputAudioTokensThe aggregated number of audio input tokens used, including cached tokens.
-
Optional<Long> inputCachedTokensThe aggregated number of text input tokens that has been cached from previous requests. For customers subscribe to scale tier, this includes scale tier tokens.
-
Optional<String> modelWhen
group_by=model, this field provides the model name of the grouped usage result. -
Optional<Long> outputAudioTokensThe aggregated number of audio output tokens used.
-
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Optional<String> serviceTierWhen
group_by=service_tier, this field provides the service tier of the grouped usage result. -
Optional<String> userIdWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageEmbeddingsResult:The aggregated embeddings usage details of the specific time bucket.
-
long inputTokensThe aggregated number of input tokens used.
-
long numModelRequestsThe count of requests made to the model.
-
JsonValue; object_ "organization.usage.embeddings.result"constantORGANIZATION_USAGE_EMBEDDINGS_RESULT("organization.usage.embeddings.result")
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Optional<String> modelWhen
group_by=model, this field provides the model name of the grouped usage result. -
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Optional<String> userIdWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageModerationsResult:The aggregated moderations usage details of the specific time bucket.
-
long inputTokensThe aggregated number of input tokens used.
-
long numModelRequestsThe count of requests made to the model.
-
JsonValue; object_ "organization.usage.moderations.result"constantORGANIZATION_USAGE_MODERATIONS_RESULT("organization.usage.moderations.result")
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Optional<String> modelWhen
group_by=model, this field provides the model name of the grouped usage result. -
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Optional<String> userIdWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageImagesResult:The aggregated images usage details of the specific time bucket.
-
long imagesThe number of images processed.
-
long numModelRequestsThe count of requests made to the model.
-
JsonValue; object_ "organization.usage.images.result"constantORGANIZATION_USAGE_IMAGES_RESULT("organization.usage.images.result")
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Optional<String> modelWhen
group_by=model, this field provides the model name of the grouped usage result. -
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Optional<String> sizeWhen
group_by=size, this field provides the image size of the grouped usage result. -
Optional<String> sourceWhen
group_by=source, this field provides the source of the grouped usage result, possible values areimage.generation,image.edit,image.variation. -
Optional<String> userIdWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageAudioSpeechesResult:The aggregated audio speeches usage details of the specific time bucket.
-
long charactersThe number of characters processed.
-
long numModelRequestsThe count of requests made to the model.
-
JsonValue; object_ "organization.usage.audio_speeches.result"constantORGANIZATION_USAGE_AUDIO_SPEECHES_RESULT("organization.usage.audio_speeches.result")
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Optional<String> modelWhen
group_by=model, this field provides the model name of the grouped usage result. -
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Optional<String> userIdWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageAudioTranscriptionsResult:The aggregated audio transcriptions usage details of the specific time bucket.
-
long numModelRequestsThe count of requests made to the model.
-
JsonValue; object_ "organization.usage.audio_transcriptions.result"constantORGANIZATION_USAGE_AUDIO_TRANSCRIPTIONS_RESULT("organization.usage.audio_transcriptions.result")
-
long secondsThe number of seconds processed.
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Optional<String> modelWhen
group_by=model, this field provides the model name of the grouped usage result. -
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Optional<String> userIdWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageVectorStoresResult:The aggregated vector stores usage details of the specific time bucket.
-
JsonValue; object_ "organization.usage.vector_stores.result"constantORGANIZATION_USAGE_VECTOR_STORES_RESULT("organization.usage.vector_stores.result")
-
long usageBytesThe vector stores usage in bytes.
-
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
class OrganizationUsageCodeInterpreterSessionsResult:The aggregated code interpreter sessions usage details of the specific time bucket.
-
long numSessionsThe number of code interpreter sessions.
-
JsonValue; object_ "organization.usage.code_interpreter_sessions.result"constantORGANIZATION_USAGE_CODE_INTERPRETER_SESSIONS_RESULT("organization.usage.code_interpreter_sessions.result")
-
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
class OrganizationUsageFileSearchesResult:The aggregated file search calls usage details of the specific time bucket.
-
long numRequestsThe count of file search calls.
-
JsonValue; object_ "organization.usage.file_searches.result"constantORGANIZATION_USAGE_FILE_SEARCHES_RESULT("organization.usage.file_searches.result")
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Optional<String> userIdWhen
group_by=user_id, this field provides the user ID of the grouped usage result. -
Optional<String> vectorStoreIdWhen
group_by=vector_store_id, this field provides the vector store ID of the grouped usage result.
-
-
class OrganizationUsageWebSearchesResult:The aggregated web search calls usage details of the specific time bucket.
-
long numModelRequestsThe count of model requests.
-
long numRequestsThe count of web search calls.
-
JsonValue; object_ "organization.usage.web_searches.result"constantORGANIZATION_USAGE_WEB_SEARCHES_RESULT("organization.usage.web_searches.result")
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Optional<String> contextLevelWhen
group_by=context_level, this field provides the search context size of the grouped usage result. -
Optional<String> modelWhen
group_by=model, this field provides the model name of the grouped usage result. -
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Optional<String> userIdWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationCostsResult:The aggregated costs details of the specific time bucket.
-
JsonValue; object_ "organization.costs.result"constantORGANIZATION_COSTS_RESULT("organization.costs.result")
-
Optional<Amount> amountThe monetary value in its associated currency.
-
Optional<String> currencyLowercase ISO-4217 currency e.g. "usd"
-
Optional<Double> valueThe numeric value of the cost.
-
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API Key ID of the grouped costs result. -
Optional<String> lineItemWhen
group_by=line_item, this field provides the line item of the grouped costs result. -
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped costs result. -
Optional<Double> quantityWhen
group_by=line_item, this field provides the quantity of the grouped costs result.
-
-
-
long startTime
-
-
boolean hasMore -
Optional<String> nextPage -
JsonValue; object_ "page"constantPAGE("page")
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.usage.UsageModerationsParams;
import com.openai.models.admin.organization.usage.UsageModerationsResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
UsageModerationsParams params = UsageModerationsParams.builder()
.startTime(0L)
.build();
UsageModerationsResponse response = client.admin().organization().usage().moderations(params);
}
}
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
UsageVectorStoresResponse admin().organization().usage().vectorStores(UsageVectorStoresParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
get /organization/usage/vector_stores
Get vector stores usage details for the organization.
Parameters
-
UsageVectorStoresParams params-
long startTimeStart time (Unix seconds) of the query time range, inclusive.
-
Optional<BucketWidth> bucketWidthWidth of each time bucket in response. Currently
1m,1hand1dare supported, default to1d.-
_1M("1m") -
_1H("1h") -
_1D("1d")
-
-
Optional<Long> endTimeEnd time (Unix seconds) of the query time range, exclusive.
-
Optional<List<GroupBy>> groupByGroup the usage data by the specified fields. Support fields include
project_id.PROJECT_ID("project_id")
-
Optional<Long> limitSpecifies 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
-
Optional<String> pageA cursor for use in pagination. Corresponding to the
next_pagefield from the previous response. -
Optional<List<String>> projectIdsReturn only usage for these projects.
-
Returns
-
class UsageVectorStoresResponse:-
List<Data> data-
long endTime -
JsonValue; object_ "bucket"constantBUCKET("bucket")
-
List<Result> results-
class OrganizationUsageCompletionsResult:The aggregated completions usage details of the specific time bucket.
-
long inputTokensThe aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens.
-
long numModelRequestsThe count of requests made to the model.
-
JsonValue; object_ "organization.usage.completions.result"constantORGANIZATION_USAGE_COMPLETIONS_RESULT("organization.usage.completions.result")
-
long outputTokensThe aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens.
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Optional<Boolean> batchWhen
group_by=batch, this field tells whether the grouped usage result is batch or not. -
Optional<Long> inputAudioTokensThe aggregated number of audio input tokens used, including cached tokens.
-
Optional<Long> inputCachedTokensThe aggregated number of text input tokens that has been cached from previous requests. For customers subscribe to scale tier, this includes scale tier tokens.
-
Optional<String> modelWhen
group_by=model, this field provides the model name of the grouped usage result. -
Optional<Long> outputAudioTokensThe aggregated number of audio output tokens used.
-
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Optional<String> serviceTierWhen
group_by=service_tier, this field provides the service tier of the grouped usage result. -
Optional<String> userIdWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageEmbeddingsResult:The aggregated embeddings usage details of the specific time bucket.
-
long inputTokensThe aggregated number of input tokens used.
-
long numModelRequestsThe count of requests made to the model.
-
JsonValue; object_ "organization.usage.embeddings.result"constantORGANIZATION_USAGE_EMBEDDINGS_RESULT("organization.usage.embeddings.result")
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Optional<String> modelWhen
group_by=model, this field provides the model name of the grouped usage result. -
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Optional<String> userIdWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageModerationsResult:The aggregated moderations usage details of the specific time bucket.
-
long inputTokensThe aggregated number of input tokens used.
-
long numModelRequestsThe count of requests made to the model.
-
JsonValue; object_ "organization.usage.moderations.result"constantORGANIZATION_USAGE_MODERATIONS_RESULT("organization.usage.moderations.result")
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Optional<String> modelWhen
group_by=model, this field provides the model name of the grouped usage result. -
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Optional<String> userIdWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageImagesResult:The aggregated images usage details of the specific time bucket.
-
long imagesThe number of images processed.
-
long numModelRequestsThe count of requests made to the model.
-
JsonValue; object_ "organization.usage.images.result"constantORGANIZATION_USAGE_IMAGES_RESULT("organization.usage.images.result")
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Optional<String> modelWhen
group_by=model, this field provides the model name of the grouped usage result. -
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Optional<String> sizeWhen
group_by=size, this field provides the image size of the grouped usage result. -
Optional<String> sourceWhen
group_by=source, this field provides the source of the grouped usage result, possible values areimage.generation,image.edit,image.variation. -
Optional<String> userIdWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageAudioSpeechesResult:The aggregated audio speeches usage details of the specific time bucket.
-
long charactersThe number of characters processed.
-
long numModelRequestsThe count of requests made to the model.
-
JsonValue; object_ "organization.usage.audio_speeches.result"constantORGANIZATION_USAGE_AUDIO_SPEECHES_RESULT("organization.usage.audio_speeches.result")
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Optional<String> modelWhen
group_by=model, this field provides the model name of the grouped usage result. -
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Optional<String> userIdWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageAudioTranscriptionsResult:The aggregated audio transcriptions usage details of the specific time bucket.
-
long numModelRequestsThe count of requests made to the model.
-
JsonValue; object_ "organization.usage.audio_transcriptions.result"constantORGANIZATION_USAGE_AUDIO_TRANSCRIPTIONS_RESULT("organization.usage.audio_transcriptions.result")
-
long secondsThe number of seconds processed.
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Optional<String> modelWhen
group_by=model, this field provides the model name of the grouped usage result. -
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Optional<String> userIdWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageVectorStoresResult:The aggregated vector stores usage details of the specific time bucket.
-
JsonValue; object_ "organization.usage.vector_stores.result"constantORGANIZATION_USAGE_VECTOR_STORES_RESULT("organization.usage.vector_stores.result")
-
long usageBytesThe vector stores usage in bytes.
-
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
class OrganizationUsageCodeInterpreterSessionsResult:The aggregated code interpreter sessions usage details of the specific time bucket.
-
long numSessionsThe number of code interpreter sessions.
-
JsonValue; object_ "organization.usage.code_interpreter_sessions.result"constantORGANIZATION_USAGE_CODE_INTERPRETER_SESSIONS_RESULT("organization.usage.code_interpreter_sessions.result")
-
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
class OrganizationUsageFileSearchesResult:The aggregated file search calls usage details of the specific time bucket.
-
long numRequestsThe count of file search calls.
-
JsonValue; object_ "organization.usage.file_searches.result"constantORGANIZATION_USAGE_FILE_SEARCHES_RESULT("organization.usage.file_searches.result")
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Optional<String> userIdWhen
group_by=user_id, this field provides the user ID of the grouped usage result. -
Optional<String> vectorStoreIdWhen
group_by=vector_store_id, this field provides the vector store ID of the grouped usage result.
-
-
class OrganizationUsageWebSearchesResult:The aggregated web search calls usage details of the specific time bucket.
-
long numModelRequestsThe count of model requests.
-
long numRequestsThe count of web search calls.
-
JsonValue; object_ "organization.usage.web_searches.result"constantORGANIZATION_USAGE_WEB_SEARCHES_RESULT("organization.usage.web_searches.result")
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Optional<String> contextLevelWhen
group_by=context_level, this field provides the search context size of the grouped usage result. -
Optional<String> modelWhen
group_by=model, this field provides the model name of the grouped usage result. -
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Optional<String> userIdWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationCostsResult:The aggregated costs details of the specific time bucket.
-
JsonValue; object_ "organization.costs.result"constantORGANIZATION_COSTS_RESULT("organization.costs.result")
-
Optional<Amount> amountThe monetary value in its associated currency.
-
Optional<String> currencyLowercase ISO-4217 currency e.g. "usd"
-
Optional<Double> valueThe numeric value of the cost.
-
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API Key ID of the grouped costs result. -
Optional<String> lineItemWhen
group_by=line_item, this field provides the line item of the grouped costs result. -
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped costs result. -
Optional<Double> quantityWhen
group_by=line_item, this field provides the quantity of the grouped costs result.
-
-
-
long startTime
-
-
boolean hasMore -
Optional<String> nextPage -
JsonValue; object_ "page"constantPAGE("page")
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.usage.UsageVectorStoresParams;
import com.openai.models.admin.organization.usage.UsageVectorStoresResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
UsageVectorStoresParams params = UsageVectorStoresParams.builder()
.startTime(0L)
.build();
UsageVectorStoresResponse response = client.admin().organization().usage().vectorStores(params);
}
}
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
UsageFileSearchCallsResponse admin().organization().usage().fileSearchCalls(UsageFileSearchCallsParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
get /organization/usage/file_search_calls
Get file search calls usage details for the organization.
Parameters
-
UsageFileSearchCallsParams params-
long startTimeStart time (Unix seconds) of the query time range, inclusive.
-
Optional<List<String>> apiKeyIdsReturn only usage for these API keys.
-
Optional<BucketWidth> bucketWidthWidth of each time bucket in response. Currently
1m,1hand1dare supported, default to1d.-
_1M("1m") -
_1H("1h") -
_1D("1d")
-
-
Optional<Long> endTimeEnd time (Unix seconds) of the query time range, exclusive.
-
Optional<List<GroupBy>> groupByGroup 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("project_id") -
USER_ID("user_id") -
API_KEY_ID("api_key_id") -
VECTOR_STORE_ID("vector_store_id")
-
-
Optional<Long> limitSpecifies 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
-
Optional<String> pageA cursor for use in pagination. Corresponding to the
next_pagefield from the previous response. -
Optional<List<String>> projectIdsReturn only usage for these projects.
-
Optional<List<String>> userIdsReturn only usage for these users.
-
Optional<List<String>> vectorStoreIdsReturn only usage for these vector stores.
-
Returns
-
class UsageFileSearchCallsResponse:-
List<Data> data-
long endTime -
JsonValue; object_ "bucket"constantBUCKET("bucket")
-
List<Result> results-
class OrganizationUsageCompletionsResult:The aggregated completions usage details of the specific time bucket.
-
long inputTokensThe aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens.
-
long numModelRequestsThe count of requests made to the model.
-
JsonValue; object_ "organization.usage.completions.result"constantORGANIZATION_USAGE_COMPLETIONS_RESULT("organization.usage.completions.result")
-
long outputTokensThe aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens.
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Optional<Boolean> batchWhen
group_by=batch, this field tells whether the grouped usage result is batch or not. -
Optional<Long> inputAudioTokensThe aggregated number of audio input tokens used, including cached tokens.
-
Optional<Long> inputCachedTokensThe aggregated number of text input tokens that has been cached from previous requests. For customers subscribe to scale tier, this includes scale tier tokens.
-
Optional<String> modelWhen
group_by=model, this field provides the model name of the grouped usage result. -
Optional<Long> outputAudioTokensThe aggregated number of audio output tokens used.
-
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Optional<String> serviceTierWhen
group_by=service_tier, this field provides the service tier of the grouped usage result. -
Optional<String> userIdWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageEmbeddingsResult:The aggregated embeddings usage details of the specific time bucket.
-
long inputTokensThe aggregated number of input tokens used.
-
long numModelRequestsThe count of requests made to the model.
-
JsonValue; object_ "organization.usage.embeddings.result"constantORGANIZATION_USAGE_EMBEDDINGS_RESULT("organization.usage.embeddings.result")
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Optional<String> modelWhen
group_by=model, this field provides the model name of the grouped usage result. -
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Optional<String> userIdWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageModerationsResult:The aggregated moderations usage details of the specific time bucket.
-
long inputTokensThe aggregated number of input tokens used.
-
long numModelRequestsThe count of requests made to the model.
-
JsonValue; object_ "organization.usage.moderations.result"constantORGANIZATION_USAGE_MODERATIONS_RESULT("organization.usage.moderations.result")
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Optional<String> modelWhen
group_by=model, this field provides the model name of the grouped usage result. -
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Optional<String> userIdWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageImagesResult:The aggregated images usage details of the specific time bucket.
-
long imagesThe number of images processed.
-
long numModelRequestsThe count of requests made to the model.
-
JsonValue; object_ "organization.usage.images.result"constantORGANIZATION_USAGE_IMAGES_RESULT("organization.usage.images.result")
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Optional<String> modelWhen
group_by=model, this field provides the model name of the grouped usage result. -
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Optional<String> sizeWhen
group_by=size, this field provides the image size of the grouped usage result. -
Optional<String> sourceWhen
group_by=source, this field provides the source of the grouped usage result, possible values areimage.generation,image.edit,image.variation. -
Optional<String> userIdWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageAudioSpeechesResult:The aggregated audio speeches usage details of the specific time bucket.
-
long charactersThe number of characters processed.
-
long numModelRequestsThe count of requests made to the model.
-
JsonValue; object_ "organization.usage.audio_speeches.result"constantORGANIZATION_USAGE_AUDIO_SPEECHES_RESULT("organization.usage.audio_speeches.result")
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Optional<String> modelWhen
group_by=model, this field provides the model name of the grouped usage result. -
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Optional<String> userIdWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageAudioTranscriptionsResult:The aggregated audio transcriptions usage details of the specific time bucket.
-
long numModelRequestsThe count of requests made to the model.
-
JsonValue; object_ "organization.usage.audio_transcriptions.result"constantORGANIZATION_USAGE_AUDIO_TRANSCRIPTIONS_RESULT("organization.usage.audio_transcriptions.result")
-
long secondsThe number of seconds processed.
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Optional<String> modelWhen
group_by=model, this field provides the model name of the grouped usage result. -
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Optional<String> userIdWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageVectorStoresResult:The aggregated vector stores usage details of the specific time bucket.
-
JsonValue; object_ "organization.usage.vector_stores.result"constantORGANIZATION_USAGE_VECTOR_STORES_RESULT("organization.usage.vector_stores.result")
-
long usageBytesThe vector stores usage in bytes.
-
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
class OrganizationUsageCodeInterpreterSessionsResult:The aggregated code interpreter sessions usage details of the specific time bucket.
-
long numSessionsThe number of code interpreter sessions.
-
JsonValue; object_ "organization.usage.code_interpreter_sessions.result"constantORGANIZATION_USAGE_CODE_INTERPRETER_SESSIONS_RESULT("organization.usage.code_interpreter_sessions.result")
-
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
class OrganizationUsageFileSearchesResult:The aggregated file search calls usage details of the specific time bucket.
-
long numRequestsThe count of file search calls.
-
JsonValue; object_ "organization.usage.file_searches.result"constantORGANIZATION_USAGE_FILE_SEARCHES_RESULT("organization.usage.file_searches.result")
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Optional<String> userIdWhen
group_by=user_id, this field provides the user ID of the grouped usage result. -
Optional<String> vectorStoreIdWhen
group_by=vector_store_id, this field provides the vector store ID of the grouped usage result.
-
-
class OrganizationUsageWebSearchesResult:The aggregated web search calls usage details of the specific time bucket.
-
long numModelRequestsThe count of model requests.
-
long numRequestsThe count of web search calls.
-
JsonValue; object_ "organization.usage.web_searches.result"constantORGANIZATION_USAGE_WEB_SEARCHES_RESULT("organization.usage.web_searches.result")
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Optional<String> contextLevelWhen
group_by=context_level, this field provides the search context size of the grouped usage result. -
Optional<String> modelWhen
group_by=model, this field provides the model name of the grouped usage result. -
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Optional<String> userIdWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationCostsResult:The aggregated costs details of the specific time bucket.
-
JsonValue; object_ "organization.costs.result"constantORGANIZATION_COSTS_RESULT("organization.costs.result")
-
Optional<Amount> amountThe monetary value in its associated currency.
-
Optional<String> currencyLowercase ISO-4217 currency e.g. "usd"
-
Optional<Double> valueThe numeric value of the cost.
-
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API Key ID of the grouped costs result. -
Optional<String> lineItemWhen
group_by=line_item, this field provides the line item of the grouped costs result. -
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped costs result. -
Optional<Double> quantityWhen
group_by=line_item, this field provides the quantity of the grouped costs result.
-
-
-
long startTime
-
-
boolean hasMore -
Optional<String> nextPage -
JsonValue; object_ "page"constantPAGE("page")
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.usage.UsageFileSearchCallsParams;
import com.openai.models.admin.organization.usage.UsageFileSearchCallsResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
UsageFileSearchCallsParams params = UsageFileSearchCallsParams.builder()
.startTime(0L)
.build();
UsageFileSearchCallsResponse response = client.admin().organization().usage().fileSearchCalls(params);
}
}
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
UsageWebSearchCallsResponse admin().organization().usage().webSearchCalls(UsageWebSearchCallsParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
get /organization/usage/web_search_calls
Get web search calls usage details for the organization.
Parameters
-
UsageWebSearchCallsParams params-
long startTimeStart time (Unix seconds) of the query time range, inclusive.
-
Optional<List<String>> apiKeyIdsReturn only usage for these API keys.
-
Optional<BucketWidth> bucketWidthWidth of each time bucket in response. Currently
1m,1hand1dare supported, default to1d.-
_1M("1m") -
_1H("1h") -
_1D("1d")
-
-
Optional<List<ContextLevel>> contextLevelsReturn only web search usage for these context levels.
-
LOW("low") -
MEDIUM("medium") -
HIGH("high")
-
-
Optional<Long> endTimeEnd time (Unix seconds) of the query time range, exclusive.
-
Optional<List<GroupBy>> groupByGroup 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("project_id") -
USER_ID("user_id") -
API_KEY_ID("api_key_id") -
MODEL("model") -
CONTEXT_LEVEL("context_level")
-
-
Optional<Long> limitSpecifies 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
-
Optional<List<String>> modelsReturn only usage for these models.
-
Optional<String> pageA cursor for use in pagination. Corresponding to the
next_pagefield from the previous response. -
Optional<List<String>> projectIdsReturn only usage for these projects.
-
Optional<List<String>> userIdsReturn only usage for these users.
-
Returns
-
class UsageWebSearchCallsResponse:-
List<Data> data-
long endTime -
JsonValue; object_ "bucket"constantBUCKET("bucket")
-
List<Result> results-
class OrganizationUsageCompletionsResult:The aggregated completions usage details of the specific time bucket.
-
long inputTokensThe aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens.
-
long numModelRequestsThe count of requests made to the model.
-
JsonValue; object_ "organization.usage.completions.result"constantORGANIZATION_USAGE_COMPLETIONS_RESULT("organization.usage.completions.result")
-
long outputTokensThe aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens.
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Optional<Boolean> batchWhen
group_by=batch, this field tells whether the grouped usage result is batch or not. -
Optional<Long> inputAudioTokensThe aggregated number of audio input tokens used, including cached tokens.
-
Optional<Long> inputCachedTokensThe aggregated number of text input tokens that has been cached from previous requests. For customers subscribe to scale tier, this includes scale tier tokens.
-
Optional<String> modelWhen
group_by=model, this field provides the model name of the grouped usage result. -
Optional<Long> outputAudioTokensThe aggregated number of audio output tokens used.
-
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Optional<String> serviceTierWhen
group_by=service_tier, this field provides the service tier of the grouped usage result. -
Optional<String> userIdWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageEmbeddingsResult:The aggregated embeddings usage details of the specific time bucket.
-
long inputTokensThe aggregated number of input tokens used.
-
long numModelRequestsThe count of requests made to the model.
-
JsonValue; object_ "organization.usage.embeddings.result"constantORGANIZATION_USAGE_EMBEDDINGS_RESULT("organization.usage.embeddings.result")
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Optional<String> modelWhen
group_by=model, this field provides the model name of the grouped usage result. -
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Optional<String> userIdWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageModerationsResult:The aggregated moderations usage details of the specific time bucket.
-
long inputTokensThe aggregated number of input tokens used.
-
long numModelRequestsThe count of requests made to the model.
-
JsonValue; object_ "organization.usage.moderations.result"constantORGANIZATION_USAGE_MODERATIONS_RESULT("organization.usage.moderations.result")
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Optional<String> modelWhen
group_by=model, this field provides the model name of the grouped usage result. -
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Optional<String> userIdWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageImagesResult:The aggregated images usage details of the specific time bucket.
-
long imagesThe number of images processed.
-
long numModelRequestsThe count of requests made to the model.
-
JsonValue; object_ "organization.usage.images.result"constantORGANIZATION_USAGE_IMAGES_RESULT("organization.usage.images.result")
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Optional<String> modelWhen
group_by=model, this field provides the model name of the grouped usage result. -
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Optional<String> sizeWhen
group_by=size, this field provides the image size of the grouped usage result. -
Optional<String> sourceWhen
group_by=source, this field provides the source of the grouped usage result, possible values areimage.generation,image.edit,image.variation. -
Optional<String> userIdWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageAudioSpeechesResult:The aggregated audio speeches usage details of the specific time bucket.
-
long charactersThe number of characters processed.
-
long numModelRequestsThe count of requests made to the model.
-
JsonValue; object_ "organization.usage.audio_speeches.result"constantORGANIZATION_USAGE_AUDIO_SPEECHES_RESULT("organization.usage.audio_speeches.result")
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Optional<String> modelWhen
group_by=model, this field provides the model name of the grouped usage result. -
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Optional<String> userIdWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageAudioTranscriptionsResult:The aggregated audio transcriptions usage details of the specific time bucket.
-
long numModelRequestsThe count of requests made to the model.
-
JsonValue; object_ "organization.usage.audio_transcriptions.result"constantORGANIZATION_USAGE_AUDIO_TRANSCRIPTIONS_RESULT("organization.usage.audio_transcriptions.result")
-
long secondsThe number of seconds processed.
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Optional<String> modelWhen
group_by=model, this field provides the model name of the grouped usage result. -
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Optional<String> userIdWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageVectorStoresResult:The aggregated vector stores usage details of the specific time bucket.
-
JsonValue; object_ "organization.usage.vector_stores.result"constantORGANIZATION_USAGE_VECTOR_STORES_RESULT("organization.usage.vector_stores.result")
-
long usageBytesThe vector stores usage in bytes.
-
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
class OrganizationUsageCodeInterpreterSessionsResult:The aggregated code interpreter sessions usage details of the specific time bucket.
-
long numSessionsThe number of code interpreter sessions.
-
JsonValue; object_ "organization.usage.code_interpreter_sessions.result"constantORGANIZATION_USAGE_CODE_INTERPRETER_SESSIONS_RESULT("organization.usage.code_interpreter_sessions.result")
-
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
class OrganizationUsageFileSearchesResult:The aggregated file search calls usage details of the specific time bucket.
-
long numRequestsThe count of file search calls.
-
JsonValue; object_ "organization.usage.file_searches.result"constantORGANIZATION_USAGE_FILE_SEARCHES_RESULT("organization.usage.file_searches.result")
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Optional<String> userIdWhen
group_by=user_id, this field provides the user ID of the grouped usage result. -
Optional<String> vectorStoreIdWhen
group_by=vector_store_id, this field provides the vector store ID of the grouped usage result.
-
-
class OrganizationUsageWebSearchesResult:The aggregated web search calls usage details of the specific time bucket.
-
long numModelRequestsThe count of model requests.
-
long numRequestsThe count of web search calls.
-
JsonValue; object_ "organization.usage.web_searches.result"constantORGANIZATION_USAGE_WEB_SEARCHES_RESULT("organization.usage.web_searches.result")
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Optional<String> contextLevelWhen
group_by=context_level, this field provides the search context size of the grouped usage result. -
Optional<String> modelWhen
group_by=model, this field provides the model name of the grouped usage result. -
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Optional<String> userIdWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationCostsResult:The aggregated costs details of the specific time bucket.
-
JsonValue; object_ "organization.costs.result"constantORGANIZATION_COSTS_RESULT("organization.costs.result")
-
Optional<Amount> amountThe monetary value in its associated currency.
-
Optional<String> currencyLowercase ISO-4217 currency e.g. "usd"
-
Optional<Double> valueThe numeric value of the cost.
-
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API Key ID of the grouped costs result. -
Optional<String> lineItemWhen
group_by=line_item, this field provides the line item of the grouped costs result. -
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped costs result. -
Optional<Double> quantityWhen
group_by=line_item, this field provides the quantity of the grouped costs result.
-
-
-
long startTime
-
-
boolean hasMore -
Optional<String> nextPage -
JsonValue; object_ "page"constantPAGE("page")
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.usage.UsageWebSearchCallsParams;
import com.openai.models.admin.organization.usage.UsageWebSearchCallsResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
UsageWebSearchCallsParams params = UsageWebSearchCallsParams.builder()
.startTime(0L)
.build();
UsageWebSearchCallsResponse response = client.admin().organization().usage().webSearchCalls(params);
}
}
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
UsageCostsResponse admin().organization().usage().costs(UsageCostsParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
get /organization/costs
Get costs details for the organization.
Parameters
-
UsageCostsParams params-
long startTimeStart time (Unix seconds) of the query time range, inclusive.
-
Optional<List<String>> apiKeyIdsReturn only costs for these API keys.
-
Optional<BucketWidth> bucketWidthWidth of each time bucket in response. Currently only
1dis supported, default to1d._1D("1d")
-
Optional<Long> endTimeEnd time (Unix seconds) of the query time range, exclusive.
-
Optional<List<GroupBy>> groupByGroup the costs by the specified fields. Support fields include
project_id,line_item,api_key_idand any combination of them.-
PROJECT_ID("project_id") -
LINE_ITEM("line_item") -
API_KEY_ID("api_key_id")
-
-
Optional<Long> limitA limit on the number of buckets to be returned. Limit can range between 1 and 180, and the default is 7.
-
Optional<String> pageA cursor for use in pagination. Corresponding to the
next_pagefield from the previous response. -
Optional<List<String>> projectIdsReturn only costs for these projects.
-
Returns
-
class UsageCostsResponse:-
List<Data> data-
long endTime -
JsonValue; object_ "bucket"constantBUCKET("bucket")
-
List<Result> results-
class OrganizationUsageCompletionsResult:The aggregated completions usage details of the specific time bucket.
-
long inputTokensThe aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens.
-
long numModelRequestsThe count of requests made to the model.
-
JsonValue; object_ "organization.usage.completions.result"constantORGANIZATION_USAGE_COMPLETIONS_RESULT("organization.usage.completions.result")
-
long outputTokensThe aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens.
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Optional<Boolean> batchWhen
group_by=batch, this field tells whether the grouped usage result is batch or not. -
Optional<Long> inputAudioTokensThe aggregated number of audio input tokens used, including cached tokens.
-
Optional<Long> inputCachedTokensThe aggregated number of text input tokens that has been cached from previous requests. For customers subscribe to scale tier, this includes scale tier tokens.
-
Optional<String> modelWhen
group_by=model, this field provides the model name of the grouped usage result. -
Optional<Long> outputAudioTokensThe aggregated number of audio output tokens used.
-
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Optional<String> serviceTierWhen
group_by=service_tier, this field provides the service tier of the grouped usage result. -
Optional<String> userIdWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageEmbeddingsResult:The aggregated embeddings usage details of the specific time bucket.
-
long inputTokensThe aggregated number of input tokens used.
-
long numModelRequestsThe count of requests made to the model.
-
JsonValue; object_ "organization.usage.embeddings.result"constantORGANIZATION_USAGE_EMBEDDINGS_RESULT("organization.usage.embeddings.result")
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Optional<String> modelWhen
group_by=model, this field provides the model name of the grouped usage result. -
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Optional<String> userIdWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageModerationsResult:The aggregated moderations usage details of the specific time bucket.
-
long inputTokensThe aggregated number of input tokens used.
-
long numModelRequestsThe count of requests made to the model.
-
JsonValue; object_ "organization.usage.moderations.result"constantORGANIZATION_USAGE_MODERATIONS_RESULT("organization.usage.moderations.result")
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Optional<String> modelWhen
group_by=model, this field provides the model name of the grouped usage result. -
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Optional<String> userIdWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageImagesResult:The aggregated images usage details of the specific time bucket.
-
long imagesThe number of images processed.
-
long numModelRequestsThe count of requests made to the model.
-
JsonValue; object_ "organization.usage.images.result"constantORGANIZATION_USAGE_IMAGES_RESULT("organization.usage.images.result")
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Optional<String> modelWhen
group_by=model, this field provides the model name of the grouped usage result. -
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Optional<String> sizeWhen
group_by=size, this field provides the image size of the grouped usage result. -
Optional<String> sourceWhen
group_by=source, this field provides the source of the grouped usage result, possible values areimage.generation,image.edit,image.variation. -
Optional<String> userIdWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageAudioSpeechesResult:The aggregated audio speeches usage details of the specific time bucket.
-
long charactersThe number of characters processed.
-
long numModelRequestsThe count of requests made to the model.
-
JsonValue; object_ "organization.usage.audio_speeches.result"constantORGANIZATION_USAGE_AUDIO_SPEECHES_RESULT("organization.usage.audio_speeches.result")
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Optional<String> modelWhen
group_by=model, this field provides the model name of the grouped usage result. -
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Optional<String> userIdWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageAudioTranscriptionsResult:The aggregated audio transcriptions usage details of the specific time bucket.
-
long numModelRequestsThe count of requests made to the model.
-
JsonValue; object_ "organization.usage.audio_transcriptions.result"constantORGANIZATION_USAGE_AUDIO_TRANSCRIPTIONS_RESULT("organization.usage.audio_transcriptions.result")
-
long secondsThe number of seconds processed.
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Optional<String> modelWhen
group_by=model, this field provides the model name of the grouped usage result. -
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Optional<String> userIdWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationUsageVectorStoresResult:The aggregated vector stores usage details of the specific time bucket.
-
JsonValue; object_ "organization.usage.vector_stores.result"constantORGANIZATION_USAGE_VECTOR_STORES_RESULT("organization.usage.vector_stores.result")
-
long usageBytesThe vector stores usage in bytes.
-
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
class OrganizationUsageCodeInterpreterSessionsResult:The aggregated code interpreter sessions usage details of the specific time bucket.
-
long numSessionsThe number of code interpreter sessions.
-
JsonValue; object_ "organization.usage.code_interpreter_sessions.result"constantORGANIZATION_USAGE_CODE_INTERPRETER_SESSIONS_RESULT("organization.usage.code_interpreter_sessions.result")
-
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
class OrganizationUsageFileSearchesResult:The aggregated file search calls usage details of the specific time bucket.
-
long numRequestsThe count of file search calls.
-
JsonValue; object_ "organization.usage.file_searches.result"constantORGANIZATION_USAGE_FILE_SEARCHES_RESULT("organization.usage.file_searches.result")
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Optional<String> userIdWhen
group_by=user_id, this field provides the user ID of the grouped usage result. -
Optional<String> vectorStoreIdWhen
group_by=vector_store_id, this field provides the vector store ID of the grouped usage result.
-
-
class OrganizationUsageWebSearchesResult:The aggregated web search calls usage details of the specific time bucket.
-
long numModelRequestsThe count of model requests.
-
long numRequestsThe count of web search calls.
-
JsonValue; object_ "organization.usage.web_searches.result"constantORGANIZATION_USAGE_WEB_SEARCHES_RESULT("organization.usage.web_searches.result")
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Optional<String> contextLevelWhen
group_by=context_level, this field provides the search context size of the grouped usage result. -
Optional<String> modelWhen
group_by=model, this field provides the model name of the grouped usage result. -
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Optional<String> userIdWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
class OrganizationCostsResult:The aggregated costs details of the specific time bucket.
-
JsonValue; object_ "organization.costs.result"constantORGANIZATION_COSTS_RESULT("organization.costs.result")
-
Optional<Amount> amountThe monetary value in its associated currency.
-
Optional<String> currencyLowercase ISO-4217 currency e.g. "usd"
-
Optional<Double> valueThe numeric value of the cost.
-
-
Optional<String> apiKeyIdWhen
group_by=api_key_id, this field provides the API Key ID of the grouped costs result. -
Optional<String> lineItemWhen
group_by=line_item, this field provides the line item of the grouped costs result. -
Optional<String> projectIdWhen
group_by=project_id, this field provides the project ID of the grouped costs result. -
Optional<Double> quantityWhen
group_by=line_item, this field provides the quantity of the grouped costs result.
-
-
-
long startTime
-
-
boolean hasMore -
Optional<String> nextPage -
JsonValue; object_ "page"constantPAGE("page")
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.usage.UsageCostsParams;
import com.openai.models.admin.organization.usage.UsageCostsResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
UsageCostsParams params = UsageCostsParams.builder()
.startTime(0L)
.build();
UsageCostsResponse response = client.admin().organization().usage().costs(params);
}
}
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"
}
Invites
List invites
InviteListPage admin().organization().invites().list(InviteListParamsparams = InviteListParams.none(), RequestOptionsrequestOptions = RequestOptions.none())
get /organization/invites
Returns a list of invites in the organization.
Parameters
-
InviteListParams params-
Optional<String> afterA 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. -
Optional<Long> limitA limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
-
Returns
-
class Invite:Represents an individual
inviteto the organization.-
String idThe identifier, which can be referenced in API endpoints
-
long createdAtThe Unix timestamp (in seconds) of when the invite was sent.
-
String emailThe email address of the individual to whom the invite was sent
-
JsonValue; object_ "organization.invite"constantThe object type, which is always
organization.inviteORGANIZATION_INVITE("organization.invite")
-
List<Project> projectsThe projects that were granted membership upon acceptance of the invite.
-
String idProject's public ID
-
Role roleProject membership role
-
MEMBER("member") -
OWNER("owner")
-
-
-
Role roleownerorreader-
OWNER("owner") -
READER("reader")
-
-
Status statusaccepted,expired, orpending-
ACCEPTED("accepted") -
EXPIRED("expired") -
PENDING("pending")
-
-
Optional<Long> acceptedAtThe Unix timestamp (in seconds) of when the invite was accepted.
-
Optional<Long> expiresAtThe Unix timestamp (in seconds) of when the invite expires.
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.invites.InviteListPage;
import com.openai.models.admin.organization.invites.InviteListParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
InviteListPage page = client.admin().organization().invites().list();
}
}
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
Invite admin().organization().invites().create(InviteCreateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
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
-
InviteCreateParams params-
String emailSend an email to this address
-
Role roleownerorreader-
READER("reader") -
OWNER("owner")
-
-
Optional<List<Project>> projectsAn 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.
-
String idProject's public ID
-
Role roleProject membership role
-
MEMBER("member") -
OWNER("owner")
-
-
-
Returns
-
class Invite:Represents an individual
inviteto the organization.-
String idThe identifier, which can be referenced in API endpoints
-
long createdAtThe Unix timestamp (in seconds) of when the invite was sent.
-
String emailThe email address of the individual to whom the invite was sent
-
JsonValue; object_ "organization.invite"constantThe object type, which is always
organization.inviteORGANIZATION_INVITE("organization.invite")
-
List<Project> projectsThe projects that were granted membership upon acceptance of the invite.
-
String idProject's public ID
-
Role roleProject membership role
-
MEMBER("member") -
OWNER("owner")
-
-
-
Role roleownerorreader-
OWNER("owner") -
READER("reader")
-
-
Status statusaccepted,expired, orpending-
ACCEPTED("accepted") -
EXPIRED("expired") -
PENDING("pending")
-
-
Optional<Long> acceptedAtThe Unix timestamp (in seconds) of when the invite was accepted.
-
Optional<Long> expiresAtThe Unix timestamp (in seconds) of when the invite expires.
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.invites.Invite;
import com.openai.models.admin.organization.invites.InviteCreateParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
InviteCreateParams params = InviteCreateParams.builder()
.email("email")
.role(InviteCreateParams.Role.READER)
.build();
Invite invite = client.admin().organization().invites().create(params);
}
}
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
Invite admin().organization().invites().retrieve(InviteRetrieveParamsparams = InviteRetrieveParams.none(), RequestOptionsrequestOptions = RequestOptions.none())
get /organization/invites/{invite_id}
Retrieves an invite.
Parameters
-
InviteRetrieveParams paramsOptional<String> inviteId
Returns
-
class Invite:Represents an individual
inviteto the organization.-
String idThe identifier, which can be referenced in API endpoints
-
long createdAtThe Unix timestamp (in seconds) of when the invite was sent.
-
String emailThe email address of the individual to whom the invite was sent
-
JsonValue; object_ "organization.invite"constantThe object type, which is always
organization.inviteORGANIZATION_INVITE("organization.invite")
-
List<Project> projectsThe projects that were granted membership upon acceptance of the invite.
-
String idProject's public ID
-
Role roleProject membership role
-
MEMBER("member") -
OWNER("owner")
-
-
-
Role roleownerorreader-
OWNER("owner") -
READER("reader")
-
-
Status statusaccepted,expired, orpending-
ACCEPTED("accepted") -
EXPIRED("expired") -
PENDING("pending")
-
-
Optional<Long> acceptedAtThe Unix timestamp (in seconds) of when the invite was accepted.
-
Optional<Long> expiresAtThe Unix timestamp (in seconds) of when the invite expires.
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.invites.Invite;
import com.openai.models.admin.organization.invites.InviteRetrieveParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
Invite invite = client.admin().organization().invites().retrieve("invite_id");
}
}
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
InviteDeleteResponse admin().organization().invites().delete(InviteDeleteParamsparams = InviteDeleteParams.none(), RequestOptionsrequestOptions = RequestOptions.none())
delete /organization/invites/{invite_id}
Delete an invite. If the invite has already been accepted, it cannot be deleted.
Parameters
-
InviteDeleteParams paramsOptional<String> inviteId
Returns
-
class InviteDeleteResponse:-
String id -
boolean deleted -
JsonValue; object_ "organization.invite.deleted"constantThe object type, which is always
organization.invite.deletedORGANIZATION_INVITE_DELETED("organization.invite.deleted")
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.invites.InviteDeleteParams;
import com.openai.models.admin.organization.invites.InviteDeleteResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
InviteDeleteResponse invite = client.admin().organization().invites().delete("invite_id");
}
}
Response
{
"id": "id",
"deleted": true,
"object": "organization.invite.deleted"
}
Domain Types
Invite
-
class Invite:Represents an individual
inviteto the organization.-
String idThe identifier, which can be referenced in API endpoints
-
long createdAtThe Unix timestamp (in seconds) of when the invite was sent.
-
String emailThe email address of the individual to whom the invite was sent
-
JsonValue; object_ "organization.invite"constantThe object type, which is always
organization.inviteORGANIZATION_INVITE("organization.invite")
-
List<Project> projectsThe projects that were granted membership upon acceptance of the invite.
-
String idProject's public ID
-
Role roleProject membership role
-
MEMBER("member") -
OWNER("owner")
-
-
-
Role roleownerorreader-
OWNER("owner") -
READER("reader")
-
-
Status statusaccepted,expired, orpending-
ACCEPTED("accepted") -
EXPIRED("expired") -
PENDING("pending")
-
-
Optional<Long> acceptedAtThe Unix timestamp (in seconds) of when the invite was accepted.
-
Optional<Long> expiresAtThe Unix timestamp (in seconds) of when the invite expires.
-
Users
List users
UserListPage admin().organization().users().list(UserListParamsparams = UserListParams.none(), RequestOptionsrequestOptions = RequestOptions.none())
get /organization/users
Lists all of the users in the organization.
Parameters
-
UserListParams params-
Optional<String> afterA 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. -
Optional<List<String>> emailsFilter by the email address of users.
-
Optional<Long> limitA limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
-
Returns
-
class OrganizationUser:Represents an individual
userwithin an organization.-
String idThe identifier, which can be referenced in API endpoints
-
long addedAtThe Unix timestamp (in seconds) of when the user was added.
-
JsonValue; object_ "organization.user"constantThe object type, which is always
organization.userORGANIZATION_USER("organization.user")
-
Optional<Long> apiKeyLastUsedAtThe Unix timestamp (in seconds) of the user's last API key usage.
-
Optional<Long> createdThe Unix timestamp (in seconds) of when the user was created.
-
Optional<String> developerPersonaThe developer persona metadata for the user.
-
Optional<String> emailThe email address of the user
-
Optional<Boolean> isDefaultWhether this is the organization's default user.
-
Optional<Boolean> isScaleTierAuthorizedPurchaserWhether the user is an authorized purchaser for Scale Tier.
-
Optional<Boolean> isScimManagedWhether the user is managed through SCIM.
-
Optional<Boolean> isServiceAccountWhether the user is a service account.
-
Optional<String> nameThe name of the user
-
Optional<Projects> projectsProjects associated with the user, if included.
-
List<Data> data-
Optional<String> id -
Optional<String> name -
Optional<String> role
-
-
JsonValue; object_ "list"constantLIST("list")
-
-
Optional<String> roleownerorreader -
Optional<String> technicalLevelThe technical level metadata for the user.
-
Optional<User> userNested user details.
-
String id -
JsonValue; object_ "user"constantUSER("user")
-
Optional<Boolean> banned -
Optional<Long> bannedAt -
Optional<String> email -
Optional<Boolean> enabled -
Optional<String> name -
Optional<String> picture
-
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.users.UserListPage;
import com.openai.models.admin.organization.users.UserListParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
UserListPage page = client.admin().organization().users().list();
}
}
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
OrganizationUser admin().organization().users().retrieve(UserRetrieveParamsparams = UserRetrieveParams.none(), RequestOptionsrequestOptions = RequestOptions.none())
get /organization/users/{user_id}
Retrieves a user by their identifier.
Parameters
-
UserRetrieveParams paramsOptional<String> userId
Returns
-
class OrganizationUser:Represents an individual
userwithin an organization.-
String idThe identifier, which can be referenced in API endpoints
-
long addedAtThe Unix timestamp (in seconds) of when the user was added.
-
JsonValue; object_ "organization.user"constantThe object type, which is always
organization.userORGANIZATION_USER("organization.user")
-
Optional<Long> apiKeyLastUsedAtThe Unix timestamp (in seconds) of the user's last API key usage.
-
Optional<Long> createdThe Unix timestamp (in seconds) of when the user was created.
-
Optional<String> developerPersonaThe developer persona metadata for the user.
-
Optional<String> emailThe email address of the user
-
Optional<Boolean> isDefaultWhether this is the organization's default user.
-
Optional<Boolean> isScaleTierAuthorizedPurchaserWhether the user is an authorized purchaser for Scale Tier.
-
Optional<Boolean> isScimManagedWhether the user is managed through SCIM.
-
Optional<Boolean> isServiceAccountWhether the user is a service account.
-
Optional<String> nameThe name of the user
-
Optional<Projects> projectsProjects associated with the user, if included.
-
List<Data> data-
Optional<String> id -
Optional<String> name -
Optional<String> role
-
-
JsonValue; object_ "list"constantLIST("list")
-
-
Optional<String> roleownerorreader -
Optional<String> technicalLevelThe technical level metadata for the user.
-
Optional<User> userNested user details.
-
String id -
JsonValue; object_ "user"constantUSER("user")
-
Optional<Boolean> banned -
Optional<Long> bannedAt -
Optional<String> email -
Optional<Boolean> enabled -
Optional<String> name -
Optional<String> picture
-
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.users.OrganizationUser;
import com.openai.models.admin.organization.users.UserRetrieveParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
OrganizationUser organizationUser = client.admin().organization().users().retrieve("user_id");
}
}
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
OrganizationUser admin().organization().users().update(UserUpdateParamsparams = UserUpdateParams.none(), RequestOptionsrequestOptions = RequestOptions.none())
post /organization/users/{user_id}
Modifies a user's role in the organization.
Parameters
-
UserUpdateParams params-
Optional<String> userId -
Optional<String> developerPersonaDeveloper persona metadata.
-
Optional<String> roleownerorreader -
Optional<String> roleIdRole ID to assign to the user.
-
Optional<String> technicalLevelTechnical level metadata.
-
Returns
-
class OrganizationUser:Represents an individual
userwithin an organization.-
String idThe identifier, which can be referenced in API endpoints
-
long addedAtThe Unix timestamp (in seconds) of when the user was added.
-
JsonValue; object_ "organization.user"constantThe object type, which is always
organization.userORGANIZATION_USER("organization.user")
-
Optional<Long> apiKeyLastUsedAtThe Unix timestamp (in seconds) of the user's last API key usage.
-
Optional<Long> createdThe Unix timestamp (in seconds) of when the user was created.
-
Optional<String> developerPersonaThe developer persona metadata for the user.
-
Optional<String> emailThe email address of the user
-
Optional<Boolean> isDefaultWhether this is the organization's default user.
-
Optional<Boolean> isScaleTierAuthorizedPurchaserWhether the user is an authorized purchaser for Scale Tier.
-
Optional<Boolean> isScimManagedWhether the user is managed through SCIM.
-
Optional<Boolean> isServiceAccountWhether the user is a service account.
-
Optional<String> nameThe name of the user
-
Optional<Projects> projectsProjects associated with the user, if included.
-
List<Data> data-
Optional<String> id -
Optional<String> name -
Optional<String> role
-
-
JsonValue; object_ "list"constantLIST("list")
-
-
Optional<String> roleownerorreader -
Optional<String> technicalLevelThe technical level metadata for the user.
-
Optional<User> userNested user details.
-
String id -
JsonValue; object_ "user"constantUSER("user")
-
Optional<Boolean> banned -
Optional<Long> bannedAt -
Optional<String> email -
Optional<Boolean> enabled -
Optional<String> name -
Optional<String> picture
-
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.users.OrganizationUser;
import com.openai.models.admin.organization.users.UserUpdateParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
OrganizationUser organizationUser = client.admin().organization().users().update("user_id");
}
}
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
UserDeleteResponse admin().organization().users().delete(UserDeleteParamsparams = UserDeleteParams.none(), RequestOptionsrequestOptions = RequestOptions.none())
delete /organization/users/{user_id}
Deletes a user from the organization.
Parameters
-
UserDeleteParams paramsOptional<String> userId
Returns
-
class UserDeleteResponse:-
String id -
boolean deleted -
JsonValue; object_ "organization.user.deleted"constantORGANIZATION_USER_DELETED("organization.user.deleted")
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.users.UserDeleteParams;
import com.openai.models.admin.organization.users.UserDeleteResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
UserDeleteResponse user = client.admin().organization().users().delete("user_id");
}
}
Response
{
"id": "id",
"deleted": true,
"object": "organization.user.deleted"
}
Domain Types
Organization User
-
class OrganizationUser:Represents an individual
userwithin an organization.-
String idThe identifier, which can be referenced in API endpoints
-
long addedAtThe Unix timestamp (in seconds) of when the user was added.
-
JsonValue; object_ "organization.user"constantThe object type, which is always
organization.userORGANIZATION_USER("organization.user")
-
Optional<Long> apiKeyLastUsedAtThe Unix timestamp (in seconds) of the user's last API key usage.
-
Optional<Long> createdThe Unix timestamp (in seconds) of when the user was created.
-
Optional<String> developerPersonaThe developer persona metadata for the user.
-
Optional<String> emailThe email address of the user
-
Optional<Boolean> isDefaultWhether this is the organization's default user.
-
Optional<Boolean> isScaleTierAuthorizedPurchaserWhether the user is an authorized purchaser for Scale Tier.
-
Optional<Boolean> isScimManagedWhether the user is managed through SCIM.
-
Optional<Boolean> isServiceAccountWhether the user is a service account.
-
Optional<String> nameThe name of the user
-
Optional<Projects> projectsProjects associated with the user, if included.
-
List<Data> data-
Optional<String> id -
Optional<String> name -
Optional<String> role
-
-
JsonValue; object_ "list"constantLIST("list")
-
-
Optional<String> roleownerorreader -
Optional<String> technicalLevelThe technical level metadata for the user.
-
Optional<User> userNested user details.
-
String id -
JsonValue; object_ "user"constantUSER("user")
-
Optional<Boolean> banned -
Optional<Long> bannedAt -
Optional<String> email -
Optional<Boolean> enabled -
Optional<String> name -
Optional<String> picture
-
-
Roles
List user organization role assignments
RoleListPage admin().organization().users().roles().list(RoleListParamsparams = RoleListParams.none(), RequestOptionsrequestOptions = RequestOptions.none())
get /organization/users/{user_id}/roles
Lists the organization roles assigned to a user within the organization.
Parameters
-
RoleListParams params-
Optional<String> userId -
Optional<String> afterCursor for pagination. Provide the value from the previous response's
nextfield to continue listing organization roles. -
Optional<Long> limitA limit on the number of organization role assignments to return.
-
Optional<Order> orderSort order for the returned organization roles.
-
ASC("asc") -
DESC("desc")
-
-
Returns
-
class RoleListResponse:Detailed information about a role assignment entry returned when listing assignments.
-
String idIdentifier for the role.
-
Optional<List<AssignmentSource>> assignmentSourcesPrincipals from which the role assignment is inherited, when available.
-
String principalId -
String principalType
-
-
Optional<Long> createdAtWhen the role was created.
-
Optional<String> createdByIdentifier of the actor who created the role.
-
Optional<CreatedByUserObj> createdByUserObjUser details for the actor that created the role, when available.
-
Optional<String> descriptionDescription of the role.
-
Optional<Metadata> metadataArbitrary metadata stored on the role.
-
String nameName of the role.
-
List<String> permissionsPermissions associated with the role.
-
boolean predefinedRoleWhether the role is predefined by OpenAI.
-
String resourceTypeResource type the role applies to.
-
Optional<Long> updatedAtWhen the role was last updated.
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.users.roles.RoleListPage;
import com.openai.models.admin.organization.users.roles.RoleListParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
RoleListPage page = client.admin().organization().users().roles().list("user_id");
}
}
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
RoleCreateResponse admin().organization().users().roles().create(RoleCreateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
post /organization/users/{user_id}/roles
Assigns an organization role to a user within the organization.
Parameters
-
RoleCreateParams params-
Optional<String> userId -
String roleIdIdentifier of the role to assign.
-
Returns
-
class RoleCreateResponse:Role assignment linking a user to a role.
-
JsonValue; object_ "user.role"constantAlways
user.role.USER_ROLE("user.role")
-
Role roleDetails about a role that can be assigned through the public Roles API.
-
String idIdentifier for the role.
-
Optional<String> descriptionOptional description of the role.
-
String nameUnique name for the role.
-
JsonValue; object_ "role"constantAlways
role.ROLE("role")
-
List<String> permissionsPermissions granted by the role.
-
boolean predefinedRoleWhether the role is predefined and managed by OpenAI.
-
String resourceTypeResource type the role is bound to (for example
api.organizationorapi.project).
-
-
OrganizationUser userRepresents an individual
userwithin an organization.-
String idThe identifier, which can be referenced in API endpoints
-
long addedAtThe Unix timestamp (in seconds) of when the user was added.
-
JsonValue; object_ "organization.user"constantThe object type, which is always
organization.userORGANIZATION_USER("organization.user")
-
Optional<Long> apiKeyLastUsedAtThe Unix timestamp (in seconds) of the user's last API key usage.
-
Optional<Long> createdThe Unix timestamp (in seconds) of when the user was created.
-
Optional<String> developerPersonaThe developer persona metadata for the user.
-
Optional<String> emailThe email address of the user
-
Optional<Boolean> isDefaultWhether this is the organization's default user.
-
Optional<Boolean> isScaleTierAuthorizedPurchaserWhether the user is an authorized purchaser for Scale Tier.
-
Optional<Boolean> isScimManagedWhether the user is managed through SCIM.
-
Optional<Boolean> isServiceAccountWhether the user is a service account.
-
Optional<String> nameThe name of the user
-
Optional<Projects> projectsProjects associated with the user, if included.
-
List<Data> data-
Optional<String> id -
Optional<String> name -
Optional<String> role
-
-
JsonValue; object_ "list"constantLIST("list")
-
-
Optional<String> roleownerorreader -
Optional<String> technicalLevelThe technical level metadata for the user.
-
Optional<User> userNested user details.
-
String id -
JsonValue; object_ "user"constantUSER("user")
-
Optional<Boolean> banned -
Optional<Long> bannedAt -
Optional<String> email -
Optional<Boolean> enabled -
Optional<String> name -
Optional<String> picture
-
-
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.users.roles.RoleCreateParams;
import com.openai.models.admin.organization.users.roles.RoleCreateResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
RoleCreateParams params = RoleCreateParams.builder()
.userId("user_id")
.roleId("role_id")
.build();
RoleCreateResponse role = client.admin().organization().users().roles().create(params);
}
}
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
RoleRetrieveResponse admin().organization().users().roles().retrieve(RoleRetrieveParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
get /organization/users/{user_id}/roles/{role_id}
Retrieves an organization role assigned to a user.
Parameters
-
RoleRetrieveParams params-
String userId -
Optional<String> roleId
-
Returns
-
class RoleRetrieveResponse:Detailed information about a role assignment entry returned when listing assignments.
-
String idIdentifier for the role.
-
Optional<List<AssignmentSource>> assignmentSourcesPrincipals from which the role assignment is inherited, when available.
-
String principalId -
String principalType
-
-
Optional<Long> createdAtWhen the role was created.
-
Optional<String> createdByIdentifier of the actor who created the role.
-
Optional<CreatedByUserObj> createdByUserObjUser details for the actor that created the role, when available.
-
Optional<String> descriptionDescription of the role.
-
Optional<Metadata> metadataArbitrary metadata stored on the role.
-
String nameName of the role.
-
List<String> permissionsPermissions associated with the role.
-
boolean predefinedRoleWhether the role is predefined by OpenAI.
-
String resourceTypeResource type the role applies to.
-
Optional<Long> updatedAtWhen the role was last updated.
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.users.roles.RoleRetrieveParams;
import com.openai.models.admin.organization.users.roles.RoleRetrieveResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
RoleRetrieveParams params = RoleRetrieveParams.builder()
.userId("user_id")
.roleId("role_id")
.build();
RoleRetrieveResponse role = client.admin().organization().users().roles().retrieve(params);
}
}
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
RoleDeleteResponse admin().organization().users().roles().delete(RoleDeleteParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
delete /organization/users/{user_id}/roles/{role_id}
Unassigns an organization role from a user within the organization.
Parameters
-
RoleDeleteParams params-
String userId -
Optional<String> roleId
-
Returns
-
class RoleDeleteResponse:Confirmation payload returned after unassigning a role.
-
boolean deletedWhether the assignment was removed.
-
String object_Identifier for the deleted assignment, such as
group.role.deletedoruser.role.deleted.
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.users.roles.RoleDeleteParams;
import com.openai.models.admin.organization.users.roles.RoleDeleteResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
RoleDeleteParams params = RoleDeleteParams.builder()
.userId("user_id")
.roleId("role_id")
.build();
RoleDeleteResponse role = client.admin().organization().users().roles().delete(params);
}
}
Response
{
"deleted": true,
"object": "object"
}
Groups
List groups
GroupListPage admin().organization().groups().list(GroupListParamsparams = GroupListParams.none(), RequestOptionsrequestOptions = RequestOptions.none())
get /organization/groups
Lists all groups in the organization.
Parameters
-
GroupListParams params-
Optional<String> afterA 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. -
Optional<Long> limitA limit on the number of groups to be returned. Limit can range between 0 and 1000, and the default is 100.
-
Optional<Order> orderSpecifies the sort order of the returned groups.
-
ASC("asc") -
DESC("desc")
-
-
Returns
-
class Group:Details about an organization group.
-
String idIdentifier for the group.
-
long createdAtUnix timestamp (in seconds) when the group was created.
-
GroupType groupTypeThe type of the group.
-
GROUP("group") -
TENANT_GROUP("tenant_group")
-
-
boolean isScimManagedWhether the group is managed through SCIM and controlled by your identity provider.
-
String nameDisplay name of the group.
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.groups.GroupListPage;
import com.openai.models.admin.organization.groups.GroupListParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
GroupListPage page = client.admin().organization().groups().list();
}
}
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
Group admin().organization().groups().create(GroupCreateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
post /organization/groups
Creates a new group in the organization.
Parameters
-
GroupCreateParams params-
String nameHuman readable name for the group.
-
Returns
-
class Group:Details about an organization group.
-
String idIdentifier for the group.
-
long createdAtUnix timestamp (in seconds) when the group was created.
-
GroupType groupTypeThe type of the group.
-
GROUP("group") -
TENANT_GROUP("tenant_group")
-
-
boolean isScimManagedWhether the group is managed through SCIM and controlled by your identity provider.
-
String nameDisplay name of the group.
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.groups.Group;
import com.openai.models.admin.organization.groups.GroupCreateParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
GroupCreateParams params = GroupCreateParams.builder()
.name("x")
.build();
Group group = client.admin().organization().groups().create(params);
}
}
Response
{
"id": "id",
"created_at": 0,
"group_type": "group",
"is_scim_managed": true,
"name": "name"
}
Retrieve group
Group admin().organization().groups().retrieve(GroupRetrieveParamsparams = GroupRetrieveParams.none(), RequestOptionsrequestOptions = RequestOptions.none())
get /organization/groups/{group_id}
Retrieves a group.
Parameters
-
GroupRetrieveParams paramsOptional<String> groupId
Returns
-
class Group:Details about an organization group.
-
String idIdentifier for the group.
-
long createdAtUnix timestamp (in seconds) when the group was created.
-
GroupType groupTypeThe type of the group.
-
GROUP("group") -
TENANT_GROUP("tenant_group")
-
-
boolean isScimManagedWhether the group is managed through SCIM and controlled by your identity provider.
-
String nameDisplay name of the group.
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.groups.Group;
import com.openai.models.admin.organization.groups.GroupRetrieveParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
Group group = client.admin().organization().groups().retrieve("group_id");
}
}
Response
{
"id": "id",
"created_at": 0,
"group_type": "group",
"is_scim_managed": true,
"name": "name"
}
Update group
GroupUpdateResponse admin().organization().groups().update(GroupUpdateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
post /organization/groups/{group_id}
Updates a group's information.
Parameters
-
GroupUpdateParams params-
Optional<String> groupId -
String nameNew display name for the group.
-
Returns
-
class GroupUpdateResponse:Response returned after updating a group.
-
String idIdentifier for the group.
-
long createdAtUnix timestamp (in seconds) when the group was created.
-
boolean isScimManagedWhether the group is managed through SCIM and controlled by your identity provider.
-
String nameUpdated display name for the group.
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.groups.GroupUpdateParams;
import com.openai.models.admin.organization.groups.GroupUpdateResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
GroupUpdateParams params = GroupUpdateParams.builder()
.groupId("group_id")
.name("x")
.build();
GroupUpdateResponse group = client.admin().organization().groups().update(params);
}
}
Response
{
"id": "id",
"created_at": 0,
"is_scim_managed": true,
"name": "name"
}
Delete group
GroupDeleteResponse admin().organization().groups().delete(GroupDeleteParamsparams = GroupDeleteParams.none(), RequestOptionsrequestOptions = RequestOptions.none())
delete /organization/groups/{group_id}
Deletes a group from the organization.
Parameters
-
GroupDeleteParams paramsOptional<String> groupId
Returns
-
class GroupDeleteResponse:Confirmation payload returned after deleting a group.
-
String idIdentifier of the deleted group.
-
boolean deletedWhether the group was deleted.
-
JsonValue; object_ "group.deleted"constantAlways
group.deleted.GROUP_DELETED("group.deleted")
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.groups.GroupDeleteParams;
import com.openai.models.admin.organization.groups.GroupDeleteResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
GroupDeleteResponse group = client.admin().organization().groups().delete("group_id");
}
}
Response
{
"id": "id",
"deleted": true,
"object": "group.deleted"
}
Domain Types
Group
-
class Group:Details about an organization group.
-
String idIdentifier for the group.
-
long createdAtUnix timestamp (in seconds) when the group was created.
-
GroupType groupTypeThe type of the group.
-
GROUP("group") -
TENANT_GROUP("tenant_group")
-
-
boolean isScimManagedWhether the group is managed through SCIM and controlled by your identity provider.
-
String nameDisplay name of the group.
-
Users
List group users
UserListPage admin().organization().groups().users().list(UserListParamsparams = UserListParams.none(), RequestOptionsrequestOptions = RequestOptions.none())
get /organization/groups/{group_id}/users
Lists the users assigned to a group.
Parameters
-
UserListParams params-
Optional<String> groupId -
Optional<String> afterA cursor for use in pagination. Provide the ID of the last user from the previous list response to retrieve the next page.
-
Optional<Long> limitA limit on the number of users to be returned. Limit can range between 0 and 1000, and the default is 100.
-
Optional<Order> orderSpecifies the sort order of users in the list.
-
ASC("asc") -
DESC("desc")
-
-
Returns
-
class OrganizationGroupUser:Represents an individual user returned when inspecting group membership.
-
String idThe identifier, which can be referenced in API endpoints
-
Optional<String> emailThe email address of the user.
-
String nameThe name of the user.
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.groups.users.UserListPage;
import com.openai.models.admin.organization.groups.users.UserListParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
UserListPage page = client.admin().organization().groups().users().list("group_id");
}
}
Response
{
"data": [
{
"id": "id",
"email": "email",
"name": "name"
}
],
"has_more": true,
"next": "next",
"object": "list"
}
Add group user
UserCreateResponse admin().organization().groups().users().create(UserCreateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
post /organization/groups/{group_id}/users
Adds a user to a group.
Parameters
-
UserCreateParams params-
Optional<String> groupId -
String userIdIdentifier of the user to add to the group.
-
Returns
-
class UserCreateResponse:Confirmation payload returned after adding a user to a group.
-
String groupIdIdentifier of the group the user was added to.
-
JsonValue; object_ "group.user"constantAlways
group.user.GROUP_USER("group.user")
-
String userIdIdentifier of the user that was added.
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.groups.users.UserCreateParams;
import com.openai.models.admin.organization.groups.users.UserCreateResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
UserCreateParams params = UserCreateParams.builder()
.groupId("group_id")
.userId("user_id")
.build();
UserCreateResponse user = client.admin().organization().groups().users().create(params);
}
}
Response
{
"group_id": "group_id",
"object": "group.user",
"user_id": "user_id"
}
Retrieve group user
UserRetrieveResponse admin().organization().groups().users().retrieve(UserRetrieveParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
get /organization/groups/{group_id}/users/{user_id}
Retrieves a user in a group.
Parameters
-
UserRetrieveParams params-
String groupId -
Optional<String> userId
-
Returns
-
class UserRetrieveResponse:Details about a user returned from an organization group membership lookup.
-
String idIdentifier for the user.
-
Optional<String> emailEmail address of the user, or
nullfor users without an email. -
Optional<Boolean> isServiceAccountWhether the user is a service account.
-
String nameDisplay name of the user.
-
Optional<String> pictureURL of the user's profile picture, if available.
-
UserType userTypeThe type of user.
-
USER("user") -
TENANT_USER("tenant_user")
-
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.groups.users.UserRetrieveParams;
import com.openai.models.admin.organization.groups.users.UserRetrieveResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
UserRetrieveParams params = UserRetrieveParams.builder()
.groupId("group_id")
.userId("user_id")
.build();
UserRetrieveResponse user = client.admin().organization().groups().users().retrieve(params);
}
}
Response
{
"id": "id",
"email": "email",
"is_service_account": true,
"name": "name",
"picture": "picture",
"user_type": "user"
}
Remove group user
UserDeleteResponse admin().organization().groups().users().delete(UserDeleteParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
delete /organization/groups/{group_id}/users/{user_id}
Removes a user from a group.
Parameters
-
UserDeleteParams params-
String groupId -
Optional<String> userId
-
Returns
-
class UserDeleteResponse:Confirmation payload returned after removing a user from a group.
-
boolean deletedWhether the group membership was removed.
-
JsonValue; object_ "group.user.deleted"constantAlways
group.user.deleted.GROUP_USER_DELETED("group.user.deleted")
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.groups.users.UserDeleteParams;
import com.openai.models.admin.organization.groups.users.UserDeleteResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
UserDeleteParams params = UserDeleteParams.builder()
.groupId("group_id")
.userId("user_id")
.build();
UserDeleteResponse user = client.admin().organization().groups().users().delete(params);
}
}
Response
{
"deleted": true,
"object": "group.user.deleted"
}
Domain Types
Organization Group User
-
class OrganizationGroupUser:Represents an individual user returned when inspecting group membership.
-
String idThe identifier, which can be referenced in API endpoints
-
Optional<String> emailThe email address of the user.
-
String nameThe name of the user.
-
Roles
List group organization role assignments
RoleListPage admin().organization().groups().roles().list(RoleListParamsparams = RoleListParams.none(), RequestOptionsrequestOptions = RequestOptions.none())
get /organization/groups/{group_id}/roles
Lists the organization roles assigned to a group within the organization.
Parameters
-
RoleListParams params-
Optional<String> groupId -
Optional<String> afterCursor for pagination. Provide the value from the previous response's
nextfield to continue listing organization roles. -
Optional<Long> limitA limit on the number of organization role assignments to return.
-
Optional<Order> orderSort order for the returned organization roles.
-
ASC("asc") -
DESC("desc")
-
-
Returns
-
class RoleListResponse:Detailed information about a role assignment entry returned when listing assignments.
-
String idIdentifier for the role.
-
Optional<List<AssignmentSource>> assignmentSourcesPrincipals from which the role assignment is inherited, when available.
-
String principalId -
String principalType
-
-
Optional<Long> createdAtWhen the role was created.
-
Optional<String> createdByIdentifier of the actor who created the role.
-
Optional<CreatedByUserObj> createdByUserObjUser details for the actor that created the role, when available.
-
Optional<String> descriptionDescription of the role.
-
Optional<Metadata> metadataArbitrary metadata stored on the role.
-
String nameName of the role.
-
List<String> permissionsPermissions associated with the role.
-
boolean predefinedRoleWhether the role is predefined by OpenAI.
-
String resourceTypeResource type the role applies to.
-
Optional<Long> updatedAtWhen the role was last updated.
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.groups.roles.RoleListPage;
import com.openai.models.admin.organization.groups.roles.RoleListParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
RoleListPage page = client.admin().organization().groups().roles().list("group_id");
}
}
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
RoleCreateResponse admin().organization().groups().roles().create(RoleCreateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
post /organization/groups/{group_id}/roles
Assigns an organization role to a group within the organization.
Parameters
-
RoleCreateParams params-
Optional<String> groupId -
String roleIdIdentifier of the role to assign.
-
Returns
-
class RoleCreateResponse:Role assignment linking a group to a role.
-
Group groupSummary information about a group returned in role assignment responses.
-
String idIdentifier for the group.
-
long createdAtUnix timestamp (in seconds) when the group was created.
-
String nameDisplay name of the group.
-
JsonValue; object_ "group"constantAlways
group.GROUP("group")
-
boolean scimManagedWhether the group is managed through SCIM.
-
-
JsonValue; object_ "group.role"constantAlways
group.role.GROUP_ROLE("group.role")
-
Role roleDetails about a role that can be assigned through the public Roles API.
-
String idIdentifier for the role.
-
Optional<String> descriptionOptional description of the role.
-
String nameUnique name for the role.
-
JsonValue; object_ "role"constantAlways
role.ROLE("role")
-
List<String> permissionsPermissions granted by the role.
-
boolean predefinedRoleWhether the role is predefined and managed by OpenAI.
-
String resourceTypeResource type the role is bound to (for example
api.organizationorapi.project).
-
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.groups.roles.RoleCreateParams;
import com.openai.models.admin.organization.groups.roles.RoleCreateResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
RoleCreateParams params = RoleCreateParams.builder()
.groupId("group_id")
.roleId("role_id")
.build();
RoleCreateResponse role = client.admin().organization().groups().roles().create(params);
}
}
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
RoleRetrieveResponse admin().organization().groups().roles().retrieve(RoleRetrieveParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
get /organization/groups/{group_id}/roles/{role_id}
Retrieves an organization role assigned to a group.
Parameters
-
RoleRetrieveParams params-
String groupId -
Optional<String> roleId
-
Returns
-
class RoleRetrieveResponse:Detailed information about a role assignment entry returned when listing assignments.
-
String idIdentifier for the role.
-
Optional<List<AssignmentSource>> assignmentSourcesPrincipals from which the role assignment is inherited, when available.
-
String principalId -
String principalType
-
-
Optional<Long> createdAtWhen the role was created.
-
Optional<String> createdByIdentifier of the actor who created the role.
-
Optional<CreatedByUserObj> createdByUserObjUser details for the actor that created the role, when available.
-
Optional<String> descriptionDescription of the role.
-
Optional<Metadata> metadataArbitrary metadata stored on the role.
-
String nameName of the role.
-
List<String> permissionsPermissions associated with the role.
-
boolean predefinedRoleWhether the role is predefined by OpenAI.
-
String resourceTypeResource type the role applies to.
-
Optional<Long> updatedAtWhen the role was last updated.
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.groups.roles.RoleRetrieveParams;
import com.openai.models.admin.organization.groups.roles.RoleRetrieveResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
RoleRetrieveParams params = RoleRetrieveParams.builder()
.groupId("group_id")
.roleId("role_id")
.build();
RoleRetrieveResponse role = client.admin().organization().groups().roles().retrieve(params);
}
}
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
RoleDeleteResponse admin().organization().groups().roles().delete(RoleDeleteParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
delete /organization/groups/{group_id}/roles/{role_id}
Unassigns an organization role from a group within the organization.
Parameters
-
RoleDeleteParams params-
String groupId -
Optional<String> roleId
-
Returns
-
class RoleDeleteResponse:Confirmation payload returned after unassigning a role.
-
boolean deletedWhether the assignment was removed.
-
String object_Identifier for the deleted assignment, such as
group.role.deletedoruser.role.deleted.
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.groups.roles.RoleDeleteParams;
import com.openai.models.admin.organization.groups.roles.RoleDeleteResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
RoleDeleteParams params = RoleDeleteParams.builder()
.groupId("group_id")
.roleId("role_id")
.build();
RoleDeleteResponse role = client.admin().organization().groups().roles().delete(params);
}
}
Response
{
"deleted": true,
"object": "object"
}
Roles
List organization roles
RoleListPage admin().organization().roles().list(RoleListParamsparams = RoleListParams.none(), RequestOptionsrequestOptions = RequestOptions.none())
get /organization/roles
Lists the roles configured for the organization.
Parameters
-
RoleListParams params-
Optional<String> afterCursor for pagination. Provide the value from the previous response's
nextfield to continue listing roles. -
Optional<Long> limitA limit on the number of roles to return. Defaults to 1000.
-
Optional<Order> orderSort order for the returned roles.
-
ASC("asc") -
DESC("desc")
-
-
Returns
-
class Role:Details about a role that can be assigned through the public Roles API.
-
String idIdentifier for the role.
-
Optional<String> descriptionOptional description of the role.
-
String nameUnique name for the role.
-
JsonValue; object_ "role"constantAlways
role.ROLE("role")
-
List<String> permissionsPermissions granted by the role.
-
boolean predefinedRoleWhether the role is predefined and managed by OpenAI.
-
String resourceTypeResource type the role is bound to (for example
api.organizationorapi.project).
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.roles.RoleListPage;
import com.openai.models.admin.organization.roles.RoleListParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
RoleListPage page = client.admin().organization().roles().list();
}
}
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
Role admin().organization().roles().create(RoleCreateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
post /organization/roles
Creates a custom role for the organization.
Parameters
-
RoleCreateParams params-
List<String> permissionsPermissions to grant to the role.
-
String roleNameUnique name for the role.
-
Optional<String> descriptionOptional description of the role.
-
Returns
-
class Role:Details about a role that can be assigned through the public Roles API.
-
String idIdentifier for the role.
-
Optional<String> descriptionOptional description of the role.
-
String nameUnique name for the role.
-
JsonValue; object_ "role"constantAlways
role.ROLE("role")
-
List<String> permissionsPermissions granted by the role.
-
boolean predefinedRoleWhether the role is predefined and managed by OpenAI.
-
String resourceTypeResource type the role is bound to (for example
api.organizationorapi.project).
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.roles.Role;
import com.openai.models.admin.organization.roles.RoleCreateParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
RoleCreateParams params = RoleCreateParams.builder()
.addPermission("string")
.roleName("role_name")
.build();
Role role = client.admin().organization().roles().create(params);
}
}
Response
{
"id": "id",
"description": "description",
"name": "name",
"object": "role",
"permissions": [
"string"
],
"predefined_role": true,
"resource_type": "resource_type"
}
Retrieve organization role
Role admin().organization().roles().retrieve(RoleRetrieveParamsparams = RoleRetrieveParams.none(), RequestOptionsrequestOptions = RequestOptions.none())
get /organization/roles/{role_id}
Retrieves an organization role.
Parameters
-
RoleRetrieveParams paramsOptional<String> roleId
Returns
-
class Role:Details about a role that can be assigned through the public Roles API.
-
String idIdentifier for the role.
-
Optional<String> descriptionOptional description of the role.
-
String nameUnique name for the role.
-
JsonValue; object_ "role"constantAlways
role.ROLE("role")
-
List<String> permissionsPermissions granted by the role.
-
boolean predefinedRoleWhether the role is predefined and managed by OpenAI.
-
String resourceTypeResource type the role is bound to (for example
api.organizationorapi.project).
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.roles.Role;
import com.openai.models.admin.organization.roles.RoleRetrieveParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
Role role = client.admin().organization().roles().retrieve("role_id");
}
}
Response
{
"id": "id",
"description": "description",
"name": "name",
"object": "role",
"permissions": [
"string"
],
"predefined_role": true,
"resource_type": "resource_type"
}
Update organization role
Role admin().organization().roles().update(RoleUpdateParamsparams = RoleUpdateParams.none(), RequestOptionsrequestOptions = RequestOptions.none())
post /organization/roles/{role_id}
Updates an existing organization role.
Parameters
-
RoleUpdateParams params-
Optional<String> roleId -
Optional<String> descriptionNew description for the role.
-
Optional<List<String>> permissionsUpdated set of permissions for the role.
-
Optional<String> roleNameNew name for the role.
-
Returns
-
class Role:Details about a role that can be assigned through the public Roles API.
-
String idIdentifier for the role.
-
Optional<String> descriptionOptional description of the role.
-
String nameUnique name for the role.
-
JsonValue; object_ "role"constantAlways
role.ROLE("role")
-
List<String> permissionsPermissions granted by the role.
-
boolean predefinedRoleWhether the role is predefined and managed by OpenAI.
-
String resourceTypeResource type the role is bound to (for example
api.organizationorapi.project).
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.roles.Role;
import com.openai.models.admin.organization.roles.RoleUpdateParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
Role role = client.admin().organization().roles().update("role_id");
}
}
Response
{
"id": "id",
"description": "description",
"name": "name",
"object": "role",
"permissions": [
"string"
],
"predefined_role": true,
"resource_type": "resource_type"
}
Delete organization role
RoleDeleteResponse admin().organization().roles().delete(RoleDeleteParamsparams = RoleDeleteParams.none(), RequestOptionsrequestOptions = RequestOptions.none())
delete /organization/roles/{role_id}
Deletes a custom role from the organization.
Parameters
-
RoleDeleteParams paramsOptional<String> roleId
Returns
-
class RoleDeleteResponse:Confirmation payload returned after deleting a role.
-
String idIdentifier of the deleted role.
-
boolean deletedWhether the role was deleted.
-
JsonValue; object_ "role.deleted"constantAlways
role.deleted.ROLE_DELETED("role.deleted")
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.roles.RoleDeleteParams;
import com.openai.models.admin.organization.roles.RoleDeleteResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
RoleDeleteResponse role = client.admin().organization().roles().delete("role_id");
}
}
Response
{
"id": "id",
"deleted": true,
"object": "role.deleted"
}
Domain Types
Role
-
class Role:Details about a role that can be assigned through the public Roles API.
-
String idIdentifier for the role.
-
Optional<String> descriptionOptional description of the role.
-
String nameUnique name for the role.
-
JsonValue; object_ "role"constantAlways
role.ROLE("role")
-
List<String> permissionsPermissions granted by the role.
-
boolean predefinedRoleWhether the role is predefined and managed by OpenAI.
-
String resourceTypeResource type the role is bound to (for example
api.organizationorapi.project).
-
Data Retention
Retrieve organization data retention
OrganizationDataRetention admin().organization().dataRetention().retrieve(DataRetentionRetrieveParamsparams = DataRetentionRetrieveParams.none(), RequestOptionsrequestOptions = RequestOptions.none())
get /organization/data_retention
Retrieves organization data retention controls.
Parameters
DataRetentionRetrieveParams params
Returns
-
class OrganizationDataRetention:Represents the organization's data retention control setting.
-
JsonValue; object_ "organization.data_retention"constantThe object type, which is always
organization.data_retention.ORGANIZATION_DATA_RETENTION("organization.data_retention")
-
Type typeThe configured organization data retention type.
-
ZERO_DATA_RETENTION("zero_data_retention") -
MODIFIED_ABUSE_MONITORING("modified_abuse_monitoring") -
ENHANCED_ZERO_DATA_RETENTION("enhanced_zero_data_retention") -
ENHANCED_MODIFIED_ABUSE_MONITORING("enhanced_modified_abuse_monitoring")
-
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.dataretention.DataRetentionRetrieveParams;
import com.openai.models.admin.organization.dataretention.OrganizationDataRetention;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
OrganizationDataRetention organizationDataRetention = client.admin().organization().dataRetention().retrieve();
}
}
Response
{
"object": "organization.data_retention",
"type": "zero_data_retention"
}
Update organization data retention
OrganizationDataRetention admin().organization().dataRetention().update(DataRetentionUpdateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
post /organization/data_retention
Updates organization data retention controls.
Parameters
-
DataRetentionUpdateParams params-
RetentionType retentionTypeThe desired organization data retention type.
-
ZERO_DATA_RETENTION("zero_data_retention") -
MODIFIED_ABUSE_MONITORING("modified_abuse_monitoring") -
ENHANCED_ZERO_DATA_RETENTION("enhanced_zero_data_retention") -
ENHANCED_MODIFIED_ABUSE_MONITORING("enhanced_modified_abuse_monitoring")
-
-
Returns
-
class OrganizationDataRetention:Represents the organization's data retention control setting.
-
JsonValue; object_ "organization.data_retention"constantThe object type, which is always
organization.data_retention.ORGANIZATION_DATA_RETENTION("organization.data_retention")
-
Type typeThe configured organization data retention type.
-
ZERO_DATA_RETENTION("zero_data_retention") -
MODIFIED_ABUSE_MONITORING("modified_abuse_monitoring") -
ENHANCED_ZERO_DATA_RETENTION("enhanced_zero_data_retention") -
ENHANCED_MODIFIED_ABUSE_MONITORING("enhanced_modified_abuse_monitoring")
-
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.dataretention.DataRetentionUpdateParams;
import com.openai.models.admin.organization.dataretention.OrganizationDataRetention;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
DataRetentionUpdateParams params = DataRetentionUpdateParams.builder()
.retentionType(DataRetentionUpdateParams.RetentionType.ZERO_DATA_RETENTION)
.build();
OrganizationDataRetention organizationDataRetention = client.admin().organization().dataRetention().update(params);
}
}
Response
{
"object": "organization.data_retention",
"type": "zero_data_retention"
}
Domain Types
Organization Data Retention
-
class OrganizationDataRetention:Represents the organization's data retention control setting.
-
JsonValue; object_ "organization.data_retention"constantThe object type, which is always
organization.data_retention.ORGANIZATION_DATA_RETENTION("organization.data_retention")
-
Type typeThe configured organization data retention type.
-
ZERO_DATA_RETENTION("zero_data_retention") -
MODIFIED_ABUSE_MONITORING("modified_abuse_monitoring") -
ENHANCED_ZERO_DATA_RETENTION("enhanced_zero_data_retention") -
ENHANCED_MODIFIED_ABUSE_MONITORING("enhanced_modified_abuse_monitoring")
-
-
Spend Alerts
List organization spend alerts
SpendAlertListPage admin().organization().spendAlerts().list(SpendAlertListParamsparams = SpendAlertListParams.none(), RequestOptionsrequestOptions = RequestOptions.none())
get /organization/spend_alerts
Lists organization spend alerts.
Parameters
-
SpendAlertListParams params-
Optional<String> afterCursor for pagination. Provide the ID of the last spend alert from the previous response to fetch the next page.
-
Optional<String> beforeCursor for pagination. Provide the ID of the first spend alert from the previous response to fetch the previous page.
-
Optional<Long> limitA limit on the number of spend alerts to return. Defaults to 20.
-
Optional<Order> orderSort order for the returned spend alerts.
-
ASC("asc") -
DESC("desc")
-
-
Returns
-
class OrganizationSpendAlert:Represents a spend alert configured at the organization level.
-
String idThe identifier, which can be referenced in API endpoints.
-
Currency currencyThe currency for the threshold amount.
USD("USD")
-
Interval intervalThe time interval for evaluating spend against the threshold.
MONTH("month")
-
NotificationChannel notificationChannelEmail notification settings for a spend alert.
-
List<String> recipientsEmail addresses that receive the spend alert notification.
-
JsonValue; type "email"constantThe notification channel type. Currently only
emailis supported.EMAIL("email")
-
Optional<String> subjectPrefixOptional subject prefix for alert emails.
-
-
JsonValue; object_ "organization.spend_alert"constantThe object type, which is always
organization.spend_alert.ORGANIZATION_SPEND_ALERT("organization.spend_alert")
-
long thresholdAmountThe alert threshold amount, in cents.
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.spendalerts.SpendAlertListPage;
import com.openai.models.admin.organization.spendalerts.SpendAlertListParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
SpendAlertListPage page = client.admin().organization().spendAlerts().list();
}
}
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
OrganizationSpendAlert admin().organization().spendAlerts().create(SpendAlertCreateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
post /organization/spend_alerts
Creates an organization spend alert.
Parameters
-
SpendAlertCreateParams params-
Currency currencyThe currency for the threshold amount.
USD("USD")
-
Interval intervalThe time interval for evaluating spend against the threshold.
MONTH("month")
-
NotificationChannel notificationChannelEmail notification settings for a spend alert.
-
List<String> recipientsEmail addresses that receive the spend alert notification.
-
JsonValue; type "email"constantThe notification channel type. Currently only
emailis supported.EMAIL("email")
-
Optional<String> subjectPrefixOptional subject prefix for alert emails.
-
-
long thresholdAmountThe alert threshold amount, in cents.
-
Returns
-
class OrganizationSpendAlert:Represents a spend alert configured at the organization level.
-
String idThe identifier, which can be referenced in API endpoints.
-
Currency currencyThe currency for the threshold amount.
USD("USD")
-
Interval intervalThe time interval for evaluating spend against the threshold.
MONTH("month")
-
NotificationChannel notificationChannelEmail notification settings for a spend alert.
-
List<String> recipientsEmail addresses that receive the spend alert notification.
-
JsonValue; type "email"constantThe notification channel type. Currently only
emailis supported.EMAIL("email")
-
Optional<String> subjectPrefixOptional subject prefix for alert emails.
-
-
JsonValue; object_ "organization.spend_alert"constantThe object type, which is always
organization.spend_alert.ORGANIZATION_SPEND_ALERT("organization.spend_alert")
-
long thresholdAmountThe alert threshold amount, in cents.
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.spendalerts.OrganizationSpendAlert;
import com.openai.models.admin.organization.spendalerts.SpendAlertCreateParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
SpendAlertCreateParams params = SpendAlertCreateParams.builder()
.currency(SpendAlertCreateParams.Currency.USD)
.interval(SpendAlertCreateParams.Interval.MONTH)
.notificationChannel(SpendAlertCreateParams.NotificationChannel.builder()
.addRecipient("string")
.build())
.thresholdAmount(0L)
.build();
OrganizationSpendAlert organizationSpendAlert = client.admin().organization().spendAlerts().create(params);
}
}
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
OrganizationSpendAlert admin().organization().spendAlerts().update(SpendAlertUpdateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
post /organization/spend_alerts/{alert_id}
Updates an organization spend alert.
Parameters
-
SpendAlertUpdateParams params-
Optional<String> alertId -
Currency currencyThe currency for the threshold amount.
USD("USD")
-
Interval intervalThe time interval for evaluating spend against the threshold.
MONTH("month")
-
NotificationChannel notificationChannelEmail notification settings for a spend alert.
-
List<String> recipientsEmail addresses that receive the spend alert notification.
-
JsonValue; type "email"constantThe notification channel type. Currently only
emailis supported.EMAIL("email")
-
Optional<String> subjectPrefixOptional subject prefix for alert emails.
-
-
long thresholdAmountThe alert threshold amount, in cents.
-
Returns
-
class OrganizationSpendAlert:Represents a spend alert configured at the organization level.
-
String idThe identifier, which can be referenced in API endpoints.
-
Currency currencyThe currency for the threshold amount.
USD("USD")
-
Interval intervalThe time interval for evaluating spend against the threshold.
MONTH("month")
-
NotificationChannel notificationChannelEmail notification settings for a spend alert.
-
List<String> recipientsEmail addresses that receive the spend alert notification.
-
JsonValue; type "email"constantThe notification channel type. Currently only
emailis supported.EMAIL("email")
-
Optional<String> subjectPrefixOptional subject prefix for alert emails.
-
-
JsonValue; object_ "organization.spend_alert"constantThe object type, which is always
organization.spend_alert.ORGANIZATION_SPEND_ALERT("organization.spend_alert")
-
long thresholdAmountThe alert threshold amount, in cents.
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.spendalerts.OrganizationSpendAlert;
import com.openai.models.admin.organization.spendalerts.SpendAlertUpdateParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
SpendAlertUpdateParams params = SpendAlertUpdateParams.builder()
.alertId("alert_id")
.currency(SpendAlertUpdateParams.Currency.USD)
.interval(SpendAlertUpdateParams.Interval.MONTH)
.notificationChannel(SpendAlertUpdateParams.NotificationChannel.builder()
.addRecipient("string")
.build())
.thresholdAmount(0L)
.build();
OrganizationSpendAlert organizationSpendAlert = client.admin().organization().spendAlerts().update(params);
}
}
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
OrganizationSpendAlertDeleted admin().organization().spendAlerts().delete(SpendAlertDeleteParamsparams = SpendAlertDeleteParams.none(), RequestOptionsrequestOptions = RequestOptions.none())
delete /organization/spend_alerts/{alert_id}
Deletes an organization spend alert.
Parameters
-
SpendAlertDeleteParams paramsOptional<String> alertId
Returns
-
class OrganizationSpendAlertDeleted:Confirmation payload returned after deleting an organization spend alert.
-
String idThe deleted spend alert ID.
-
boolean deletedWhether the spend alert was deleted.
-
JsonValue; object_ "organization.spend_alert.deleted"constantAlways
organization.spend_alert.deleted.ORGANIZATION_SPEND_ALERT_DELETED("organization.spend_alert.deleted")
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.spendalerts.OrganizationSpendAlertDeleted;
import com.openai.models.admin.organization.spendalerts.SpendAlertDeleteParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
OrganizationSpendAlertDeleted organizationSpendAlertDeleted = client.admin().organization().spendAlerts().delete("alert_id");
}
}
Response
{
"id": "id",
"deleted": true,
"object": "organization.spend_alert.deleted"
}
Domain Types
Organization Spend Alert
-
class OrganizationSpendAlert:Represents a spend alert configured at the organization level.
-
String idThe identifier, which can be referenced in API endpoints.
-
Currency currencyThe currency for the threshold amount.
USD("USD")
-
Interval intervalThe time interval for evaluating spend against the threshold.
MONTH("month")
-
NotificationChannel notificationChannelEmail notification settings for a spend alert.
-
List<String> recipientsEmail addresses that receive the spend alert notification.
-
JsonValue; type "email"constantThe notification channel type. Currently only
emailis supported.EMAIL("email")
-
Optional<String> subjectPrefixOptional subject prefix for alert emails.
-
-
JsonValue; object_ "organization.spend_alert"constantThe object type, which is always
organization.spend_alert.ORGANIZATION_SPEND_ALERT("organization.spend_alert")
-
long thresholdAmountThe alert threshold amount, in cents.
-
Organization Spend Alert Deleted
-
class OrganizationSpendAlertDeleted:Confirmation payload returned after deleting an organization spend alert.
-
String idThe deleted spend alert ID.
-
boolean deletedWhether the spend alert was deleted.
-
JsonValue; object_ "organization.spend_alert.deleted"constantAlways
organization.spend_alert.deleted.ORGANIZATION_SPEND_ALERT_DELETED("organization.spend_alert.deleted")
-
Certificates
List organization certificates
CertificateListPage admin().organization().certificates().list(CertificateListParamsparams = CertificateListParams.none(), RequestOptionsrequestOptions = RequestOptions.none())
get /organization/certificates
List uploaded certificates for this organization.
Parameters
-
CertificateListParams params-
Optional<String> afterA 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. -
Optional<Long> limitA limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
-
Optional<Order> orderSort order by the
created_attimestamp of the objects.ascfor ascending order anddescfor descending order.-
ASC("asc") -
DESC("desc")
-
-
Returns
-
class CertificateListResponse:Represents an individual certificate configured at the organization level.
-
String idThe identifier, which can be referenced in API endpoints
-
boolean activeWhether the certificate is currently active at the organization level.
-
CertificateDetails certificateDetails-
Optional<Long> expiresAtThe Unix timestamp (in seconds) of when the certificate expires.
-
Optional<Long> validAtThe Unix timestamp (in seconds) of when the certificate becomes valid.
-
-
long createdAtThe Unix timestamp (in seconds) of when the certificate was uploaded.
-
Optional<String> nameThe name of the certificate.
-
JsonValue; object_ "organization.certificate"constantThe object type, which is always
organization.certificate.ORGANIZATION_CERTIFICATE("organization.certificate")
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.certificates.CertificateListPage;
import com.openai.models.admin.organization.certificates.CertificateListParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
CertificateListPage page = client.admin().organization().certificates().list();
}
}
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
Certificate admin().organization().certificates().create(CertificateCreateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
post /organization/certificates
Upload a certificate to the organization. This does not automatically activate the certificate.
Organizations can upload up to 50 certificates.
Parameters
-
CertificateCreateParams params-
String certificateThe certificate content in PEM format
-
Optional<String> nameAn optional name for the certificate
-
Returns
-
class Certificate:Represents an individual
certificateuploaded to the organization.-
String idThe identifier, which can be referenced in API endpoints
-
CertificateDetails certificateDetails-
Optional<String> contentThe content of the certificate in PEM format.
-
Optional<Long> expiresAtThe Unix timestamp (in seconds) of when the certificate expires.
-
Optional<Long> validAtThe Unix timestamp (in seconds) of when the certificate becomes valid.
-
-
long createdAtThe Unix timestamp (in seconds) of when the certificate was uploaded.
-
Optional<String> nameThe name of the certificate.
-
Object object_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("certificate") -
ORGANIZATION_CERTIFICATE("organization.certificate") -
ORGANIZATION_PROJECT_CERTIFICATE("organization.project.certificate")
-
-
Optional<Boolean> activeWhether the certificate is currently active at the specified scope. Not returned when getting details for a specific certificate.
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.certificates.Certificate;
import com.openai.models.admin.organization.certificates.CertificateCreateParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
CertificateCreateParams params = CertificateCreateParams.builder()
.certificate("certificate")
.build();
Certificate certificate = client.admin().organization().certificates().create(params);
}
}
Response
{
"id": "id",
"certificate_details": {
"content": "content",
"expires_at": 0,
"valid_at": 0
},
"created_at": 0,
"name": "name",
"object": "certificate",
"active": true
}
Get certificate
Certificate admin().organization().certificates().retrieve(CertificateRetrieveParamsparams = CertificateRetrieveParams.none(), RequestOptionsrequestOptions = RequestOptions.none())
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
-
CertificateRetrieveParams params-
Optional<String> certificateId -
Optional<List<Include>> includeA list of additional fields to include in the response. Currently the only supported value is
contentto fetch the PEM content of the certificate.CONTENT("content")
-
Returns
-
class Certificate:Represents an individual
certificateuploaded to the organization.-
String idThe identifier, which can be referenced in API endpoints
-
CertificateDetails certificateDetails-
Optional<String> contentThe content of the certificate in PEM format.
-
Optional<Long> expiresAtThe Unix timestamp (in seconds) of when the certificate expires.
-
Optional<Long> validAtThe Unix timestamp (in seconds) of when the certificate becomes valid.
-
-
long createdAtThe Unix timestamp (in seconds) of when the certificate was uploaded.
-
Optional<String> nameThe name of the certificate.
-
Object object_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("certificate") -
ORGANIZATION_CERTIFICATE("organization.certificate") -
ORGANIZATION_PROJECT_CERTIFICATE("organization.project.certificate")
-
-
Optional<Boolean> activeWhether the certificate is currently active at the specified scope. Not returned when getting details for a specific certificate.
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.certificates.Certificate;
import com.openai.models.admin.organization.certificates.CertificateRetrieveParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
Certificate certificate = client.admin().organization().certificates().retrieve("certificate_id");
}
}
Response
{
"id": "id",
"certificate_details": {
"content": "content",
"expires_at": 0,
"valid_at": 0
},
"created_at": 0,
"name": "name",
"object": "certificate",
"active": true
}
Modify certificate
Certificate admin().organization().certificates().update(CertificateUpdateParamsparams = CertificateUpdateParams.none(), RequestOptionsrequestOptions = RequestOptions.none())
post /organization/certificates/{certificate_id}
Modify a certificate. Note that only the name can be modified.
Parameters
-
CertificateUpdateParams params-
Optional<String> certificateId -
Optional<String> nameThe updated name for the certificate
-
Returns
-
class Certificate:Represents an individual
certificateuploaded to the organization.-
String idThe identifier, which can be referenced in API endpoints
-
CertificateDetails certificateDetails-
Optional<String> contentThe content of the certificate in PEM format.
-
Optional<Long> expiresAtThe Unix timestamp (in seconds) of when the certificate expires.
-
Optional<Long> validAtThe Unix timestamp (in seconds) of when the certificate becomes valid.
-
-
long createdAtThe Unix timestamp (in seconds) of when the certificate was uploaded.
-
Optional<String> nameThe name of the certificate.
-
Object object_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("certificate") -
ORGANIZATION_CERTIFICATE("organization.certificate") -
ORGANIZATION_PROJECT_CERTIFICATE("organization.project.certificate")
-
-
Optional<Boolean> activeWhether the certificate is currently active at the specified scope. Not returned when getting details for a specific certificate.
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.certificates.Certificate;
import com.openai.models.admin.organization.certificates.CertificateUpdateParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
Certificate certificate = client.admin().organization().certificates().update("certificate_id");
}
}
Response
{
"id": "id",
"certificate_details": {
"content": "content",
"expires_at": 0,
"valid_at": 0
},
"created_at": 0,
"name": "name",
"object": "certificate",
"active": true
}
Delete certificate
CertificateDeleteResponse admin().organization().certificates().delete(CertificateDeleteParamsparams = CertificateDeleteParams.none(), RequestOptionsrequestOptions = RequestOptions.none())
delete /organization/certificates/{certificate_id}
Delete a certificate from the organization.
The certificate must be inactive for the organization and all projects.
Parameters
-
CertificateDeleteParams paramsOptional<String> certificateId
Returns
-
class CertificateDeleteResponse:-
String idThe ID of the certificate that was deleted.
-
JsonValue; object_ "certificate.deleted"constantThe object type, must be
certificate.deleted.CERTIFICATE_DELETED("certificate.deleted")
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.certificates.CertificateDeleteParams;
import com.openai.models.admin.organization.certificates.CertificateDeleteResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
CertificateDeleteResponse certificate = client.admin().organization().certificates().delete("certificate_id");
}
}
Response
{
"id": "id",
"object": "certificate.deleted"
}
Activate certificates for organization
CertificateActivatePage admin().organization().certificates().activate(CertificateActivateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
post /organization/certificates/activate
Activate certificates at the organization level.
You can atomically and idempotently activate up to 10 certificates at a time.
Parameters
-
CertificateActivateParams paramsList<String> certificateIds
Returns
-
class CertificateActivateResponse:Represents an individual certificate configured at the organization level.
-
String idThe identifier, which can be referenced in API endpoints
-
boolean activeWhether the certificate is currently active at the organization level.
-
CertificateDetails certificateDetails-
Optional<Long> expiresAtThe Unix timestamp (in seconds) of when the certificate expires.
-
Optional<Long> validAtThe Unix timestamp (in seconds) of when the certificate becomes valid.
-
-
long createdAtThe Unix timestamp (in seconds) of when the certificate was uploaded.
-
Optional<String> nameThe name of the certificate.
-
JsonValue; object_ "organization.certificate"constantThe object type, which is always
organization.certificate.ORGANIZATION_CERTIFICATE("organization.certificate")
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.certificates.CertificateActivatePage;
import com.openai.models.admin.organization.certificates.CertificateActivateParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
CertificateActivateParams params = CertificateActivateParams.builder()
.addCertificateId("cert_abc")
.build();
CertificateActivatePage page = client.admin().organization().certificates().activate(params);
}
}
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
CertificateDeactivatePage admin().organization().certificates().deactivate(CertificateDeactivateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
post /organization/certificates/deactivate
Deactivate certificates at the organization level.
You can atomically and idempotently deactivate up to 10 certificates at a time.
Parameters
-
CertificateDeactivateParams paramsList<String> certificateIds
Returns
-
class CertificateDeactivateResponse:Represents an individual certificate configured at the organization level.
-
String idThe identifier, which can be referenced in API endpoints
-
boolean activeWhether the certificate is currently active at the organization level.
-
CertificateDetails certificateDetails-
Optional<Long> expiresAtThe Unix timestamp (in seconds) of when the certificate expires.
-
Optional<Long> validAtThe Unix timestamp (in seconds) of when the certificate becomes valid.
-
-
long createdAtThe Unix timestamp (in seconds) of when the certificate was uploaded.
-
Optional<String> nameThe name of the certificate.
-
JsonValue; object_ "organization.certificate"constantThe object type, which is always
organization.certificate.ORGANIZATION_CERTIFICATE("organization.certificate")
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.certificates.CertificateDeactivatePage;
import com.openai.models.admin.organization.certificates.CertificateDeactivateParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
CertificateDeactivateParams params = CertificateDeactivateParams.builder()
.addCertificateId("cert_abc")
.build();
CertificateDeactivatePage page = client.admin().organization().certificates().deactivate(params);
}
}
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 Certificate:Represents an individual
certificateuploaded to the organization.-
String idThe identifier, which can be referenced in API endpoints
-
CertificateDetails certificateDetails-
Optional<String> contentThe content of the certificate in PEM format.
-
Optional<Long> expiresAtThe Unix timestamp (in seconds) of when the certificate expires.
-
Optional<Long> validAtThe Unix timestamp (in seconds) of when the certificate becomes valid.
-
-
long createdAtThe Unix timestamp (in seconds) of when the certificate was uploaded.
-
Optional<String> nameThe name of the certificate.
-
Object object_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("certificate") -
ORGANIZATION_CERTIFICATE("organization.certificate") -
ORGANIZATION_PROJECT_CERTIFICATE("organization.project.certificate")
-
-
Optional<Boolean> activeWhether the certificate is currently active at the specified scope. Not returned when getting details for a specific certificate.
-
Projects
List projects
ProjectListPage admin().organization().projects().list(ProjectListParamsparams = ProjectListParams.none(), RequestOptionsrequestOptions = RequestOptions.none())
get /organization/projects
Returns a list of projects.
Parameters
-
ProjectListParams params-
Optional<String> afterA 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. -
Optional<Boolean> includeArchivedIf
truereturns all projects including those that have beenarchived. Archived projects are not included by default. -
Optional<Long> limitA limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
-
Returns
-
class Project:Represents an individual project.
-
String idThe identifier, which can be referenced in API endpoints
-
long createdAtThe Unix timestamp (in seconds) of when the project was created.
-
JsonValue; object_ "organization.project"constantThe object type, which is always
organization.projectORGANIZATION_PROJECT("organization.project")
-
Optional<Long> archivedAtThe Unix timestamp (in seconds) of when the project was archived or
null. -
Optional<String> externalKeyIdThe external key associated with the project.
-
Optional<String> nameThe name of the project. This appears in reporting.
-
Optional<String> statusactiveorarchived
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.projects.ProjectListPage;
import com.openai.models.admin.organization.projects.ProjectListParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
ProjectListPage page = client.admin().organization().projects().list();
}
}
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
Project admin().organization().projects().create(ProjectCreateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
post /organization/projects
Create a new project in the organization. Projects can be created and archived, but cannot be deleted.
Parameters
-
ProjectCreateParams params-
String nameThe friendly name of the project, this name appears in reports.
-
Optional<String> externalKeyIdExternal key ID to associate with the project.
-
Optional<String> geographyCreate 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 Project:Represents an individual project.
-
String idThe identifier, which can be referenced in API endpoints
-
long createdAtThe Unix timestamp (in seconds) of when the project was created.
-
JsonValue; object_ "organization.project"constantThe object type, which is always
organization.projectORGANIZATION_PROJECT("organization.project")
-
Optional<Long> archivedAtThe Unix timestamp (in seconds) of when the project was archived or
null. -
Optional<String> externalKeyIdThe external key associated with the project.
-
Optional<String> nameThe name of the project. This appears in reporting.
-
Optional<String> statusactiveorarchived
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.projects.Project;
import com.openai.models.admin.organization.projects.ProjectCreateParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
ProjectCreateParams params = ProjectCreateParams.builder()
.name("name")
.build();
Project project = client.admin().organization().projects().create(params);
}
}
Response
{
"id": "id",
"created_at": 0,
"object": "organization.project",
"archived_at": 0,
"external_key_id": "external_key_id",
"name": "name",
"status": "status"
}
Retrieve project
Project admin().organization().projects().retrieve(ProjectRetrieveParamsparams = ProjectRetrieveParams.none(), RequestOptionsrequestOptions = RequestOptions.none())
get /organization/projects/{project_id}
Retrieves a project.
Parameters
-
ProjectRetrieveParams paramsOptional<String> projectId
Returns
-
class Project:Represents an individual project.
-
String idThe identifier, which can be referenced in API endpoints
-
long createdAtThe Unix timestamp (in seconds) of when the project was created.
-
JsonValue; object_ "organization.project"constantThe object type, which is always
organization.projectORGANIZATION_PROJECT("organization.project")
-
Optional<Long> archivedAtThe Unix timestamp (in seconds) of when the project was archived or
null. -
Optional<String> externalKeyIdThe external key associated with the project.
-
Optional<String> nameThe name of the project. This appears in reporting.
-
Optional<String> statusactiveorarchived
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.projects.Project;
import com.openai.models.admin.organization.projects.ProjectRetrieveParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
Project project = client.admin().organization().projects().retrieve("project_id");
}
}
Response
{
"id": "id",
"created_at": 0,
"object": "organization.project",
"archived_at": 0,
"external_key_id": "external_key_id",
"name": "name",
"status": "status"
}
Modify project
Project admin().organization().projects().update(ProjectUpdateParamsparams = ProjectUpdateParams.none(), RequestOptionsrequestOptions = RequestOptions.none())
post /organization/projects/{project_id}
Modifies a project in the organization.
Parameters
-
ProjectUpdateParams params-
Optional<String> projectId -
Optional<String> externalKeyIdExternal key ID to associate with the project.
-
Optional<String> geographyGeography for the project.
-
Optional<String> nameThe updated name of the project, this name appears in reports.
-
Returns
-
class Project:Represents an individual project.
-
String idThe identifier, which can be referenced in API endpoints
-
long createdAtThe Unix timestamp (in seconds) of when the project was created.
-
JsonValue; object_ "organization.project"constantThe object type, which is always
organization.projectORGANIZATION_PROJECT("organization.project")
-
Optional<Long> archivedAtThe Unix timestamp (in seconds) of when the project was archived or
null. -
Optional<String> externalKeyIdThe external key associated with the project.
-
Optional<String> nameThe name of the project. This appears in reporting.
-
Optional<String> statusactiveorarchived
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.projects.Project;
import com.openai.models.admin.organization.projects.ProjectUpdateParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
Project project = client.admin().organization().projects().update("project_id");
}
}
Response
{
"id": "id",
"created_at": 0,
"object": "organization.project",
"archived_at": 0,
"external_key_id": "external_key_id",
"name": "name",
"status": "status"
}
Archive project
Project admin().organization().projects().archive(ProjectArchiveParamsparams = ProjectArchiveParams.none(), RequestOptionsrequestOptions = RequestOptions.none())
post /organization/projects/{project_id}/archive
Archives a project in the organization. Archived projects cannot be used or updated.
Parameters
-
ProjectArchiveParams paramsOptional<String> projectId
Returns
-
class Project:Represents an individual project.
-
String idThe identifier, which can be referenced in API endpoints
-
long createdAtThe Unix timestamp (in seconds) of when the project was created.
-
JsonValue; object_ "organization.project"constantThe object type, which is always
organization.projectORGANIZATION_PROJECT("organization.project")
-
Optional<Long> archivedAtThe Unix timestamp (in seconds) of when the project was archived or
null. -
Optional<String> externalKeyIdThe external key associated with the project.
-
Optional<String> nameThe name of the project. This appears in reporting.
-
Optional<String> statusactiveorarchived
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.projects.Project;
import com.openai.models.admin.organization.projects.ProjectArchiveParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
Project project = client.admin().organization().projects().archive("project_id");
}
}
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 Project:Represents an individual project.
-
String idThe identifier, which can be referenced in API endpoints
-
long createdAtThe Unix timestamp (in seconds) of when the project was created.
-
JsonValue; object_ "organization.project"constantThe object type, which is always
organization.projectORGANIZATION_PROJECT("organization.project")
-
Optional<Long> archivedAtThe Unix timestamp (in seconds) of when the project was archived or
null. -
Optional<String> externalKeyIdThe external key associated with the project.
-
Optional<String> nameThe name of the project. This appears in reporting.
-
Optional<String> statusactiveorarchived
-
Users
List project users
UserListPage admin().organization().projects().users().list(UserListParamsparams = UserListParams.none(), RequestOptionsrequestOptions = RequestOptions.none())
get /organization/projects/{project_id}/users
Returns a list of users in the project.
Parameters
-
UserListParams params-
Optional<String> projectId -
Optional<String> afterA 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. -
Optional<Long> limitA limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
-
Returns
-
class ProjectUser:Represents an individual user in a project.
-
String idThe identifier, which can be referenced in API endpoints
-
long addedAtThe Unix timestamp (in seconds) of when the project was added.
-
JsonValue; object_ "organization.project.user"constantThe object type, which is always
organization.project.userORGANIZATION_PROJECT_USER("organization.project.user")
-
String roleownerormember -
Optional<String> emailThe email address of the user
-
Optional<String> nameThe name of the user
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.projects.users.UserListPage;
import com.openai.models.admin.organization.projects.users.UserListParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
UserListPage page = client.admin().organization().projects().users().list("project_id");
}
}
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
ProjectUser admin().organization().projects().users().create(UserCreateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
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
-
UserCreateParams params-
Optional<String> projectId -
String roleownerormember -
Optional<String> emailEmail of the user to add.
-
Optional<String> userIdThe ID of the user.
-
Returns
-
class ProjectUser:Represents an individual user in a project.
-
String idThe identifier, which can be referenced in API endpoints
-
long addedAtThe Unix timestamp (in seconds) of when the project was added.
-
JsonValue; object_ "organization.project.user"constantThe object type, which is always
organization.project.userORGANIZATION_PROJECT_USER("organization.project.user")
-
String roleownerormember -
Optional<String> emailThe email address of the user
-
Optional<String> nameThe name of the user
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.projects.users.ProjectUser;
import com.openai.models.admin.organization.projects.users.UserCreateParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
UserCreateParams params = UserCreateParams.builder()
.projectId("project_id")
.role("role")
.build();
ProjectUser projectUser = client.admin().organization().projects().users().create(params);
}
}
Response
{
"id": "id",
"added_at": 0,
"object": "organization.project.user",
"role": "role",
"email": "email",
"name": "name"
}
Retrieve project user
ProjectUser admin().organization().projects().users().retrieve(UserRetrieveParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
get /organization/projects/{project_id}/users/{user_id}
Retrieves a user in the project.
Parameters
-
UserRetrieveParams params-
String projectId -
Optional<String> userId
-
Returns
-
class ProjectUser:Represents an individual user in a project.
-
String idThe identifier, which can be referenced in API endpoints
-
long addedAtThe Unix timestamp (in seconds) of when the project was added.
-
JsonValue; object_ "organization.project.user"constantThe object type, which is always
organization.project.userORGANIZATION_PROJECT_USER("organization.project.user")
-
String roleownerormember -
Optional<String> emailThe email address of the user
-
Optional<String> nameThe name of the user
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.projects.users.ProjectUser;
import com.openai.models.admin.organization.projects.users.UserRetrieveParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
UserRetrieveParams params = UserRetrieveParams.builder()
.projectId("project_id")
.userId("user_id")
.build();
ProjectUser projectUser = client.admin().organization().projects().users().retrieve(params);
}
}
Response
{
"id": "id",
"added_at": 0,
"object": "organization.project.user",
"role": "role",
"email": "email",
"name": "name"
}
Modify project user
ProjectUser admin().organization().projects().users().update(UserUpdateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
post /organization/projects/{project_id}/users/{user_id}
Modifies a user's role in the project.
Parameters
-
UserUpdateParams params-
String projectId -
Optional<String> userId -
Optional<String> roleownerormember
-
Returns
-
class ProjectUser:Represents an individual user in a project.
-
String idThe identifier, which can be referenced in API endpoints
-
long addedAtThe Unix timestamp (in seconds) of when the project was added.
-
JsonValue; object_ "organization.project.user"constantThe object type, which is always
organization.project.userORGANIZATION_PROJECT_USER("organization.project.user")
-
String roleownerormember -
Optional<String> emailThe email address of the user
-
Optional<String> nameThe name of the user
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.projects.users.ProjectUser;
import com.openai.models.admin.organization.projects.users.UserUpdateParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
UserUpdateParams params = UserUpdateParams.builder()
.projectId("project_id")
.userId("user_id")
.build();
ProjectUser projectUser = client.admin().organization().projects().users().update(params);
}
}
Response
{
"id": "id",
"added_at": 0,
"object": "organization.project.user",
"role": "role",
"email": "email",
"name": "name"
}
Delete project user
UserDeleteResponse admin().organization().projects().users().delete(UserDeleteParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
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
-
UserDeleteParams params-
String projectId -
Optional<String> userId
-
Returns
-
class UserDeleteResponse:-
String id -
boolean deleted -
JsonValue; object_ "organization.project.user.deleted"constantORGANIZATION_PROJECT_USER_DELETED("organization.project.user.deleted")
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.projects.users.UserDeleteParams;
import com.openai.models.admin.organization.projects.users.UserDeleteResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
UserDeleteParams params = UserDeleteParams.builder()
.projectId("project_id")
.userId("user_id")
.build();
UserDeleteResponse user = client.admin().organization().projects().users().delete(params);
}
}
Response
{
"id": "id",
"deleted": true,
"object": "organization.project.user.deleted"
}
Domain Types
Project User
-
class ProjectUser:Represents an individual user in a project.
-
String idThe identifier, which can be referenced in API endpoints
-
long addedAtThe Unix timestamp (in seconds) of when the project was added.
-
JsonValue; object_ "organization.project.user"constantThe object type, which is always
organization.project.userORGANIZATION_PROJECT_USER("organization.project.user")
-
String roleownerormember -
Optional<String> emailThe email address of the user
-
Optional<String> nameThe name of the user
-
Roles
List project user role assignments
RoleListPage admin().organization().projects().users().roles().list(RoleListParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
get /projects/{project_id}/users/{user_id}/roles
Lists the project roles assigned to a user within a project.
Parameters
-
RoleListParams params-
String projectId -
Optional<String> userId -
Optional<String> afterCursor for pagination. Provide the value from the previous response's
nextfield to continue listing project roles. -
Optional<Long> limitA limit on the number of project role assignments to return.
-
Optional<Order> orderSort order for the returned project roles.
-
ASC("asc") -
DESC("desc")
-
-
Returns
-
class RoleListResponse:Detailed information about a role assignment entry returned when listing assignments.
-
String idIdentifier for the role.
-
Optional<List<AssignmentSource>> assignmentSourcesPrincipals from which the role assignment is inherited, when available.
-
String principalId -
String principalType
-
-
Optional<Long> createdAtWhen the role was created.
-
Optional<String> createdByIdentifier of the actor who created the role.
-
Optional<CreatedByUserObj> createdByUserObjUser details for the actor that created the role, when available.
-
Optional<String> descriptionDescription of the role.
-
Optional<Metadata> metadataArbitrary metadata stored on the role.
-
String nameName of the role.
-
List<String> permissionsPermissions associated with the role.
-
boolean predefinedRoleWhether the role is predefined by OpenAI.
-
String resourceTypeResource type the role applies to.
-
Optional<Long> updatedAtWhen the role was last updated.
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.projects.users.roles.RoleListPage;
import com.openai.models.admin.organization.projects.users.roles.RoleListParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
RoleListParams params = RoleListParams.builder()
.projectId("project_id")
.userId("user_id")
.build();
RoleListPage page = client.admin().organization().projects().users().roles().list(params);
}
}
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
RoleCreateResponse admin().organization().projects().users().roles().create(RoleCreateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
post /projects/{project_id}/users/{user_id}/roles
Assigns a project role to a user within a project.
Parameters
-
RoleCreateParams params-
String projectId -
Optional<String> userId -
String roleIdIdentifier of the role to assign.
-
Returns
-
class RoleCreateResponse:Role assignment linking a user to a role.
-
JsonValue; object_ "user.role"constantAlways
user.role.USER_ROLE("user.role")
-
Role roleDetails about a role that can be assigned through the public Roles API.
-
String idIdentifier for the role.
-
Optional<String> descriptionOptional description of the role.
-
String nameUnique name for the role.
-
JsonValue; object_ "role"constantAlways
role.ROLE("role")
-
List<String> permissionsPermissions granted by the role.
-
boolean predefinedRoleWhether the role is predefined and managed by OpenAI.
-
String resourceTypeResource type the role is bound to (for example
api.organizationorapi.project).
-
-
OrganizationUser userRepresents an individual
userwithin an organization.-
String idThe identifier, which can be referenced in API endpoints
-
long addedAtThe Unix timestamp (in seconds) of when the user was added.
-
JsonValue; object_ "organization.user"constantThe object type, which is always
organization.userORGANIZATION_USER("organization.user")
-
Optional<Long> apiKeyLastUsedAtThe Unix timestamp (in seconds) of the user's last API key usage.
-
Optional<Long> createdThe Unix timestamp (in seconds) of when the user was created.
-
Optional<String> developerPersonaThe developer persona metadata for the user.
-
Optional<String> emailThe email address of the user
-
Optional<Boolean> isDefaultWhether this is the organization's default user.
-
Optional<Boolean> isScaleTierAuthorizedPurchaserWhether the user is an authorized purchaser for Scale Tier.
-
Optional<Boolean> isScimManagedWhether the user is managed through SCIM.
-
Optional<Boolean> isServiceAccountWhether the user is a service account.
-
Optional<String> nameThe name of the user
-
Optional<Projects> projectsProjects associated with the user, if included.
-
List<Data> data-
Optional<String> id -
Optional<String> name -
Optional<String> role
-
-
JsonValue; object_ "list"constantLIST("list")
-
-
Optional<String> roleownerorreader -
Optional<String> technicalLevelThe technical level metadata for the user.
-
Optional<User> userNested user details.
-
String id -
JsonValue; object_ "user"constantUSER("user")
-
Optional<Boolean> banned -
Optional<Long> bannedAt -
Optional<String> email -
Optional<Boolean> enabled -
Optional<String> name -
Optional<String> picture
-
-
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.projects.users.roles.RoleCreateParams;
import com.openai.models.admin.organization.projects.users.roles.RoleCreateResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
RoleCreateParams params = RoleCreateParams.builder()
.projectId("project_id")
.userId("user_id")
.roleId("role_id")
.build();
RoleCreateResponse role = client.admin().organization().projects().users().roles().create(params);
}
}
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
RoleRetrieveResponse admin().organization().projects().users().roles().retrieve(RoleRetrieveParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
get /projects/{project_id}/users/{user_id}/roles/{role_id}
Retrieves a project role assigned to a user.
Parameters
-
RoleRetrieveParams params-
String projectId -
String userId -
Optional<String> roleId
-
Returns
-
class RoleRetrieveResponse:Detailed information about a role assignment entry returned when listing assignments.
-
String idIdentifier for the role.
-
Optional<List<AssignmentSource>> assignmentSourcesPrincipals from which the role assignment is inherited, when available.
-
String principalId -
String principalType
-
-
Optional<Long> createdAtWhen the role was created.
-
Optional<String> createdByIdentifier of the actor who created the role.
-
Optional<CreatedByUserObj> createdByUserObjUser details for the actor that created the role, when available.
-
Optional<String> descriptionDescription of the role.
-
Optional<Metadata> metadataArbitrary metadata stored on the role.
-
String nameName of the role.
-
List<String> permissionsPermissions associated with the role.
-
boolean predefinedRoleWhether the role is predefined by OpenAI.
-
String resourceTypeResource type the role applies to.
-
Optional<Long> updatedAtWhen the role was last updated.
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.projects.users.roles.RoleRetrieveParams;
import com.openai.models.admin.organization.projects.users.roles.RoleRetrieveResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
RoleRetrieveParams params = RoleRetrieveParams.builder()
.projectId("project_id")
.userId("user_id")
.roleId("role_id")
.build();
RoleRetrieveResponse role = client.admin().organization().projects().users().roles().retrieve(params);
}
}
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
RoleDeleteResponse admin().organization().projects().users().roles().delete(RoleDeleteParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
delete /projects/{project_id}/users/{user_id}/roles/{role_id}
Unassigns a project role from a user within a project.
Parameters
-
RoleDeleteParams params-
String projectId -
String userId -
Optional<String> roleId
-
Returns
-
class RoleDeleteResponse:Confirmation payload returned after unassigning a role.
-
boolean deletedWhether the assignment was removed.
-
String object_Identifier for the deleted assignment, such as
group.role.deletedoruser.role.deleted.
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.projects.users.roles.RoleDeleteParams;
import com.openai.models.admin.organization.projects.users.roles.RoleDeleteResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
RoleDeleteParams params = RoleDeleteParams.builder()
.projectId("project_id")
.userId("user_id")
.roleId("role_id")
.build();
RoleDeleteResponse role = client.admin().organization().projects().users().roles().delete(params);
}
}
Response
{
"deleted": true,
"object": "object"
}
Service Accounts
List project service accounts
ServiceAccountListPage admin().organization().projects().serviceAccounts().list(ServiceAccountListParamsparams = ServiceAccountListParams.none(), RequestOptionsrequestOptions = RequestOptions.none())
get /organization/projects/{project_id}/service_accounts
Returns a list of service accounts in the project.
Parameters
-
ServiceAccountListParams params-
Optional<String> projectId -
Optional<String> afterA 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. -
Optional<Long> limitA limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
-
Returns
-
class ProjectServiceAccount:Represents an individual service account in a project.
-
String idThe identifier, which can be referenced in API endpoints
-
long createdAtThe Unix timestamp (in seconds) of when the service account was created
-
String nameThe name of the service account
-
JsonValue; object_ "organization.project.service_account"constantThe object type, which is always
organization.project.service_accountORGANIZATION_PROJECT_SERVICE_ACCOUNT("organization.project.service_account")
-
Role roleownerormember-
OWNER("owner") -
MEMBER("member")
-
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.projects.serviceaccounts.ServiceAccountListPage;
import com.openai.models.admin.organization.projects.serviceaccounts.ServiceAccountListParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
ServiceAccountListPage page = client.admin().organization().projects().serviceAccounts().list("project_id");
}
}
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
ServiceAccountCreateResponse admin().organization().projects().serviceAccounts().create(ServiceAccountCreateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
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
-
ServiceAccountCreateParams params-
Optional<String> projectId -
String nameThe name of the service account being created.
-
Returns
-
class ServiceAccountCreateResponse:-
String id -
Optional<ApiKey> apiKey-
String id -
long createdAt -
String name -
JsonValue; object_ "organization.project.service_account.api_key"constantThe object type, which is always
organization.project.service_account.api_keyORGANIZATION_PROJECT_SERVICE_ACCOUNT_API_KEY("organization.project.service_account.api_key")
-
String value
-
-
long createdAt -
String name -
JsonValue; object_ "organization.project.service_account"constantORGANIZATION_PROJECT_SERVICE_ACCOUNT("organization.project.service_account")
-
JsonValue; role "member"constantService accounts can only have one role of type
memberMEMBER("member")
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.projects.serviceaccounts.ServiceAccountCreateParams;
import com.openai.models.admin.organization.projects.serviceaccounts.ServiceAccountCreateResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
ServiceAccountCreateParams params = ServiceAccountCreateParams.builder()
.projectId("project_id")
.name("name")
.build();
ServiceAccountCreateResponse serviceAccount = client.admin().organization().projects().serviceAccounts().create(params);
}
}
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
ProjectServiceAccount admin().organization().projects().serviceAccounts().retrieve(ServiceAccountRetrieveParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
get /organization/projects/{project_id}/service_accounts/{service_account_id}
Retrieves a service account in the project.
Parameters
-
ServiceAccountRetrieveParams params-
String projectId -
Optional<String> serviceAccountId
-
Returns
-
class ProjectServiceAccount:Represents an individual service account in a project.
-
String idThe identifier, which can be referenced in API endpoints
-
long createdAtThe Unix timestamp (in seconds) of when the service account was created
-
String nameThe name of the service account
-
JsonValue; object_ "organization.project.service_account"constantThe object type, which is always
organization.project.service_accountORGANIZATION_PROJECT_SERVICE_ACCOUNT("organization.project.service_account")
-
Role roleownerormember-
OWNER("owner") -
MEMBER("member")
-
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.projects.serviceaccounts.ProjectServiceAccount;
import com.openai.models.admin.organization.projects.serviceaccounts.ServiceAccountRetrieveParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
ServiceAccountRetrieveParams params = ServiceAccountRetrieveParams.builder()
.projectId("project_id")
.serviceAccountId("service_account_id")
.build();
ProjectServiceAccount projectServiceAccount = client.admin().organization().projects().serviceAccounts().retrieve(params);
}
}
Response
{
"id": "id",
"created_at": 0,
"name": "name",
"object": "organization.project.service_account",
"role": "owner"
}
Update project service account
ProjectServiceAccount admin().organization().projects().serviceAccounts().update(ServiceAccountUpdateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
post /organization/projects/{project_id}/service_accounts/{service_account_id}
Updates a service account in the project.
Parameters
-
ServiceAccountUpdateParams params-
String projectId -
Optional<String> serviceAccountId -
Optional<String> nameThe updated service account name.
-
Optional<Role> roleThe updated service account role.
-
MEMBER("member") -
OWNER("owner")
-
-
Returns
-
class ProjectServiceAccount:Represents an individual service account in a project.
-
String idThe identifier, which can be referenced in API endpoints
-
long createdAtThe Unix timestamp (in seconds) of when the service account was created
-
String nameThe name of the service account
-
JsonValue; object_ "organization.project.service_account"constantThe object type, which is always
organization.project.service_accountORGANIZATION_PROJECT_SERVICE_ACCOUNT("organization.project.service_account")
-
Role roleownerormember-
OWNER("owner") -
MEMBER("member")
-
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.projects.serviceaccounts.ProjectServiceAccount;
import com.openai.models.admin.organization.projects.serviceaccounts.ServiceAccountUpdateParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
ServiceAccountUpdateParams params = ServiceAccountUpdateParams.builder()
.projectId("project_id")
.serviceAccountId("service_account_id")
.build();
ProjectServiceAccount projectServiceAccount = client.admin().organization().projects().serviceAccounts().update(params);
}
}
Response
{
"id": "id",
"created_at": 0,
"name": "name",
"object": "organization.project.service_account",
"role": "owner"
}
Delete project service account
ServiceAccountDeleteResponse admin().organization().projects().serviceAccounts().delete(ServiceAccountDeleteParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
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
-
ServiceAccountDeleteParams params-
String projectId -
Optional<String> serviceAccountId
-
Returns
-
class ServiceAccountDeleteResponse:-
String id -
boolean deleted -
JsonValue; object_ "organization.project.service_account.deleted"constantORGANIZATION_PROJECT_SERVICE_ACCOUNT_DELETED("organization.project.service_account.deleted")
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.projects.serviceaccounts.ServiceAccountDeleteParams;
import com.openai.models.admin.organization.projects.serviceaccounts.ServiceAccountDeleteResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
ServiceAccountDeleteParams params = ServiceAccountDeleteParams.builder()
.projectId("project_id")
.serviceAccountId("service_account_id")
.build();
ServiceAccountDeleteResponse serviceAccount = client.admin().organization().projects().serviceAccounts().delete(params);
}
}
Response
{
"id": "id",
"deleted": true,
"object": "organization.project.service_account.deleted"
}
Domain Types
Project Service Account
-
class ProjectServiceAccount:Represents an individual service account in a project.
-
String idThe identifier, which can be referenced in API endpoints
-
long createdAtThe Unix timestamp (in seconds) of when the service account was created
-
String nameThe name of the service account
-
JsonValue; object_ "organization.project.service_account"constantThe object type, which is always
organization.project.service_accountORGANIZATION_PROJECT_SERVICE_ACCOUNT("organization.project.service_account")
-
Role roleownerormember-
OWNER("owner") -
MEMBER("member")
-
-
API Keys
List project API keys
ApiKeyListPage admin().organization().projects().apiKeys().list(ApiKeyListParamsparams = ApiKeyListParams.none(), RequestOptionsrequestOptions = RequestOptions.none())
get /organization/projects/{project_id}/api_keys
Returns a list of API keys in the project.
Parameters
-
ApiKeyListParams params-
Optional<String> projectId -
Optional<String> afterA 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. -
Optional<Long> limitA limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
-
Returns
-
class ProjectApiKey:Represents an individual API key in a project.
-
String idThe identifier, which can be referenced in API endpoints
-
long createdAtThe Unix timestamp (in seconds) of when the API key was created
-
Optional<Long> lastUsedAtThe Unix timestamp (in seconds) of when the API key was last used.
-
String nameThe name of the API key
-
JsonValue; object_ "organization.project.api_key"constantThe object type, which is always
organization.project.api_keyORGANIZATION_PROJECT_API_KEY("organization.project.api_key")
-
Owner owner-
Optional<ServiceAccount> serviceAccountThe service account that owns a project API key.
-
String idThe identifier, which can be referenced in API endpoints
-
long createdAtThe Unix timestamp (in seconds) of when the service account was created.
-
String nameThe name of the service account.
-
String roleThe service account's project role.
-
-
Optional<Type> typeuserorservice_account-
USER("user") -
SERVICE_ACCOUNT("service_account")
-
-
Optional<User> userThe user that owns a project API key.
-
String idThe identifier, which can be referenced in API endpoints
-
long createdAtThe Unix timestamp (in seconds) of when the user was created.
-
String emailThe email address of the user.
-
String nameThe name of the user.
-
String roleThe user's project role.
-
-
-
String redactedValueThe redacted value of the API key
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.projects.apikeys.ApiKeyListPage;
import com.openai.models.admin.organization.projects.apikeys.ApiKeyListParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
ApiKeyListPage page = client.admin().organization().projects().apiKeys().list("project_id");
}
}
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
ProjectApiKey admin().organization().projects().apiKeys().retrieve(ApiKeyRetrieveParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
get /organization/projects/{project_id}/api_keys/{api_key_id}
Retrieves an API key in the project.
Parameters
-
ApiKeyRetrieveParams params-
String projectId -
Optional<String> apiKeyId
-
Returns
-
class ProjectApiKey:Represents an individual API key in a project.
-
String idThe identifier, which can be referenced in API endpoints
-
long createdAtThe Unix timestamp (in seconds) of when the API key was created
-
Optional<Long> lastUsedAtThe Unix timestamp (in seconds) of when the API key was last used.
-
String nameThe name of the API key
-
JsonValue; object_ "organization.project.api_key"constantThe object type, which is always
organization.project.api_keyORGANIZATION_PROJECT_API_KEY("organization.project.api_key")
-
Owner owner-
Optional<ServiceAccount> serviceAccountThe service account that owns a project API key.
-
String idThe identifier, which can be referenced in API endpoints
-
long createdAtThe Unix timestamp (in seconds) of when the service account was created.
-
String nameThe name of the service account.
-
String roleThe service account's project role.
-
-
Optional<Type> typeuserorservice_account-
USER("user") -
SERVICE_ACCOUNT("service_account")
-
-
Optional<User> userThe user that owns a project API key.
-
String idThe identifier, which can be referenced in API endpoints
-
long createdAtThe Unix timestamp (in seconds) of when the user was created.
-
String emailThe email address of the user.
-
String nameThe name of the user.
-
String roleThe user's project role.
-
-
-
String redactedValueThe redacted value of the API key
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.projects.apikeys.ApiKeyRetrieveParams;
import com.openai.models.admin.organization.projects.apikeys.ProjectApiKey;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
ApiKeyRetrieveParams params = ApiKeyRetrieveParams.builder()
.projectId("project_id")
.apiKeyId("api_key_id")
.build();
ProjectApiKey projectApiKey = client.admin().organization().projects().apiKeys().retrieve(params);
}
}
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
ApiKeyDeleteResponse admin().organization().projects().apiKeys().delete(ApiKeyDeleteParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
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
-
ApiKeyDeleteParams params-
String projectId -
Optional<String> apiKeyId
-
Returns
-
class ApiKeyDeleteResponse:-
String id -
boolean deleted -
JsonValue; object_ "organization.project.api_key.deleted"constantORGANIZATION_PROJECT_API_KEY_DELETED("organization.project.api_key.deleted")
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.projects.apikeys.ApiKeyDeleteParams;
import com.openai.models.admin.organization.projects.apikeys.ApiKeyDeleteResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
ApiKeyDeleteParams params = ApiKeyDeleteParams.builder()
.projectId("project_id")
.apiKeyId("api_key_id")
.build();
ApiKeyDeleteResponse apiKey = client.admin().organization().projects().apiKeys().delete(params);
}
}
Response
{
"id": "id",
"deleted": true,
"object": "organization.project.api_key.deleted"
}
Domain Types
Project API Key
-
class ProjectApiKey:Represents an individual API key in a project.
-
String idThe identifier, which can be referenced in API endpoints
-
long createdAtThe Unix timestamp (in seconds) of when the API key was created
-
Optional<Long> lastUsedAtThe Unix timestamp (in seconds) of when the API key was last used.
-
String nameThe name of the API key
-
JsonValue; object_ "organization.project.api_key"constantThe object type, which is always
organization.project.api_keyORGANIZATION_PROJECT_API_KEY("organization.project.api_key")
-
Owner owner-
Optional<ServiceAccount> serviceAccountThe service account that owns a project API key.
-
String idThe identifier, which can be referenced in API endpoints
-
long createdAtThe Unix timestamp (in seconds) of when the service account was created.
-
String nameThe name of the service account.
-
String roleThe service account's project role.
-
-
Optional<Type> typeuserorservice_account-
USER("user") -
SERVICE_ACCOUNT("service_account")
-
-
Optional<User> userThe user that owns a project API key.
-
String idThe identifier, which can be referenced in API endpoints
-
long createdAtThe Unix timestamp (in seconds) of when the user was created.
-
String emailThe email address of the user.
-
String nameThe name of the user.
-
String roleThe user's project role.
-
-
-
String redactedValueThe redacted value of the API key
-
Rate Limits
List project rate limits
RateLimitListRateLimitsPage admin().organization().projects().rateLimits().listRateLimits(RateLimitListRateLimitsParamsparams = RateLimitListRateLimitsParams.none(), RequestOptionsrequestOptions = RequestOptions.none())
get /organization/projects/{project_id}/rate_limits
Returns the rate limits per model for a project.
Parameters
-
RateLimitListRateLimitsParams params-
Optional<String> projectId -
Optional<String> afterA 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. -
Optional<String> beforeA 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. -
Optional<Long> limitA limit on the number of objects to be returned. The default is 100.
-
Returns
-
class ProjectRateLimit:Represents a project rate limit config.
-
String idThe identifier, which can be referenced in API endpoints.
-
long maxRequestsPer1MinuteThe maximum requests per minute.
-
long maxTokensPer1MinuteThe maximum tokens per minute.
-
String modelThe model this rate limit applies to.
-
JsonValue; object_ "project.rate_limit"constantThe object type, which is always
project.rate_limitPROJECT_RATE_LIMIT("project.rate_limit")
-
Optional<Long> batch1DayMaxInputTokensThe maximum batch input tokens per day. Only present for relevant models.
-
Optional<Long> maxAudioMegabytesPer1MinuteThe maximum audio megabytes per minute. Only present for relevant models.
-
Optional<Long> maxImagesPer1MinuteThe maximum images per minute. Only present for relevant models.
-
Optional<Long> maxRequestsPer1DayThe maximum requests per day. Only present for relevant models.
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.projects.ratelimits.RateLimitListRateLimitsPage;
import com.openai.models.admin.organization.projects.ratelimits.RateLimitListRateLimitsParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
RateLimitListRateLimitsPage page = client.admin().organization().projects().rateLimits().listRateLimits("project_id");
}
}
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
ProjectRateLimit admin().organization().projects().rateLimits().updateRateLimit(RateLimitUpdateRateLimitParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
post /organization/projects/{project_id}/rate_limits/{rate_limit_id}
Updates a project rate limit.
Parameters
-
RateLimitUpdateRateLimitParams params-
String projectId -
Optional<String> rateLimitId -
Optional<Long> batch1DayMaxInputTokensThe maximum batch input tokens per day. Only relevant for certain models.
-
Optional<Long> maxAudioMegabytesPer1MinuteThe maximum audio megabytes per minute. Only relevant for certain models.
-
Optional<Long> maxImagesPer1MinuteThe maximum images per minute. Only relevant for certain models.
-
Optional<Long> maxRequestsPer1DayThe maximum requests per day. Only relevant for certain models.
-
Optional<Long> maxRequestsPer1MinuteThe maximum requests per minute.
-
Optional<Long> maxTokensPer1MinuteThe maximum tokens per minute.
-
Returns
-
class ProjectRateLimit:Represents a project rate limit config.
-
String idThe identifier, which can be referenced in API endpoints.
-
long maxRequestsPer1MinuteThe maximum requests per minute.
-
long maxTokensPer1MinuteThe maximum tokens per minute.
-
String modelThe model this rate limit applies to.
-
JsonValue; object_ "project.rate_limit"constantThe object type, which is always
project.rate_limitPROJECT_RATE_LIMIT("project.rate_limit")
-
Optional<Long> batch1DayMaxInputTokensThe maximum batch input tokens per day. Only present for relevant models.
-
Optional<Long> maxAudioMegabytesPer1MinuteThe maximum audio megabytes per minute. Only present for relevant models.
-
Optional<Long> maxImagesPer1MinuteThe maximum images per minute. Only present for relevant models.
-
Optional<Long> maxRequestsPer1DayThe maximum requests per day. Only present for relevant models.
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.projects.ratelimits.ProjectRateLimit;
import com.openai.models.admin.organization.projects.ratelimits.RateLimitUpdateRateLimitParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
RateLimitUpdateRateLimitParams params = RateLimitUpdateRateLimitParams.builder()
.projectId("project_id")
.rateLimitId("rate_limit_id")
.build();
ProjectRateLimit projectRateLimit = client.admin().organization().projects().rateLimits().updateRateLimit(params);
}
}
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 ProjectRateLimit:Represents a project rate limit config.
-
String idThe identifier, which can be referenced in API endpoints.
-
long maxRequestsPer1MinuteThe maximum requests per minute.
-
long maxTokensPer1MinuteThe maximum tokens per minute.
-
String modelThe model this rate limit applies to.
-
JsonValue; object_ "project.rate_limit"constantThe object type, which is always
project.rate_limitPROJECT_RATE_LIMIT("project.rate_limit")
-
Optional<Long> batch1DayMaxInputTokensThe maximum batch input tokens per day. Only present for relevant models.
-
Optional<Long> maxAudioMegabytesPer1MinuteThe maximum audio megabytes per minute. Only present for relevant models.
-
Optional<Long> maxImagesPer1MinuteThe maximum images per minute. Only present for relevant models.
-
Optional<Long> maxRequestsPer1DayThe maximum requests per day. Only present for relevant models.
-
Model Permissions
Retrieve project model permissions
ProjectModelPermissions admin().organization().projects().modelPermissions().retrieve(ModelPermissionRetrieveParamsparams = ModelPermissionRetrieveParams.none(), RequestOptionsrequestOptions = RequestOptions.none())
get /organization/projects/{project_id}/model_permissions
Returns model permissions for a project.
Parameters
-
ModelPermissionRetrieveParams paramsOptional<String> projectId
Returns
-
class ProjectModelPermissions:Represents the model allowlist or denylist policy for a project.
-
Mode modeWhether the project uses an allowlist or a denylist.
-
ALLOW_LIST("allow_list") -
DENY_LIST("deny_list")
-
-
List<String> modelIdsThe model IDs included in the model permissions policy.
-
JsonValue; object_ "project.model_permissions"constantThe object type, which is always
project.model_permissions.PROJECT_MODEL_PERMISSIONS("project.model_permissions")
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.projects.modelpermissions.ModelPermissionRetrieveParams;
import com.openai.models.admin.organization.projects.modelpermissions.ProjectModelPermissions;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
ProjectModelPermissions projectModelPermissions = client.admin().organization().projects().modelPermissions().retrieve("project_id");
}
}
Response
{
"mode": "allow_list",
"model_ids": [
"string"
],
"object": "project.model_permissions"
}
Modify project model permissions
ProjectModelPermissions admin().organization().projects().modelPermissions().update(ModelPermissionUpdateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
post /organization/projects/{project_id}/model_permissions
Updates model permissions for a project.
Parameters
-
ModelPermissionUpdateParams params-
Optional<String> projectId -
Mode modeThe model permissions mode to apply.
-
ALLOW_LIST("allow_list") -
DENY_LIST("deny_list")
-
-
List<String> modelIdsThe model IDs included in this permissions policy.
-
Returns
-
class ProjectModelPermissions:Represents the model allowlist or denylist policy for a project.
-
Mode modeWhether the project uses an allowlist or a denylist.
-
ALLOW_LIST("allow_list") -
DENY_LIST("deny_list")
-
-
List<String> modelIdsThe model IDs included in the model permissions policy.
-
JsonValue; object_ "project.model_permissions"constantThe object type, which is always
project.model_permissions.PROJECT_MODEL_PERMISSIONS("project.model_permissions")
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.projects.modelpermissions.ModelPermissionUpdateParams;
import com.openai.models.admin.organization.projects.modelpermissions.ProjectModelPermissions;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
ModelPermissionUpdateParams params = ModelPermissionUpdateParams.builder()
.projectId("project_id")
.mode(ModelPermissionUpdateParams.Mode.ALLOW_LIST)
.addModelId("string")
.build();
ProjectModelPermissions projectModelPermissions = client.admin().organization().projects().modelPermissions().update(params);
}
}
Response
{
"mode": "allow_list",
"model_ids": [
"string"
],
"object": "project.model_permissions"
}
Delete project model permissions
ProjectModelPermissionsDeleted admin().organization().projects().modelPermissions().delete(ModelPermissionDeleteParamsparams = ModelPermissionDeleteParams.none(), RequestOptionsrequestOptions = RequestOptions.none())
delete /organization/projects/{project_id}/model_permissions
Deletes model permissions for a project.
Parameters
-
ModelPermissionDeleteParams paramsOptional<String> projectId
Returns
-
class ProjectModelPermissionsDeleted:Confirmation payload returned after deleting project model permissions.
-
boolean deletedWhether the project model permissions were deleted.
-
JsonValue; object_ "project.model_permissions.deleted"constantThe object type, which is always
project.model_permissions.deleted.PROJECT_MODEL_PERMISSIONS_DELETED("project.model_permissions.deleted")
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.projects.modelpermissions.ModelPermissionDeleteParams;
import com.openai.models.admin.organization.projects.modelpermissions.ProjectModelPermissionsDeleted;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
ProjectModelPermissionsDeleted projectModelPermissionsDeleted = client.admin().organization().projects().modelPermissions().delete("project_id");
}
}
Response
{
"deleted": true,
"object": "project.model_permissions.deleted"
}
Domain Types
Project Model Permissions
-
class ProjectModelPermissions:Represents the model allowlist or denylist policy for a project.
-
Mode modeWhether the project uses an allowlist or a denylist.
-
ALLOW_LIST("allow_list") -
DENY_LIST("deny_list")
-
-
List<String> modelIdsThe model IDs included in the model permissions policy.
-
JsonValue; object_ "project.model_permissions"constantThe object type, which is always
project.model_permissions.PROJECT_MODEL_PERMISSIONS("project.model_permissions")
-
Project Model Permissions Deleted
-
class ProjectModelPermissionsDeleted:Confirmation payload returned after deleting project model permissions.
-
boolean deletedWhether the project model permissions were deleted.
-
JsonValue; object_ "project.model_permissions.deleted"constantThe object type, which is always
project.model_permissions.deleted.PROJECT_MODEL_PERMISSIONS_DELETED("project.model_permissions.deleted")
-
Hosted Tool Permissions
Retrieve project hosted tool permissions
ProjectHostedToolPermissions admin().organization().projects().hostedToolPermissions().retrieve(HostedToolPermissionRetrieveParamsparams = HostedToolPermissionRetrieveParams.none(), RequestOptionsrequestOptions = RequestOptions.none())
get /organization/projects/{project_id}/hosted_tool_permissions
Returns hosted tool permissions for a project.
Parameters
-
HostedToolPermissionRetrieveParams paramsOptional<String> projectId
Returns
-
class ProjectHostedToolPermissions:Represents hosted tool permissions for a project.
-
CodeInterpreter codeInterpreterPermission state for a single hosted tool on a project.
-
boolean enabledWhether the hosted tool is enabled for the project.
-
-
FileSearch fileSearchPermission state for a single hosted tool on a project.
-
boolean enabledWhether the hosted tool is enabled for the project.
-
-
ImageGeneration imageGenerationPermission state for a single hosted tool on a project.
-
boolean enabledWhether the hosted tool is enabled for the project.
-
-
Mcp mcpPermission state for a single hosted tool on a project.
-
boolean enabledWhether the hosted tool is enabled for the project.
-
-
WebSearch webSearchPermission state for a single hosted tool on a project.
-
boolean enabledWhether the hosted tool is enabled for the project.
-
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.projects.hostedtoolpermissions.HostedToolPermissionRetrieveParams;
import com.openai.models.admin.organization.projects.hostedtoolpermissions.ProjectHostedToolPermissions;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
ProjectHostedToolPermissions projectHostedToolPermissions = client.admin().organization().projects().hostedToolPermissions().retrieve("project_id");
}
}
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
ProjectHostedToolPermissions admin().organization().projects().hostedToolPermissions().update(HostedToolPermissionUpdateParamsparams = HostedToolPermissionUpdateParams.none(), RequestOptionsrequestOptions = RequestOptions.none())
post /organization/projects/{project_id}/hosted_tool_permissions
Updates hosted tool permissions for a project.
Parameters
-
HostedToolPermissionUpdateParams params-
Optional<String> projectId -
Optional<CodeInterpreter> codeInterpreterThe code interpreter permission update.
-
boolean enabledWhether to enable the hosted tool for the project.
-
-
Optional<FileSearch> fileSearchThe file search permission update.
-
boolean enabledWhether to enable the hosted tool for the project.
-
-
Optional<ImageGeneration> imageGenerationThe image generation permission update.
-
boolean enabledWhether to enable the hosted tool for the project.
-
-
Optional<Mcp> mcpThe MCP permission update.
-
boolean enabledWhether to enable the hosted tool for the project.
-
-
Optional<WebSearch> webSearchThe web search permission update.
-
boolean enabledWhether to enable the hosted tool for the project.
-
-
Returns
-
class ProjectHostedToolPermissions:Represents hosted tool permissions for a project.
-
CodeInterpreter codeInterpreterPermission state for a single hosted tool on a project.
-
boolean enabledWhether the hosted tool is enabled for the project.
-
-
FileSearch fileSearchPermission state for a single hosted tool on a project.
-
boolean enabledWhether the hosted tool is enabled for the project.
-
-
ImageGeneration imageGenerationPermission state for a single hosted tool on a project.
-
boolean enabledWhether the hosted tool is enabled for the project.
-
-
Mcp mcpPermission state for a single hosted tool on a project.
-
boolean enabledWhether the hosted tool is enabled for the project.
-
-
WebSearch webSearchPermission state for a single hosted tool on a project.
-
boolean enabledWhether the hosted tool is enabled for the project.
-
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.projects.hostedtoolpermissions.HostedToolPermissionUpdateParams;
import com.openai.models.admin.organization.projects.hostedtoolpermissions.ProjectHostedToolPermissions;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
ProjectHostedToolPermissions projectHostedToolPermissions = client.admin().organization().projects().hostedToolPermissions().update("project_id");
}
}
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 ProjectHostedToolPermissions:Represents hosted tool permissions for a project.
-
CodeInterpreter codeInterpreterPermission state for a single hosted tool on a project.
-
boolean enabledWhether the hosted tool is enabled for the project.
-
-
FileSearch fileSearchPermission state for a single hosted tool on a project.
-
boolean enabledWhether the hosted tool is enabled for the project.
-
-
ImageGeneration imageGenerationPermission state for a single hosted tool on a project.
-
boolean enabledWhether the hosted tool is enabled for the project.
-
-
Mcp mcpPermission state for a single hosted tool on a project.
-
boolean enabledWhether the hosted tool is enabled for the project.
-
-
WebSearch webSearchPermission state for a single hosted tool on a project.
-
boolean enabledWhether the hosted tool is enabled for the project.
-
-
Groups
List project groups
GroupListPage admin().organization().projects().groups().list(GroupListParamsparams = GroupListParams.none(), RequestOptionsrequestOptions = RequestOptions.none())
get /organization/projects/{project_id}/groups
Lists the groups that have access to a project.
Parameters
-
GroupListParams params-
Optional<String> projectId -
Optional<String> afterCursor for pagination. Provide the ID of the last group from the previous response to fetch the next page.
-
Optional<Long> limitA limit on the number of project groups to return. Defaults to 20.
-
Optional<Order> orderSort order for the returned groups.
-
ASC("asc") -
DESC("desc")
-
-
Returns
-
class ProjectGroup:Details about a group's membership in a project.
-
long createdAtUnix timestamp (in seconds) when the group was granted project access.
-
String groupIdIdentifier of the group that has access to the project.
-
String groupNameDisplay name of the group.
-
GroupType groupTypeThe type of the group.
-
GROUP("group") -
TENANT_GROUP("tenant_group")
-
-
JsonValue; object_ "project.group"constantAlways
project.group.PROJECT_GROUP("project.group")
-
String projectIdIdentifier of the project.
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.projects.groups.GroupListPage;
import com.openai.models.admin.organization.projects.groups.GroupListParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
GroupListPage page = client.admin().organization().projects().groups().list("project_id");
}
}
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
ProjectGroup admin().organization().projects().groups().create(GroupCreateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
post /organization/projects/{project_id}/groups
Grants a group access to a project.
Parameters
-
GroupCreateParams params-
Optional<String> projectId -
String groupIdIdentifier of the group to add to the project.
-
String roleIdentifier of the project role to grant to the group.
-
Returns
-
class ProjectGroup:Details about a group's membership in a project.
-
long createdAtUnix timestamp (in seconds) when the group was granted project access.
-
String groupIdIdentifier of the group that has access to the project.
-
String groupNameDisplay name of the group.
-
GroupType groupTypeThe type of the group.
-
GROUP("group") -
TENANT_GROUP("tenant_group")
-
-
JsonValue; object_ "project.group"constantAlways
project.group.PROJECT_GROUP("project.group")
-
String projectIdIdentifier of the project.
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.projects.groups.GroupCreateParams;
import com.openai.models.admin.organization.projects.groups.ProjectGroup;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
GroupCreateParams params = GroupCreateParams.builder()
.projectId("project_id")
.groupId("group_id")
.role("role")
.build();
ProjectGroup projectGroup = client.admin().organization().projects().groups().create(params);
}
}
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
ProjectGroup admin().organization().projects().groups().retrieve(GroupRetrieveParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
get /organization/projects/{project_id}/groups/{group_id}
Retrieves a project's group.
Parameters
-
GroupRetrieveParams params-
String projectId -
Optional<String> groupId -
Optional<GroupType> groupTypeThe type of group to retrieve.
-
GROUP("group") -
TENANT_GROUP("tenant_group")
-
-
Returns
-
class ProjectGroup:Details about a group's membership in a project.
-
long createdAtUnix timestamp (in seconds) when the group was granted project access.
-
String groupIdIdentifier of the group that has access to the project.
-
String groupNameDisplay name of the group.
-
GroupType groupTypeThe type of the group.
-
GROUP("group") -
TENANT_GROUP("tenant_group")
-
-
JsonValue; object_ "project.group"constantAlways
project.group.PROJECT_GROUP("project.group")
-
String projectIdIdentifier of the project.
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.projects.groups.GroupRetrieveParams;
import com.openai.models.admin.organization.projects.groups.ProjectGroup;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
GroupRetrieveParams params = GroupRetrieveParams.builder()
.projectId("project_id")
.groupId("group_id")
.build();
ProjectGroup projectGroup = client.admin().organization().projects().groups().retrieve(params);
}
}
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
GroupDeleteResponse admin().organization().projects().groups().delete(GroupDeleteParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
delete /organization/projects/{project_id}/groups/{group_id}
Revokes a group's access to a project.
Parameters
-
GroupDeleteParams params-
String projectId -
Optional<String> groupId
-
Returns
-
class GroupDeleteResponse:Confirmation payload returned after removing a group from a project.
-
boolean deletedWhether the group membership in the project was removed.
-
JsonValue; object_ "project.group.deleted"constantAlways
project.group.deleted.PROJECT_GROUP_DELETED("project.group.deleted")
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.projects.groups.GroupDeleteParams;
import com.openai.models.admin.organization.projects.groups.GroupDeleteResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
GroupDeleteParams params = GroupDeleteParams.builder()
.projectId("project_id")
.groupId("group_id")
.build();
GroupDeleteResponse group = client.admin().organization().projects().groups().delete(params);
}
}
Response
{
"deleted": true,
"object": "project.group.deleted"
}
Domain Types
Project Group
-
class ProjectGroup:Details about a group's membership in a project.
-
long createdAtUnix timestamp (in seconds) when the group was granted project access.
-
String groupIdIdentifier of the group that has access to the project.
-
String groupNameDisplay name of the group.
-
GroupType groupTypeThe type of the group.
-
GROUP("group") -
TENANT_GROUP("tenant_group")
-
-
JsonValue; object_ "project.group"constantAlways
project.group.PROJECT_GROUP("project.group")
-
String projectIdIdentifier of the project.
-
Roles
List project group role assignments
RoleListPage admin().organization().projects().groups().roles().list(RoleListParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
get /projects/{project_id}/groups/{group_id}/roles
Lists the project roles assigned to a group within a project.
Parameters
-
RoleListParams params-
String projectId -
Optional<String> groupId -
Optional<String> afterCursor for pagination. Provide the value from the previous response's
nextfield to continue listing project roles. -
Optional<Long> limitA limit on the number of project role assignments to return.
-
Optional<Order> orderSort order for the returned project roles.
-
ASC("asc") -
DESC("desc")
-
-
Returns
-
class RoleListResponse:Detailed information about a role assignment entry returned when listing assignments.
-
String idIdentifier for the role.
-
Optional<List<AssignmentSource>> assignmentSourcesPrincipals from which the role assignment is inherited, when available.
-
String principalId -
String principalType
-
-
Optional<Long> createdAtWhen the role was created.
-
Optional<String> createdByIdentifier of the actor who created the role.
-
Optional<CreatedByUserObj> createdByUserObjUser details for the actor that created the role, when available.
-
Optional<String> descriptionDescription of the role.
-
Optional<Metadata> metadataArbitrary metadata stored on the role.
-
String nameName of the role.
-
List<String> permissionsPermissions associated with the role.
-
boolean predefinedRoleWhether the role is predefined by OpenAI.
-
String resourceTypeResource type the role applies to.
-
Optional<Long> updatedAtWhen the role was last updated.
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.projects.groups.roles.RoleListPage;
import com.openai.models.admin.organization.projects.groups.roles.RoleListParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
RoleListParams params = RoleListParams.builder()
.projectId("project_id")
.groupId("group_id")
.build();
RoleListPage page = client.admin().organization().projects().groups().roles().list(params);
}
}
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
RoleCreateResponse admin().organization().projects().groups().roles().create(RoleCreateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
post /projects/{project_id}/groups/{group_id}/roles
Assigns a project role to a group within a project.
Parameters
-
RoleCreateParams params-
String projectId -
Optional<String> groupId -
String roleIdIdentifier of the role to assign.
-
Returns
-
class RoleCreateResponse:Role assignment linking a group to a role.
-
Group groupSummary information about a group returned in role assignment responses.
-
String idIdentifier for the group.
-
long createdAtUnix timestamp (in seconds) when the group was created.
-
String nameDisplay name of the group.
-
JsonValue; object_ "group"constantAlways
group.GROUP("group")
-
boolean scimManagedWhether the group is managed through SCIM.
-
-
JsonValue; object_ "group.role"constantAlways
group.role.GROUP_ROLE("group.role")
-
Role roleDetails about a role that can be assigned through the public Roles API.
-
String idIdentifier for the role.
-
Optional<String> descriptionOptional description of the role.
-
String nameUnique name for the role.
-
JsonValue; object_ "role"constantAlways
role.ROLE("role")
-
List<String> permissionsPermissions granted by the role.
-
boolean predefinedRoleWhether the role is predefined and managed by OpenAI.
-
String resourceTypeResource type the role is bound to (for example
api.organizationorapi.project).
-
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.projects.groups.roles.RoleCreateParams;
import com.openai.models.admin.organization.projects.groups.roles.RoleCreateResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
RoleCreateParams params = RoleCreateParams.builder()
.projectId("project_id")
.groupId("group_id")
.roleId("role_id")
.build();
RoleCreateResponse role = client.admin().organization().projects().groups().roles().create(params);
}
}
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
RoleRetrieveResponse admin().organization().projects().groups().roles().retrieve(RoleRetrieveParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
get /projects/{project_id}/groups/{group_id}/roles/{role_id}
Retrieves a project role assigned to a group.
Parameters
-
RoleRetrieveParams params-
String projectId -
String groupId -
Optional<String> roleId
-
Returns
-
class RoleRetrieveResponse:Detailed information about a role assignment entry returned when listing assignments.
-
String idIdentifier for the role.
-
Optional<List<AssignmentSource>> assignmentSourcesPrincipals from which the role assignment is inherited, when available.
-
String principalId -
String principalType
-
-
Optional<Long> createdAtWhen the role was created.
-
Optional<String> createdByIdentifier of the actor who created the role.
-
Optional<CreatedByUserObj> createdByUserObjUser details for the actor that created the role, when available.
-
Optional<String> descriptionDescription of the role.
-
Optional<Metadata> metadataArbitrary metadata stored on the role.
-
String nameName of the role.
-
List<String> permissionsPermissions associated with the role.
-
boolean predefinedRoleWhether the role is predefined by OpenAI.
-
String resourceTypeResource type the role applies to.
-
Optional<Long> updatedAtWhen the role was last updated.
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.projects.groups.roles.RoleRetrieveParams;
import com.openai.models.admin.organization.projects.groups.roles.RoleRetrieveResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
RoleRetrieveParams params = RoleRetrieveParams.builder()
.projectId("project_id")
.groupId("group_id")
.roleId("role_id")
.build();
RoleRetrieveResponse role = client.admin().organization().projects().groups().roles().retrieve(params);
}
}
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
RoleDeleteResponse admin().organization().projects().groups().roles().delete(RoleDeleteParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
delete /projects/{project_id}/groups/{group_id}/roles/{role_id}
Unassigns a project role from a group within a project.
Parameters
-
RoleDeleteParams params-
String projectId -
String groupId -
Optional<String> roleId
-
Returns
-
class RoleDeleteResponse:Confirmation payload returned after unassigning a role.
-
boolean deletedWhether the assignment was removed.
-
String object_Identifier for the deleted assignment, such as
group.role.deletedoruser.role.deleted.
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.projects.groups.roles.RoleDeleteParams;
import com.openai.models.admin.organization.projects.groups.roles.RoleDeleteResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
RoleDeleteParams params = RoleDeleteParams.builder()
.projectId("project_id")
.groupId("group_id")
.roleId("role_id")
.build();
RoleDeleteResponse role = client.admin().organization().projects().groups().roles().delete(params);
}
}
Response
{
"deleted": true,
"object": "object"
}
Roles
List project roles
RoleListPage admin().organization().projects().roles().list(RoleListParamsparams = RoleListParams.none(), RequestOptionsrequestOptions = RequestOptions.none())
get /projects/{project_id}/roles
Lists the roles configured for a project.
Parameters
-
RoleListParams params-
Optional<String> projectId -
Optional<String> afterCursor for pagination. Provide the value from the previous response's
nextfield to continue listing roles. -
Optional<Long> limitA limit on the number of roles to return. Defaults to 1000.
-
Optional<Order> orderSort order for the returned roles.
-
ASC("asc") -
DESC("desc")
-
-
Returns
-
class Role:Details about a role that can be assigned through the public Roles API.
-
String idIdentifier for the role.
-
Optional<String> descriptionOptional description of the role.
-
String nameUnique name for the role.
-
JsonValue; object_ "role"constantAlways
role.ROLE("role")
-
List<String> permissionsPermissions granted by the role.
-
boolean predefinedRoleWhether the role is predefined and managed by OpenAI.
-
String resourceTypeResource type the role is bound to (for example
api.organizationorapi.project).
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.projects.roles.RoleListPage;
import com.openai.models.admin.organization.projects.roles.RoleListParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
RoleListPage page = client.admin().organization().projects().roles().list("project_id");
}
}
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
Role admin().organization().projects().roles().create(RoleCreateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
post /projects/{project_id}/roles
Creates a custom role for a project.
Parameters
-
RoleCreateParams params-
Optional<String> projectId -
List<String> permissionsPermissions to grant to the role.
-
String roleNameUnique name for the role.
-
Optional<String> descriptionOptional description of the role.
-
Returns
-
class Role:Details about a role that can be assigned through the public Roles API.
-
String idIdentifier for the role.
-
Optional<String> descriptionOptional description of the role.
-
String nameUnique name for the role.
-
JsonValue; object_ "role"constantAlways
role.ROLE("role")
-
List<String> permissionsPermissions granted by the role.
-
boolean predefinedRoleWhether the role is predefined and managed by OpenAI.
-
String resourceTypeResource type the role is bound to (for example
api.organizationorapi.project).
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.projects.roles.RoleCreateParams;
import com.openai.models.admin.organization.roles.Role;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
RoleCreateParams params = RoleCreateParams.builder()
.projectId("project_id")
.addPermission("string")
.roleName("role_name")
.build();
Role role = client.admin().organization().projects().roles().create(params);
}
}
Response
{
"id": "id",
"description": "description",
"name": "name",
"object": "role",
"permissions": [
"string"
],
"predefined_role": true,
"resource_type": "resource_type"
}
Retrieve project role
Role admin().organization().projects().roles().retrieve(RoleRetrieveParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
get /projects/{project_id}/roles/{role_id}
Retrieves a project role.
Parameters
-
RoleRetrieveParams params-
String projectId -
Optional<String> roleId
-
Returns
-
class Role:Details about a role that can be assigned through the public Roles API.
-
String idIdentifier for the role.
-
Optional<String> descriptionOptional description of the role.
-
String nameUnique name for the role.
-
JsonValue; object_ "role"constantAlways
role.ROLE("role")
-
List<String> permissionsPermissions granted by the role.
-
boolean predefinedRoleWhether the role is predefined and managed by OpenAI.
-
String resourceTypeResource type the role is bound to (for example
api.organizationorapi.project).
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.projects.roles.RoleRetrieveParams;
import com.openai.models.admin.organization.roles.Role;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
RoleRetrieveParams params = RoleRetrieveParams.builder()
.projectId("project_id")
.roleId("role_id")
.build();
Role role = client.admin().organization().projects().roles().retrieve(params);
}
}
Response
{
"id": "id",
"description": "description",
"name": "name",
"object": "role",
"permissions": [
"string"
],
"predefined_role": true,
"resource_type": "resource_type"
}
Update project role
Role admin().organization().projects().roles().update(RoleUpdateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
post /projects/{project_id}/roles/{role_id}
Updates an existing project role.
Parameters
-
RoleUpdateParams params-
String projectId -
Optional<String> roleId -
Optional<String> descriptionNew description for the role.
-
Optional<List<String>> permissionsUpdated set of permissions for the role.
-
Optional<String> roleNameNew name for the role.
-
Returns
-
class Role:Details about a role that can be assigned through the public Roles API.
-
String idIdentifier for the role.
-
Optional<String> descriptionOptional description of the role.
-
String nameUnique name for the role.
-
JsonValue; object_ "role"constantAlways
role.ROLE("role")
-
List<String> permissionsPermissions granted by the role.
-
boolean predefinedRoleWhether the role is predefined and managed by OpenAI.
-
String resourceTypeResource type the role is bound to (for example
api.organizationorapi.project).
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.projects.roles.RoleUpdateParams;
import com.openai.models.admin.organization.roles.Role;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
RoleUpdateParams params = RoleUpdateParams.builder()
.projectId("project_id")
.roleId("role_id")
.build();
Role role = client.admin().organization().projects().roles().update(params);
}
}
Response
{
"id": "id",
"description": "description",
"name": "name",
"object": "role",
"permissions": [
"string"
],
"predefined_role": true,
"resource_type": "resource_type"
}
Delete project role
RoleDeleteResponse admin().organization().projects().roles().delete(RoleDeleteParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
delete /projects/{project_id}/roles/{role_id}
Deletes a custom role from a project.
Parameters
-
RoleDeleteParams params-
String projectId -
Optional<String> roleId
-
Returns
-
class RoleDeleteResponse:Confirmation payload returned after deleting a role.
-
String idIdentifier of the deleted role.
-
boolean deletedWhether the role was deleted.
-
JsonValue; object_ "role.deleted"constantAlways
role.deleted.ROLE_DELETED("role.deleted")
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.projects.roles.RoleDeleteParams;
import com.openai.models.admin.organization.projects.roles.RoleDeleteResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
RoleDeleteParams params = RoleDeleteParams.builder()
.projectId("project_id")
.roleId("role_id")
.build();
RoleDeleteResponse role = client.admin().organization().projects().roles().delete(params);
}
}
Response
{
"id": "id",
"deleted": true,
"object": "role.deleted"
}
Data Retention
Retrieve project data retention
ProjectDataRetention admin().organization().projects().dataRetention().retrieve(DataRetentionRetrieveParamsparams = DataRetentionRetrieveParams.none(), RequestOptionsrequestOptions = RequestOptions.none())
get /organization/projects/{project_id}/data_retention
Retrieves project data retention controls.
Parameters
-
DataRetentionRetrieveParams paramsOptional<String> projectId
Returns
-
class ProjectDataRetention:Represents a project's data retention control setting.
-
JsonValue; object_ "project.data_retention"constantThe object type, which is always
project.data_retention.PROJECT_DATA_RETENTION("project.data_retention")
-
Type typeThe configured project data retention type.
-
ORGANIZATION_DEFAULT("organization_default") -
NONE("none") -
ZERO_DATA_RETENTION("zero_data_retention") -
MODIFIED_ABUSE_MONITORING("modified_abuse_monitoring") -
ENHANCED_ZERO_DATA_RETENTION("enhanced_zero_data_retention") -
ENHANCED_MODIFIED_ABUSE_MONITORING("enhanced_modified_abuse_monitoring")
-
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.projects.dataretention.DataRetentionRetrieveParams;
import com.openai.models.admin.organization.projects.dataretention.ProjectDataRetention;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
ProjectDataRetention projectDataRetention = client.admin().organization().projects().dataRetention().retrieve("project_id");
}
}
Response
{
"object": "project.data_retention",
"type": "organization_default"
}
Update project data retention
ProjectDataRetention admin().organization().projects().dataRetention().update(DataRetentionUpdateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
post /organization/projects/{project_id}/data_retention
Updates project data retention controls.
Parameters
-
DataRetentionUpdateParams params-
Optional<String> projectId -
RetentionType retentionTypeThe desired project data retention type.
-
ORGANIZATION_DEFAULT("organization_default") -
NONE("none") -
ZERO_DATA_RETENTION("zero_data_retention") -
MODIFIED_ABUSE_MONITORING("modified_abuse_monitoring") -
ENHANCED_ZERO_DATA_RETENTION("enhanced_zero_data_retention") -
ENHANCED_MODIFIED_ABUSE_MONITORING("enhanced_modified_abuse_monitoring")
-
-
Returns
-
class ProjectDataRetention:Represents a project's data retention control setting.
-
JsonValue; object_ "project.data_retention"constantThe object type, which is always
project.data_retention.PROJECT_DATA_RETENTION("project.data_retention")
-
Type typeThe configured project data retention type.
-
ORGANIZATION_DEFAULT("organization_default") -
NONE("none") -
ZERO_DATA_RETENTION("zero_data_retention") -
MODIFIED_ABUSE_MONITORING("modified_abuse_monitoring") -
ENHANCED_ZERO_DATA_RETENTION("enhanced_zero_data_retention") -
ENHANCED_MODIFIED_ABUSE_MONITORING("enhanced_modified_abuse_monitoring")
-
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.projects.dataretention.DataRetentionUpdateParams;
import com.openai.models.admin.organization.projects.dataretention.ProjectDataRetention;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
DataRetentionUpdateParams params = DataRetentionUpdateParams.builder()
.projectId("project_id")
.retentionType(DataRetentionUpdateParams.RetentionType.ORGANIZATION_DEFAULT)
.build();
ProjectDataRetention projectDataRetention = client.admin().organization().projects().dataRetention().update(params);
}
}
Response
{
"object": "project.data_retention",
"type": "organization_default"
}
Domain Types
Project Data Retention
-
class ProjectDataRetention:Represents a project's data retention control setting.
-
JsonValue; object_ "project.data_retention"constantThe object type, which is always
project.data_retention.PROJECT_DATA_RETENTION("project.data_retention")
-
Type typeThe configured project data retention type.
-
ORGANIZATION_DEFAULT("organization_default") -
NONE("none") -
ZERO_DATA_RETENTION("zero_data_retention") -
MODIFIED_ABUSE_MONITORING("modified_abuse_monitoring") -
ENHANCED_ZERO_DATA_RETENTION("enhanced_zero_data_retention") -
ENHANCED_MODIFIED_ABUSE_MONITORING("enhanced_modified_abuse_monitoring")
-
-
Spend Alerts
List project spend alerts
SpendAlertListPage admin().organization().projects().spendAlerts().list(SpendAlertListParamsparams = SpendAlertListParams.none(), RequestOptionsrequestOptions = RequestOptions.none())
get /organization/projects/{project_id}/spend_alerts
Lists project spend alerts.
Parameters
-
SpendAlertListParams params-
Optional<String> projectId -
Optional<String> afterCursor for pagination. Provide the ID of the last spend alert from the previous response to fetch the next page.
-
Optional<String> beforeCursor for pagination. Provide the ID of the first spend alert from the previous response to fetch the previous page.
-
Optional<Long> limitA limit on the number of spend alerts to return. Defaults to 20.
-
Optional<Order> orderSort order for the returned spend alerts.
-
ASC("asc") -
DESC("desc")
-
-
Returns
-
class ProjectSpendAlert:Represents a spend alert configured at the project level.
-
String idThe identifier, which can be referenced in API endpoints.
-
Currency currencyThe currency for the threshold amount.
USD("USD")
-
Interval intervalThe time interval for evaluating spend against the threshold.
MONTH("month")
-
NotificationChannel notificationChannelEmail notification settings for a spend alert.
-
List<String> recipientsEmail addresses that receive the spend alert notification.
-
JsonValue; type "email"constantThe notification channel type. Currently only
emailis supported.EMAIL("email")
-
Optional<String> subjectPrefixOptional subject prefix for alert emails.
-
-
JsonValue; object_ "project.spend_alert"constantThe object type, which is always
project.spend_alert.PROJECT_SPEND_ALERT("project.spend_alert")
-
long thresholdAmountThe alert threshold amount, in cents.
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.projects.spendalerts.SpendAlertListPage;
import com.openai.models.admin.organization.projects.spendalerts.SpendAlertListParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
SpendAlertListPage page = client.admin().organization().projects().spendAlerts().list("project_id");
}
}
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
ProjectSpendAlert admin().organization().projects().spendAlerts().create(SpendAlertCreateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
post /organization/projects/{project_id}/spend_alerts
Creates a project spend alert.
Parameters
-
SpendAlertCreateParams params-
Optional<String> projectId -
Currency currencyThe currency for the threshold amount.
USD("USD")
-
Interval intervalThe time interval for evaluating spend against the threshold.
MONTH("month")
-
NotificationChannel notificationChannelEmail notification settings for a spend alert.
-
List<String> recipientsEmail addresses that receive the spend alert notification.
-
JsonValue; type "email"constantThe notification channel type. Currently only
emailis supported.EMAIL("email")
-
Optional<String> subjectPrefixOptional subject prefix for alert emails.
-
-
long thresholdAmountThe alert threshold amount, in cents.
-
Returns
-
class ProjectSpendAlert:Represents a spend alert configured at the project level.
-
String idThe identifier, which can be referenced in API endpoints.
-
Currency currencyThe currency for the threshold amount.
USD("USD")
-
Interval intervalThe time interval for evaluating spend against the threshold.
MONTH("month")
-
NotificationChannel notificationChannelEmail notification settings for a spend alert.
-
List<String> recipientsEmail addresses that receive the spend alert notification.
-
JsonValue; type "email"constantThe notification channel type. Currently only
emailis supported.EMAIL("email")
-
Optional<String> subjectPrefixOptional subject prefix for alert emails.
-
-
JsonValue; object_ "project.spend_alert"constantThe object type, which is always
project.spend_alert.PROJECT_SPEND_ALERT("project.spend_alert")
-
long thresholdAmountThe alert threshold amount, in cents.
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.projects.spendalerts.ProjectSpendAlert;
import com.openai.models.admin.organization.projects.spendalerts.SpendAlertCreateParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
SpendAlertCreateParams params = SpendAlertCreateParams.builder()
.projectId("project_id")
.currency(SpendAlertCreateParams.Currency.USD)
.interval(SpendAlertCreateParams.Interval.MONTH)
.notificationChannel(SpendAlertCreateParams.NotificationChannel.builder()
.addRecipient("string")
.build())
.thresholdAmount(0L)
.build();
ProjectSpendAlert projectSpendAlert = client.admin().organization().projects().spendAlerts().create(params);
}
}
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
ProjectSpendAlert admin().organization().projects().spendAlerts().update(SpendAlertUpdateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
post /organization/projects/{project_id}/spend_alerts/{alert_id}
Updates a project spend alert.
Parameters
-
SpendAlertUpdateParams params-
String projectId -
Optional<String> alertId -
Currency currencyThe currency for the threshold amount.
USD("USD")
-
Interval intervalThe time interval for evaluating spend against the threshold.
MONTH("month")
-
NotificationChannel notificationChannelEmail notification settings for a spend alert.
-
List<String> recipientsEmail addresses that receive the spend alert notification.
-
JsonValue; type "email"constantThe notification channel type. Currently only
emailis supported.EMAIL("email")
-
Optional<String> subjectPrefixOptional subject prefix for alert emails.
-
-
long thresholdAmountThe alert threshold amount, in cents.
-
Returns
-
class ProjectSpendAlert:Represents a spend alert configured at the project level.
-
String idThe identifier, which can be referenced in API endpoints.
-
Currency currencyThe currency for the threshold amount.
USD("USD")
-
Interval intervalThe time interval for evaluating spend against the threshold.
MONTH("month")
-
NotificationChannel notificationChannelEmail notification settings for a spend alert.
-
List<String> recipientsEmail addresses that receive the spend alert notification.
-
JsonValue; type "email"constantThe notification channel type. Currently only
emailis supported.EMAIL("email")
-
Optional<String> subjectPrefixOptional subject prefix for alert emails.
-
-
JsonValue; object_ "project.spend_alert"constantThe object type, which is always
project.spend_alert.PROJECT_SPEND_ALERT("project.spend_alert")
-
long thresholdAmountThe alert threshold amount, in cents.
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.projects.spendalerts.ProjectSpendAlert;
import com.openai.models.admin.organization.projects.spendalerts.SpendAlertUpdateParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
SpendAlertUpdateParams params = SpendAlertUpdateParams.builder()
.projectId("project_id")
.alertId("alert_id")
.currency(SpendAlertUpdateParams.Currency.USD)
.interval(SpendAlertUpdateParams.Interval.MONTH)
.notificationChannel(SpendAlertUpdateParams.NotificationChannel.builder()
.addRecipient("string")
.build())
.thresholdAmount(0L)
.build();
ProjectSpendAlert projectSpendAlert = client.admin().organization().projects().spendAlerts().update(params);
}
}
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
ProjectSpendAlertDeleted admin().organization().projects().spendAlerts().delete(SpendAlertDeleteParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
delete /organization/projects/{project_id}/spend_alerts/{alert_id}
Deletes a project spend alert.
Parameters
-
SpendAlertDeleteParams params-
String projectId -
Optional<String> alertId
-
Returns
-
class ProjectSpendAlertDeleted:Confirmation payload returned after deleting a project spend alert.
-
String idThe deleted spend alert ID.
-
boolean deletedWhether the spend alert was deleted.
-
JsonValue; object_ "project.spend_alert.deleted"constantAlways
project.spend_alert.deleted.PROJECT_SPEND_ALERT_DELETED("project.spend_alert.deleted")
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.projects.spendalerts.ProjectSpendAlertDeleted;
import com.openai.models.admin.organization.projects.spendalerts.SpendAlertDeleteParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
SpendAlertDeleteParams params = SpendAlertDeleteParams.builder()
.projectId("project_id")
.alertId("alert_id")
.build();
ProjectSpendAlertDeleted projectSpendAlertDeleted = client.admin().organization().projects().spendAlerts().delete(params);
}
}
Response
{
"id": "id",
"deleted": true,
"object": "project.spend_alert.deleted"
}
Domain Types
Project Spend Alert
-
class ProjectSpendAlert:Represents a spend alert configured at the project level.
-
String idThe identifier, which can be referenced in API endpoints.
-
Currency currencyThe currency for the threshold amount.
USD("USD")
-
Interval intervalThe time interval for evaluating spend against the threshold.
MONTH("month")
-
NotificationChannel notificationChannelEmail notification settings for a spend alert.
-
List<String> recipientsEmail addresses that receive the spend alert notification.
-
JsonValue; type "email"constantThe notification channel type. Currently only
emailis supported.EMAIL("email")
-
Optional<String> subjectPrefixOptional subject prefix for alert emails.
-
-
JsonValue; object_ "project.spend_alert"constantThe object type, which is always
project.spend_alert.PROJECT_SPEND_ALERT("project.spend_alert")
-
long thresholdAmountThe alert threshold amount, in cents.
-
Project Spend Alert Deleted
-
class ProjectSpendAlertDeleted:Confirmation payload returned after deleting a project spend alert.
-
String idThe deleted spend alert ID.
-
boolean deletedWhether the spend alert was deleted.
-
JsonValue; object_ "project.spend_alert.deleted"constantAlways
project.spend_alert.deleted.PROJECT_SPEND_ALERT_DELETED("project.spend_alert.deleted")
-
Certificates
List project certificates
CertificateListPage admin().organization().projects().certificates().list(CertificateListParamsparams = CertificateListParams.none(), RequestOptionsrequestOptions = RequestOptions.none())
get /organization/projects/{project_id}/certificates
List certificates for this project.
Parameters
-
CertificateListParams params-
Optional<String> projectId -
Optional<String> afterA 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. -
Optional<Long> limitA limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
-
Optional<Order> orderSort order by the
created_attimestamp of the objects.ascfor ascending order anddescfor descending order.-
ASC("asc") -
DESC("desc")
-
-
Returns
-
class CertificateListResponse:Represents an individual certificate configured at the project level.
-
String idThe identifier, which can be referenced in API endpoints
-
boolean activeWhether the certificate is currently active at the project level.
-
CertificateDetails certificateDetails-
Optional<Long> expiresAtThe Unix timestamp (in seconds) of when the certificate expires.
-
Optional<Long> validAtThe Unix timestamp (in seconds) of when the certificate becomes valid.
-
-
long createdAtThe Unix timestamp (in seconds) of when the certificate was uploaded.
-
Optional<String> nameThe name of the certificate.
-
JsonValue; object_ "organization.project.certificate"constantThe object type, which is always
organization.project.certificate.ORGANIZATION_PROJECT_CERTIFICATE("organization.project.certificate")
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.projects.certificates.CertificateListPage;
import com.openai.models.admin.organization.projects.certificates.CertificateListParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
CertificateListPage page = client.admin().organization().projects().certificates().list("project_id");
}
}
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
CertificateActivatePage admin().organization().projects().certificates().activate(CertificateActivateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
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
-
CertificateActivateParams params-
Optional<String> projectId -
List<String> certificateIds
-
Returns
-
class CertificateActivateResponse:Represents an individual certificate configured at the project level.
-
String idThe identifier, which can be referenced in API endpoints
-
boolean activeWhether the certificate is currently active at the project level.
-
CertificateDetails certificateDetails-
Optional<Long> expiresAtThe Unix timestamp (in seconds) of when the certificate expires.
-
Optional<Long> validAtThe Unix timestamp (in seconds) of when the certificate becomes valid.
-
-
long createdAtThe Unix timestamp (in seconds) of when the certificate was uploaded.
-
Optional<String> nameThe name of the certificate.
-
JsonValue; object_ "organization.project.certificate"constantThe object type, which is always
organization.project.certificate.ORGANIZATION_PROJECT_CERTIFICATE("organization.project.certificate")
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.projects.certificates.CertificateActivatePage;
import com.openai.models.admin.organization.projects.certificates.CertificateActivateParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
CertificateActivateParams params = CertificateActivateParams.builder()
.projectId("project_id")
.addCertificateId("cert_abc")
.build();
CertificateActivatePage page = client.admin().organization().projects().certificates().activate(params);
}
}
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
CertificateDeactivatePage admin().organization().projects().certificates().deactivate(CertificateDeactivateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
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
-
CertificateDeactivateParams params-
Optional<String> projectId -
List<String> certificateIds
-
Returns
-
class CertificateDeactivateResponse:Represents an individual certificate configured at the project level.
-
String idThe identifier, which can be referenced in API endpoints
-
boolean activeWhether the certificate is currently active at the project level.
-
CertificateDetails certificateDetails-
Optional<Long> expiresAtThe Unix timestamp (in seconds) of when the certificate expires.
-
Optional<Long> validAtThe Unix timestamp (in seconds) of when the certificate becomes valid.
-
-
long createdAtThe Unix timestamp (in seconds) of when the certificate was uploaded.
-
Optional<String> nameThe name of the certificate.
-
JsonValue; object_ "organization.project.certificate"constantThe object type, which is always
organization.project.certificate.ORGANIZATION_PROJECT_CERTIFICATE("organization.project.certificate")
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.projects.certificates.CertificateDeactivatePage;
import com.openai.models.admin.organization.projects.certificates.CertificateDeactivateParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
CertificateDeactivateParams params = CertificateDeactivateParams.builder()
.projectId("project_id")
.addCertificateId("cert_abc")
.build();
CertificateDeactivatePage page = client.admin().organization().projects().certificates().deactivate(params);
}
}
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"
}