View Source ExOpenAI.Organization (ex_openai.ex v1.8.0)

Modules for interacting with the organization group of OpenAI APIs

API Reference: https://platform.openai.com/docs/api-reference/organization

Summary

Functions

Create an organization admin API key

Delete an organization admin API key

Retrieve a single organization API key

List organization API keys

Archives a project in the organization. Archived projects cannot be used or updated.

Creates a new service account in the project. This also returns an unredacted API key for the service account.

Adds a user to the project. Users must already be members of the organization to be added to a project.

Create a new project in the organization. Projects can be created and archived, but cannot be deleted.

Delete an invite. If the invite has already been accepted, it cannot be deleted.

Deletes an API key from the project.

Deletes a user from the project.

Deletes a user from the organization.

Create an invite for a user to the organization. The invite must be accepted by the user before they have access to the organization.

List user actions and configuration changes within this organization.

Returns a list of invites in the organization.

Returns a list of API keys in the project.

Returns the rate limits per model for a project.

Returns a list of service accounts in the project.

Returns a list of users in the project.

Returns a list of projects.

Lists all of the users in the organization.

Modifies a user's role in the project.

Modifies a project in the organization.

Modifies a user's role in the organization.

Retrieves an API key in the project.

Retrieves a user by their identifier.

Get audio speeches usage details for the organization.

Get audio transcriptions usage details for the organization.

Get code interpreter sessions usage details for the organization.

Get completions usage details for the organization.

Get costs details for the organization.

Get embeddings usage details for the organization.

Get images usage details for the organization.

Get moderations usage details for the organization.

Get vector stores usage details for the organization.

Functions

Link to this function

admin-api-keys-create(opts \\ [])

View Source
@spec admin - api - keys -
  create(
    base_url: String.t(),
    openai_organization_key: String.t(),
    openai_api_key: String.t()
  ) :: {:ok, ExOpenAI.Components.AdminApiKey.t()} | {:error, any()}

Create an organization admin API key

Endpoint: https://api.openai.com/v1/organization/admin_api_keys

Method: POST

Docs: https://platform.openai.com/docs/api-reference/organization


Required Arguments:

Optional Arguments:

  • openai_api_key: "OpenAI API key to pass directly. If this is specified, it will override the api_key config value."

  • openai_organization_key: "OpenAI API key to pass directly. If this is specified, it will override the organization_key config value."

  • base_url: "Which API endpoint to use as base, defaults to https://api.openai.com/v1"

Link to this function

admin-api-keys-delete(key_id, opts \\ [])

View Source
@spec admin - api - keys -
  delete(String.t(),
    base_url: String.t(),
    openai_organization_key: String.t(),
    openai_api_key: String.t()
  ) :: {:ok, map()} | {:error, any()}

Delete an organization admin API key

Endpoint: https://api.openai.com/v1/organization/admin_api_keys/{key_id}

Method: DELETE

Docs: https://platform.openai.com/docs/api-reference/organization


Required Arguments:

  • key_id

Optional Arguments:

  • openai_api_key: "OpenAI API key to pass directly. If this is specified, it will override the api_key config value."

  • openai_organization_key: "OpenAI API key to pass directly. If this is specified, it will override the organization_key config value."

  • base_url: "Which API endpoint to use as base, defaults to https://api.openai.com/v1"

Link to this function

admin-api-keys-get(key_id, opts \\ [])

View Source
@spec admin - api - keys -
  get(String.t(),
    base_url: String.t(),
    openai_organization_key: String.t(),
    openai_api_key: String.t()
  ) :: {:ok, ExOpenAI.Components.AdminApiKey.t()} | {:error, any()}

Retrieve a single organization API key

Endpoint: https://api.openai.com/v1/organization/admin_api_keys/{key_id}

Method: GET

Docs: https://platform.openai.com/docs/api-reference/organization


Required Arguments:

  • key_id

Optional Arguments:

  • openai_api_key: "OpenAI API key to pass directly. If this is specified, it will override the api_key config value."

  • openai_organization_key: "OpenAI API key to pass directly. If this is specified, it will override the organization_key config value."

  • base_url: "Which API endpoint to use as base, defaults to https://api.openai.com/v1"

Link to this function

admin-api-keys-list(opts \\ [])

View Source
@spec admin - api - keys -
  list(
    base_url: String.t(),
    openai_organization_key: String.t(),
    openai_api_key: String.t(),
    limit: integer(),
    order: String.t(),
    after: String.t(),
    stream_to: (... -> any()) | pid()
  ) :: {:ok, ExOpenAI.Components.ApiKeyList.t()} | {:error, any()}

List organization API keys

Endpoint: https://api.openai.com/v1/organization/admin_api_keys

Method: GET

Docs: https://platform.openai.com/docs/api-reference/organization


Required Arguments:

Optional Arguments:

  • stream_to: "PID or function of where to stream content to"

  • after

  • order

  • limit

  • openai_api_key: "OpenAI API key to pass directly. If this is specified, it will override the api_key config value."

  • openai_organization_key: "OpenAI API key to pass directly. If this is specified, it will override the organization_key config value."

  • base_url: "Which API endpoint to use as base, defaults to https://api.openai.com/v1"

Link to this function

archive-project(project_id, opts \\ [])

View Source
@spec archive -
  project(String.t(),
    base_url: String.t(),
    openai_organization_key: String.t(),
    openai_api_key: String.t()
  ) :: {:ok, ExOpenAI.Components.Project.t()} | {:error, any()}

Archives a project in the organization. Archived projects cannot be used or updated.

Endpoint: https://api.openai.com/v1/organization/projects/{project_id}/archive

Method: POST

Docs: https://platform.openai.com/docs/api-reference/organization


Required Arguments:

  • project_id

Optional Arguments:

  • openai_api_key: "OpenAI API key to pass directly. If this is specified, it will override the api_key config value."

  • openai_organization_key: "OpenAI API key to pass directly. If this is specified, it will override the organization_key config value."

  • base_url: "Which API endpoint to use as base, defaults to https://api.openai.com/v1"

Link to this function

create-project-service-account(project_id, name, opts \\ [])

View Source
@spec create - project - service -
  account(String.t(), String.t(),
    base_url: String.t(),
    openai_organization_key: String.t(),
    openai_api_key: String.t()
  ) ::
  {:ok, ExOpenAI.Components.ProjectServiceAccountCreateResponse.t()}
  | {:error, any()}

Creates a new service account in the project. This also returns an unredacted API key for the service account.

Endpoint: https://api.openai.com/v1/organization/projects/{project_id}/service_accounts

Method: POST

Docs: https://platform.openai.com/docs/api-reference/organization


Required Arguments:

  • project_id

  • name: The name of the service account being created.

Optional Arguments:

  • openai_api_key: "OpenAI API key to pass directly. If this is specified, it will override the api_key config value."

  • openai_organization_key: "OpenAI API key to pass directly. If this is specified, it will override the organization_key config value."

  • base_url: "Which API endpoint to use as base, defaults to https://api.openai.com/v1"

Link to this function

create-project-user(project_id, role, user_id, opts \\ [])

View Source
@spec create - project -
  user(String.t(), :member | :owner, String.t(),
    base_url: String.t(),
    openai_organization_key: String.t(),
    openai_api_key: String.t()
  ) :: {:ok, ExOpenAI.Components.ProjectUser.t()} | {:error, any()}

Adds a user to the project. Users must already be members of the organization to be added to a project.

Endpoint: https://api.openai.com/v1/organization/projects/{project_id}/users

Method: POST

Docs: https://platform.openai.com/docs/api-reference/organization


Required Arguments:

  • project_id

  • role: owner or member

  • user_id: The ID of the user.

Optional Arguments:

  • openai_api_key: "OpenAI API key to pass directly. If this is specified, it will override the api_key config value."

  • openai_organization_key: "OpenAI API key to pass directly. If this is specified, it will override the organization_key config value."

  • base_url: "Which API endpoint to use as base, defaults to https://api.openai.com/v1"

Link to this function

create-project(name, opts \\ [])

View Source
@spec create -
  project(String.t(),
    base_url: String.t(),
    openai_organization_key: String.t(),
    openai_api_key: String.t()
  ) :: {:ok, ExOpenAI.Components.Project.t()} | {:error, any()}

Create a new project in the organization. Projects can be created and archived, but cannot be deleted.

Endpoint: https://api.openai.com/v1/organization/projects

Method: POST

Docs: https://platform.openai.com/docs/api-reference/organization


Required Arguments:

  • name: The friendly name of the project, this name appears in reports.

Optional Arguments:

  • openai_api_key: "OpenAI API key to pass directly. If this is specified, it will override the api_key config value."

  • openai_organization_key: "OpenAI API key to pass directly. If this is specified, it will override the organization_key config value."

  • base_url: "Which API endpoint to use as base, defaults to https://api.openai.com/v1"

Link to this function

delete-invite(invite_id, opts \\ [])

View Source
@spec delete -
  invite(String.t(),
    base_url: String.t(),
    openai_organization_key: String.t(),
    openai_api_key: String.t()
  ) :: {:ok, ExOpenAI.Components.InviteDeleteResponse.t()} | {:error, any()}

Delete an invite. If the invite has already been accepted, it cannot be deleted.

Endpoint: https://api.openai.com/v1/organization/invites/{invite_id}

Method: DELETE

Docs: https://platform.openai.com/docs/api-reference/organization


Required Arguments:

  • invite_id

Optional Arguments:

  • openai_api_key: "OpenAI API key to pass directly. If this is specified, it will override the api_key config value."

  • openai_organization_key: "OpenAI API key to pass directly. If this is specified, it will override the organization_key config value."

  • base_url: "Which API endpoint to use as base, defaults to https://api.openai.com/v1"

Link to this function

delete-project-api-key(project_id, key_id, opts \\ [])

View Source
@spec delete - project - api -
  key(String.t(), String.t(),
    base_url: String.t(),
    openai_organization_key: String.t(),
    openai_api_key: String.t()
  ) ::
  {:ok, ExOpenAI.Components.ProjectApiKeyDeleteResponse.t()} | {:error, any()}

Deletes an API key from the project.

Endpoint: https://api.openai.com/v1/organization/projects/{project_id}/api_keys/{key_id}

Method: DELETE

Docs: https://platform.openai.com/docs/api-reference/organization


Required Arguments:

  • project_id

  • key_id

Optional Arguments:

  • openai_api_key: "OpenAI API key to pass directly. If this is specified, it will override the api_key config value."

  • openai_organization_key: "OpenAI API key to pass directly. If this is specified, it will override the organization_key config value."

  • base_url: "Which API endpoint to use as base, defaults to https://api.openai.com/v1"

Link to this function

delete-project-service-account(project_id, service_account_id, opts \\ [])

View Source
@spec delete - project - service -
  account(String.t(), String.t(),
    base_url: String.t(),
    openai_organization_key: String.t(),
    openai_api_key: String.t()
  ) ::
  {:ok, ExOpenAI.Components.ProjectServiceAccountDeleteResponse.t()}
  | {:error, any()}

Deletes a service account from the project.

Endpoint: https://api.openai.com/v1/organization/projects/{project_id}/service_accounts/{service_account_id}

Method: DELETE

Docs: https://platform.openai.com/docs/api-reference/organization


Required Arguments:

  • project_id

  • service_account_id

Optional Arguments:

  • openai_api_key: "OpenAI API key to pass directly. If this is specified, it will override the api_key config value."

  • openai_organization_key: "OpenAI API key to pass directly. If this is specified, it will override the organization_key config value."

  • base_url: "Which API endpoint to use as base, defaults to https://api.openai.com/v1"

Link to this function

delete-project-user(project_id, user_id, opts \\ [])

View Source
@spec delete - project -
  user(String.t(), String.t(),
    base_url: String.t(),
    openai_organization_key: String.t(),
    openai_api_key: String.t()
  ) ::
  {:ok, ExOpenAI.Components.ProjectUserDeleteResponse.t()} | {:error, any()}

Deletes a user from the project.

Endpoint: https://api.openai.com/v1/organization/projects/{project_id}/users/{user_id}

Method: DELETE

Docs: https://platform.openai.com/docs/api-reference/organization


Required Arguments:

  • project_id

  • user_id

Optional Arguments:

  • openai_api_key: "OpenAI API key to pass directly. If this is specified, it will override the api_key config value."

  • openai_organization_key: "OpenAI API key to pass directly. If this is specified, it will override the organization_key config value."

  • base_url: "Which API endpoint to use as base, defaults to https://api.openai.com/v1"

Link to this function

delete-user(user_id, opts \\ [])

View Source
@spec delete -
  user(String.t(),
    base_url: String.t(),
    openai_organization_key: String.t(),
    openai_api_key: String.t()
  ) :: {:ok, ExOpenAI.Components.UserDeleteResponse.t()} | {:error, any()}

Deletes a user from the organization.

Endpoint: https://api.openai.com/v1/organization/users/{user_id}

Method: DELETE

Docs: https://platform.openai.com/docs/api-reference/organization


Required Arguments:

  • user_id

Optional Arguments:

  • openai_api_key: "OpenAI API key to pass directly. If this is specified, it will override the api_key config value."

  • openai_organization_key: "OpenAI API key to pass directly. If this is specified, it will override the organization_key config value."

  • base_url: "Which API endpoint to use as base, defaults to https://api.openai.com/v1"

Link to this function

invite_user(email, role, opts \\ [])

View Source
@spec invite_user(String.t(), :owner | :reader,
  base_url: String.t(),
  openai_organization_key: String.t(),
  openai_api_key: String.t(),
  projects: [%{id: String.t(), role: :owner | :member}],
  stream_to: (... -> any()) | pid()
) :: {:ok, ExOpenAI.Components.Invite.t()} | {:error, any()}

Create an invite for a user to the organization. The invite must be accepted by the user before they have access to the organization.

Endpoint: https://api.openai.com/v1/organization/invites

Method: POST

Docs: https://platform.openai.com/docs/api-reference/organization


Required Arguments:

  • email: Send an email to this address

  • role: owner or reader

Optional Arguments:

  • stream_to: "PID or function of where to stream content to"

  • projects: "An array of projects to which membership is granted at the same time the org invite is accepted. If omitted, the user will be invited to the default project for compatibility with legacy behavior."

  • openai_api_key: "OpenAI API key to pass directly. If this is specified, it will override the api_key config value."

  • openai_organization_key: "OpenAI API key to pass directly. If this is specified, it will override the organization_key config value."

  • base_url: "Which API endpoint to use as base, defaults to https://api.openai.com/v1"

Link to this function

list-audit-logs(opts \\ [])

View Source
@spec list - audit -
  logs(
    base_url: String.t(),
    openai_organization_key: String.t(),
    openai_api_key: String.t(),
    before: String.t(),
    after: String.t(),
    limit: integer(),
    "resource_ids[]": list(),
    "actor_emails[]": list(),
    "actor_ids[]": list(),
    "event_types[]": list(),
    "project_ids[]": list(),
    effective_at: map(),
    stream_to: (... -> any()) | pid()
  ) :: {:ok, ExOpenAI.Components.ListAuditLogsResponse.t()} | {:error, any()}

List user actions and configuration changes within this organization.

Endpoint: https://api.openai.com/v1/organization/audit_logs

Method: GET

Docs: https://platform.openai.com/docs/api-reference/organization


Required Arguments:

Optional Arguments:

  • stream_to: "PID or function of where to stream content to"

  • effective_at

  • project_ids[]

  • event_types[]

  • actor_ids[]

  • actor_emails[]

  • resource_ids[]

  • limit

  • after

  • before

  • openai_api_key: "OpenAI API key to pass directly. If this is specified, it will override the api_key config value."

  • openai_organization_key: "OpenAI API key to pass directly. If this is specified, it will override the organization_key config value."

  • base_url: "Which API endpoint to use as base, defaults to https://api.openai.com/v1"

Link to this function

list-invites(opts \\ [])

View Source
@spec list -
  invites(
    base_url: String.t(),
    openai_organization_key: String.t(),
    openai_api_key: String.t(),
    after: String.t(),
    limit: integer(),
    stream_to: (... -> any()) | pid()
  ) :: {:ok, ExOpenAI.Components.InviteListResponse.t()} | {:error, any()}

Returns a list of invites in the organization.

Endpoint: https://api.openai.com/v1/organization/invites

Method: GET

Docs: https://platform.openai.com/docs/api-reference/organization


Required Arguments:

Optional Arguments:

  • stream_to: "PID or function of where to stream content to"

  • limit

  • after

  • openai_api_key: "OpenAI API key to pass directly. If this is specified, it will override the api_key config value."

  • openai_organization_key: "OpenAI API key to pass directly. If this is specified, it will override the organization_key config value."

  • base_url: "Which API endpoint to use as base, defaults to https://api.openai.com/v1"

Link to this function

list-project-api-keys(project_id, opts \\ [])

View Source
@spec list - project - api -
  keys(String.t(),
    base_url: String.t(),
    openai_organization_key: String.t(),
    openai_api_key: String.t(),
    after: String.t(),
    limit: integer(),
    stream_to: (... -> any()) | pid()
  ) ::
  {:ok, ExOpenAI.Components.ProjectApiKeyListResponse.t()} | {:error, any()}

Returns a list of API keys in the project.

Endpoint: https://api.openai.com/v1/organization/projects/{project_id}/api_keys

Method: GET

Docs: https://platform.openai.com/docs/api-reference/organization


Required Arguments:

  • project_id

Optional Arguments:

  • stream_to: "PID or function of where to stream content to"

  • limit

  • after

  • openai_api_key: "OpenAI API key to pass directly. If this is specified, it will override the api_key config value."

  • openai_organization_key: "OpenAI API key to pass directly. If this is specified, it will override the organization_key config value."

  • base_url: "Which API endpoint to use as base, defaults to https://api.openai.com/v1"

Link to this function

list-project-rate-limits(project_id, opts \\ [])

View Source
@spec list - project - rate -
  limits(String.t(),
    base_url: String.t(),
    openai_organization_key: String.t(),
    openai_api_key: String.t(),
    before: String.t(),
    after: String.t(),
    limit: integer(),
    stream_to: (... -> any()) | pid()
  ) ::
  {:ok, ExOpenAI.Components.ProjectRateLimitListResponse.t()} | {:error, any()}

Returns the rate limits per model for a project.

Endpoint: https://api.openai.com/v1/organization/projects/{project_id}/rate_limits

Method: GET

Docs: https://platform.openai.com/docs/api-reference/organization


Required Arguments:

  • project_id

Optional Arguments:

  • stream_to: "PID or function of where to stream content to"

  • limit

  • after

  • before

  • openai_api_key: "OpenAI API key to pass directly. If this is specified, it will override the api_key config value."

  • openai_organization_key: "OpenAI API key to pass directly. If this is specified, it will override the organization_key config value."

  • base_url: "Which API endpoint to use as base, defaults to https://api.openai.com/v1"

Link to this function

list-project-service-accounts(project_id, opts \\ [])

View Source
@spec list - project - service -
  accounts(String.t(),
    base_url: String.t(),
    openai_organization_key: String.t(),
    openai_api_key: String.t(),
    after: String.t(),
    limit: integer(),
    stream_to: (... -> any()) | pid()
  ) ::
  {:ok, ExOpenAI.Components.ProjectServiceAccountListResponse.t()}
  | {:error, any()}

Returns a list of service accounts in the project.

Endpoint: https://api.openai.com/v1/organization/projects/{project_id}/service_accounts

Method: GET

Docs: https://platform.openai.com/docs/api-reference/organization


Required Arguments:

  • project_id

Optional Arguments:

  • stream_to: "PID or function of where to stream content to"

  • limit

  • after

  • openai_api_key: "OpenAI API key to pass directly. If this is specified, it will override the api_key config value."

  • openai_organization_key: "OpenAI API key to pass directly. If this is specified, it will override the organization_key config value."

  • base_url: "Which API endpoint to use as base, defaults to https://api.openai.com/v1"

Link to this function

list-project-users(project_id, opts \\ [])

View Source
@spec list - project -
  users(String.t(),
    base_url: String.t(),
    openai_organization_key: String.t(),
    openai_api_key: String.t(),
    after: String.t(),
    limit: integer(),
    stream_to: (... -> any()) | pid()
  ) :: {:ok, ExOpenAI.Components.ProjectUserListResponse.t()} | {:error, any()}

Returns a list of users in the project.

Endpoint: https://api.openai.com/v1/organization/projects/{project_id}/users

Method: GET

Docs: https://platform.openai.com/docs/api-reference/organization


Required Arguments:

  • project_id

Optional Arguments:

  • stream_to: "PID or function of where to stream content to"

  • limit

  • after

  • openai_api_key: "OpenAI API key to pass directly. If this is specified, it will override the api_key config value."

  • openai_organization_key: "OpenAI API key to pass directly. If this is specified, it will override the organization_key config value."

  • base_url: "Which API endpoint to use as base, defaults to https://api.openai.com/v1"

Link to this function

list-projects(opts \\ [])

View Source
@spec list -
  projects(
    base_url: String.t(),
    openai_organization_key: String.t(),
    openai_api_key: String.t(),
    include_archived: boolean(),
    after: String.t(),
    limit: integer(),
    stream_to: (... -> any()) | pid()
  ) :: {:ok, ExOpenAI.Components.ProjectListResponse.t()} | {:error, any()}

Returns a list of projects.

Endpoint: https://api.openai.com/v1/organization/projects

Method: GET

Docs: https://platform.openai.com/docs/api-reference/organization


Required Arguments:

Optional Arguments:

  • stream_to: "PID or function of where to stream content to"

  • limit

  • after

  • include_archived

  • openai_api_key: "OpenAI API key to pass directly. If this is specified, it will override the api_key config value."

  • openai_organization_key: "OpenAI API key to pass directly. If this is specified, it will override the organization_key config value."

  • base_url: "Which API endpoint to use as base, defaults to https://api.openai.com/v1"

@spec list -
  users(
    base_url: String.t(),
    openai_organization_key: String.t(),
    openai_api_key: String.t(),
    emails: list(),
    after: String.t(),
    limit: integer(),
    stream_to: (... -> any()) | pid()
  ) :: {:ok, ExOpenAI.Components.UserListResponse.t()} | {:error, any()}

Lists all of the users in the organization.

Endpoint: https://api.openai.com/v1/organization/users

Method: GET

Docs: https://platform.openai.com/docs/api-reference/organization


Required Arguments:

Optional Arguments:

  • stream_to: "PID or function of where to stream content to"

  • limit

  • after

  • emails

  • openai_api_key: "OpenAI API key to pass directly. If this is specified, it will override the api_key config value."

  • openai_organization_key: "OpenAI API key to pass directly. If this is specified, it will override the organization_key config value."

  • base_url: "Which API endpoint to use as base, defaults to https://api.openai.com/v1"

Link to this function

modify-project-user(project_id, user_id, role, opts \\ [])

View Source
@spec modify - project -
  user(String.t(), String.t(), :member | :owner,
    base_url: String.t(),
    openai_organization_key: String.t(),
    openai_api_key: String.t()
  ) :: {:ok, ExOpenAI.Components.ProjectUser.t()} | {:error, any()}

Modifies a user's role in the project.

Endpoint: https://api.openai.com/v1/organization/projects/{project_id}/users/{user_id}

Method: POST

Docs: https://platform.openai.com/docs/api-reference/organization


Required Arguments:

  • project_id

  • user_id

  • role: owner or member

Optional Arguments:

  • openai_api_key: "OpenAI API key to pass directly. If this is specified, it will override the api_key config value."

  • openai_organization_key: "OpenAI API key to pass directly. If this is specified, it will override the organization_key config value."

  • base_url: "Which API endpoint to use as base, defaults to https://api.openai.com/v1"

Link to this function

modify-project(project_id, name, opts \\ [])

View Source
@spec modify -
  project(String.t(), String.t(),
    base_url: String.t(),
    openai_organization_key: String.t(),
    openai_api_key: String.t()
  ) :: {:ok, ExOpenAI.Components.Project.t()} | {:error, any()}

Modifies a project in the organization.

Endpoint: https://api.openai.com/v1/organization/projects/{project_id}

Method: POST

Docs: https://platform.openai.com/docs/api-reference/organization


Required Arguments:

  • project_id

  • name: The updated name of the project, this name appears in reports.

Optional Arguments:

  • openai_api_key: "OpenAI API key to pass directly. If this is specified, it will override the api_key config value."

  • openai_organization_key: "OpenAI API key to pass directly. If this is specified, it will override the organization_key config value."

  • base_url: "Which API endpoint to use as base, defaults to https://api.openai.com/v1"

Link to this function

modify-user(user_id, role, opts \\ [])

View Source
@spec modify -
  user(String.t(), :reader | :owner,
    base_url: String.t(),
    openai_organization_key: String.t(),
    openai_api_key: String.t()
  ) :: {:ok, ExOpenAI.Components.User.t()} | {:error, any()}

Modifies a user's role in the organization.

Endpoint: https://api.openai.com/v1/organization/users/{user_id}

Method: POST

Docs: https://platform.openai.com/docs/api-reference/organization


Required Arguments:

  • user_id

  • role: owner or reader

Optional Arguments:

  • openai_api_key: "OpenAI API key to pass directly. If this is specified, it will override the api_key config value."

  • openai_organization_key: "OpenAI API key to pass directly. If this is specified, it will override the organization_key config value."

  • base_url: "Which API endpoint to use as base, defaults to https://api.openai.com/v1"

Link to this function

retrieve-invite(invite_id, opts \\ [])

View Source
@spec retrieve -
  invite(String.t(),
    base_url: String.t(),
    openai_organization_key: String.t(),
    openai_api_key: String.t()
  ) :: {:ok, ExOpenAI.Components.Invite.t()} | {:error, any()}

Retrieves an invite.

Endpoint: https://api.openai.com/v1/organization/invites/{invite_id}

Method: GET

Docs: https://platform.openai.com/docs/api-reference/organization


Required Arguments:

  • invite_id

Optional Arguments:

  • openai_api_key: "OpenAI API key to pass directly. If this is specified, it will override the api_key config value."

  • openai_organization_key: "OpenAI API key to pass directly. If this is specified, it will override the organization_key config value."

  • base_url: "Which API endpoint to use as base, defaults to https://api.openai.com/v1"

Link to this function

retrieve-project-api-key(project_id, key_id, opts \\ [])

View Source
@spec retrieve - project - api -
  key(String.t(), String.t(),
    base_url: String.t(),
    openai_organization_key: String.t(),
    openai_api_key: String.t()
  ) :: {:ok, ExOpenAI.Components.ProjectApiKey.t()} | {:error, any()}

Retrieves an API key in the project.

Endpoint: https://api.openai.com/v1/organization/projects/{project_id}/api_keys/{key_id}

Method: GET

Docs: https://platform.openai.com/docs/api-reference/organization


Required Arguments:

  • project_id

  • key_id

Optional Arguments:

  • openai_api_key: "OpenAI API key to pass directly. If this is specified, it will override the api_key config value."

  • openai_organization_key: "OpenAI API key to pass directly. If this is specified, it will override the organization_key config value."

  • base_url: "Which API endpoint to use as base, defaults to https://api.openai.com/v1"

Link to this function

retrieve-project-service-account(project_id, service_account_id, opts \\ [])

View Source
@spec retrieve - project - service -
  account(String.t(), String.t(),
    base_url: String.t(),
    openai_organization_key: String.t(),
    openai_api_key: String.t()
  ) :: {:ok, ExOpenAI.Components.ProjectServiceAccount.t()} | {:error, any()}

Retrieves a service account in the project.

Endpoint: https://api.openai.com/v1/organization/projects/{project_id}/service_accounts/{service_account_id}

Method: GET

Docs: https://platform.openai.com/docs/api-reference/organization


Required Arguments:

  • project_id

  • service_account_id

Optional Arguments:

  • openai_api_key: "OpenAI API key to pass directly. If this is specified, it will override the api_key config value."

  • openai_organization_key: "OpenAI API key to pass directly. If this is specified, it will override the organization_key config value."

  • base_url: "Which API endpoint to use as base, defaults to https://api.openai.com/v1"

Link to this function

retrieve-project-user(project_id, user_id, opts \\ [])

View Source
@spec retrieve - project -
  user(String.t(), String.t(),
    base_url: String.t(),
    openai_organization_key: String.t(),
    openai_api_key: String.t()
  ) :: {:ok, ExOpenAI.Components.ProjectUser.t()} | {:error, any()}

Retrieves a user in the project.

Endpoint: https://api.openai.com/v1/organization/projects/{project_id}/users/{user_id}

Method: GET

Docs: https://platform.openai.com/docs/api-reference/organization


Required Arguments:

  • project_id

  • user_id

Optional Arguments:

  • openai_api_key: "OpenAI API key to pass directly. If this is specified, it will override the api_key config value."

  • openai_organization_key: "OpenAI API key to pass directly. If this is specified, it will override the organization_key config value."

  • base_url: "Which API endpoint to use as base, defaults to https://api.openai.com/v1"

Link to this function

retrieve-project(project_id, opts \\ [])

View Source
@spec retrieve -
  project(String.t(),
    base_url: String.t(),
    openai_organization_key: String.t(),
    openai_api_key: String.t()
  ) :: {:ok, ExOpenAI.Components.Project.t()} | {:error, any()}

Retrieves a project.

Endpoint: https://api.openai.com/v1/organization/projects/{project_id}

Method: GET

Docs: https://platform.openai.com/docs/api-reference/organization


Required Arguments:

  • project_id

Optional Arguments:

  • openai_api_key: "OpenAI API key to pass directly. If this is specified, it will override the api_key config value."

  • openai_organization_key: "OpenAI API key to pass directly. If this is specified, it will override the organization_key config value."

  • base_url: "Which API endpoint to use as base, defaults to https://api.openai.com/v1"

Link to this function

retrieve-user(user_id, opts \\ [])

View Source
@spec retrieve -
  user(String.t(),
    base_url: String.t(),
    openai_organization_key: String.t(),
    openai_api_key: String.t()
  ) :: {:ok, ExOpenAI.Components.User.t()} | {:error, any()}

Retrieves a user by their identifier.

Endpoint: https://api.openai.com/v1/organization/users/{user_id}

Method: GET

Docs: https://platform.openai.com/docs/api-reference/organization


Required Arguments:

  • user_id

Optional Arguments:

  • openai_api_key: "OpenAI API key to pass directly. If this is specified, it will override the api_key config value."

  • openai_organization_key: "OpenAI API key to pass directly. If this is specified, it will override the organization_key config value."

  • base_url: "Which API endpoint to use as base, defaults to https://api.openai.com/v1"

Link to this function

update-project-rate-limits(project_id, rate_limit_id, opts \\ [])

View Source
@spec update - project - rate -
  limits(String.t(), String.t(),
    base_url: String.t(),
    openai_organization_key: String.t(),
    openai_api_key: String.t(),
    max_tokens_per_1_minute: integer(),
    max_requests_per_1_minute: integer(),
    max_requests_per_1_day: integer(),
    max_images_per_1_minute: integer(),
    max_audio_megabytes_per_1_minute: integer(),
    batch_1_day_max_input_tokens: integer(),
    stream_to: (... -> any()) | pid()
  ) :: {:ok, ExOpenAI.Components.ProjectRateLimit.t()} | {:error, any()}

Updates a project rate limit.

Endpoint: https://api.openai.com/v1/organization/projects/{project_id}/rate_limits/{rate_limit_id}

Method: POST

Docs: https://platform.openai.com/docs/api-reference/organization


Required Arguments:

  • project_id

  • rate_limit_id

Optional Arguments:

  • stream_to: "PID or function of where to stream content to"

  • batch_1_day_max_input_tokens: "The maximum batch input tokens per day. Only relevant for certain models."

  • max_audio_megabytes_per_1_minute: "The maximum audio megabytes per minute. Only relevant for certain models."

  • max_images_per_1_minute: "The maximum images per minute. Only relevant for certain models."

  • max_requests_per_1_day: "The maximum requests per day. Only relevant for certain models."

  • max_requests_per_1_minute: "The maximum requests per minute."

  • max_tokens_per_1_minute: "The maximum tokens per minute."

  • openai_api_key: "OpenAI API key to pass directly. If this is specified, it will override the api_key config value."

  • openai_organization_key: "OpenAI API key to pass directly. If this is specified, it will override the organization_key config value."

  • base_url: "Which API endpoint to use as base, defaults to https://api.openai.com/v1"

Link to this function

usage-audio-speeches(start_time, opts \\ [])

View Source
@spec usage - audio -
  speeches(integer(),
    base_url: String.t(),
    openai_organization_key: String.t(),
    openai_api_key: String.t(),
    page: String.t(),
    limit: integer(),
    group_by: list(),
    models: list(),
    api_key_ids: list(),
    user_ids: list(),
    project_ids: list(),
    bucket_width: String.t(),
    end_time: integer(),
    stream_to: (... -> any()) | pid()
  ) :: {:ok, ExOpenAI.Components.UsageResponse.t()} | {:error, any()}

Get audio speeches usage details for the organization.

Endpoint: https://api.openai.com/v1/organization/usage/audio_speeches

Method: GET

Docs: https://platform.openai.com/docs/api-reference/organization


Required Arguments:

  • start_time

Optional Arguments:

  • stream_to: "PID or function of where to stream content to"

  • end_time

  • bucket_width

  • project_ids

  • user_ids

  • api_key_ids

  • models

  • group_by

  • limit

  • page

  • openai_api_key: "OpenAI API key to pass directly. If this is specified, it will override the api_key config value."

  • openai_organization_key: "OpenAI API key to pass directly. If this is specified, it will override the organization_key config value."

  • base_url: "Which API endpoint to use as base, defaults to https://api.openai.com/v1"

Link to this function

usage-audio-transcriptions(start_time, opts \\ [])

View Source
@spec usage - audio -
  transcriptions(integer(),
    base_url: String.t(),
    openai_organization_key: String.t(),
    openai_api_key: String.t(),
    page: String.t(),
    limit: integer(),
    group_by: list(),
    models: list(),
    api_key_ids: list(),
    user_ids: list(),
    project_ids: list(),
    bucket_width: String.t(),
    end_time: integer(),
    stream_to: (... -> any()) | pid()
  ) :: {:ok, ExOpenAI.Components.UsageResponse.t()} | {:error, any()}

Get audio transcriptions usage details for the organization.

Endpoint: https://api.openai.com/v1/organization/usage/audio_transcriptions

Method: GET

Docs: https://platform.openai.com/docs/api-reference/organization


Required Arguments:

  • start_time

Optional Arguments:

  • stream_to: "PID or function of where to stream content to"

  • end_time

  • bucket_width

  • project_ids

  • user_ids

  • api_key_ids

  • models

  • group_by

  • limit

  • page

  • openai_api_key: "OpenAI API key to pass directly. If this is specified, it will override the api_key config value."

  • openai_organization_key: "OpenAI API key to pass directly. If this is specified, it will override the organization_key config value."

  • base_url: "Which API endpoint to use as base, defaults to https://api.openai.com/v1"

Link to this function

usage-code-interpreter-sessions(start_time, opts \\ [])

View Source
@spec usage - code - interpreter -
  sessions(integer(),
    base_url: String.t(),
    openai_organization_key: String.t(),
    openai_api_key: String.t(),
    page: String.t(),
    limit: integer(),
    group_by: list(),
    project_ids: list(),
    bucket_width: String.t(),
    end_time: integer(),
    stream_to: (... -> any()) | pid()
  ) :: {:ok, ExOpenAI.Components.UsageResponse.t()} | {:error, any()}

Get code interpreter sessions usage details for the organization.

Endpoint: https://api.openai.com/v1/organization/usage/code_interpreter_sessions

Method: GET

Docs: https://platform.openai.com/docs/api-reference/organization


Required Arguments:

  • start_time

Optional Arguments:

  • stream_to: "PID or function of where to stream content to"

  • end_time

  • bucket_width

  • project_ids

  • group_by

  • limit

  • page

  • openai_api_key: "OpenAI API key to pass directly. If this is specified, it will override the api_key config value."

  • openai_organization_key: "OpenAI API key to pass directly. If this is specified, it will override the organization_key config value."

  • base_url: "Which API endpoint to use as base, defaults to https://api.openai.com/v1"

Link to this function

usage-completions(start_time, opts \\ [])

View Source
@spec usage -
  completions(integer(),
    base_url: String.t(),
    openai_organization_key: String.t(),
    openai_api_key: String.t(),
    page: String.t(),
    limit: integer(),
    group_by: list(),
    batch: boolean(),
    models: list(),
    api_key_ids: list(),
    user_ids: list(),
    project_ids: list(),
    bucket_width: String.t(),
    end_time: integer(),
    stream_to: (... -> any()) | pid()
  ) :: {:ok, ExOpenAI.Components.UsageResponse.t()} | {:error, any()}

Get completions usage details for the organization.

Endpoint: https://api.openai.com/v1/organization/usage/completions

Method: GET

Docs: https://platform.openai.com/docs/api-reference/organization


Required Arguments:

  • start_time

Optional Arguments:

  • stream_to: "PID or function of where to stream content to"

  • end_time

  • bucket_width

  • project_ids

  • user_ids

  • api_key_ids

  • models

  • batch

  • group_by

  • limit

  • page

  • openai_api_key: "OpenAI API key to pass directly. If this is specified, it will override the api_key config value."

  • openai_organization_key: "OpenAI API key to pass directly. If this is specified, it will override the organization_key config value."

  • base_url: "Which API endpoint to use as base, defaults to https://api.openai.com/v1"

Link to this function

usage-costs(start_time, opts \\ [])

View Source
@spec usage -
  costs(integer(),
    base_url: String.t(),
    openai_organization_key: String.t(),
    openai_api_key: String.t(),
    page: String.t(),
    limit: integer(),
    group_by: list(),
    project_ids: list(),
    bucket_width: String.t(),
    end_time: integer(),
    stream_to: (... -> any()) | pid()
  ) :: {:ok, ExOpenAI.Components.UsageResponse.t()} | {:error, any()}

Get costs details for the organization.

Endpoint: https://api.openai.com/v1/organization/costs

Method: GET

Docs: https://platform.openai.com/docs/api-reference/organization


Required Arguments:

  • start_time

Optional Arguments:

  • stream_to: "PID or function of where to stream content to"

  • end_time

  • bucket_width

  • project_ids

  • group_by

  • limit

  • page

  • openai_api_key: "OpenAI API key to pass directly. If this is specified, it will override the api_key config value."

  • openai_organization_key: "OpenAI API key to pass directly. If this is specified, it will override the organization_key config value."

  • base_url: "Which API endpoint to use as base, defaults to https://api.openai.com/v1"

Link to this function

usage-embeddings(start_time, opts \\ [])

View Source
@spec usage -
  embeddings(integer(),
    base_url: String.t(),
    openai_organization_key: String.t(),
    openai_api_key: String.t(),
    page: String.t(),
    limit: integer(),
    group_by: list(),
    models: list(),
    api_key_ids: list(),
    user_ids: list(),
    project_ids: list(),
    bucket_width: String.t(),
    end_time: integer(),
    stream_to: (... -> any()) | pid()
  ) :: {:ok, ExOpenAI.Components.UsageResponse.t()} | {:error, any()}

Get embeddings usage details for the organization.

Endpoint: https://api.openai.com/v1/organization/usage/embeddings

Method: GET

Docs: https://platform.openai.com/docs/api-reference/organization


Required Arguments:

  • start_time

Optional Arguments:

  • stream_to: "PID or function of where to stream content to"

  • end_time

  • bucket_width

  • project_ids

  • user_ids

  • api_key_ids

  • models

  • group_by

  • limit

  • page

  • openai_api_key: "OpenAI API key to pass directly. If this is specified, it will override the api_key config value."

  • openai_organization_key: "OpenAI API key to pass directly. If this is specified, it will override the organization_key config value."

  • base_url: "Which API endpoint to use as base, defaults to https://api.openai.com/v1"

Link to this function

usage-images(start_time, opts \\ [])

View Source
@spec usage -
  images(integer(),
    base_url: String.t(),
    openai_organization_key: String.t(),
    openai_api_key: String.t(),
    page: String.t(),
    limit: integer(),
    group_by: list(),
    models: list(),
    api_key_ids: list(),
    user_ids: list(),
    project_ids: list(),
    sizes: list(),
    sources: list(),
    bucket_width: String.t(),
    end_time: integer(),
    stream_to: (... -> any()) | pid()
  ) :: {:ok, ExOpenAI.Components.UsageResponse.t()} | {:error, any()}

Get images usage details for the organization.

Endpoint: https://api.openai.com/v1/organization/usage/images

Method: GET

Docs: https://platform.openai.com/docs/api-reference/organization


Required Arguments:

  • start_time

Optional Arguments:

  • stream_to: "PID or function of where to stream content to"

  • end_time

  • bucket_width

  • sources

  • sizes

  • project_ids

  • user_ids

  • api_key_ids

  • models

  • group_by

  • limit

  • page

  • openai_api_key: "OpenAI API key to pass directly. If this is specified, it will override the api_key config value."

  • openai_organization_key: "OpenAI API key to pass directly. If this is specified, it will override the organization_key config value."

  • base_url: "Which API endpoint to use as base, defaults to https://api.openai.com/v1"

Link to this function

usage-moderations(start_time, opts \\ [])

View Source
@spec usage -
  moderations(integer(),
    base_url: String.t(),
    openai_organization_key: String.t(),
    openai_api_key: String.t(),
    page: String.t(),
    limit: integer(),
    group_by: list(),
    models: list(),
    api_key_ids: list(),
    user_ids: list(),
    project_ids: list(),
    bucket_width: String.t(),
    end_time: integer(),
    stream_to: (... -> any()) | pid()
  ) :: {:ok, ExOpenAI.Components.UsageResponse.t()} | {:error, any()}

Get moderations usage details for the organization.

Endpoint: https://api.openai.com/v1/organization/usage/moderations

Method: GET

Docs: https://platform.openai.com/docs/api-reference/organization


Required Arguments:

  • start_time

Optional Arguments:

  • stream_to: "PID or function of where to stream content to"

  • end_time

  • bucket_width

  • project_ids

  • user_ids

  • api_key_ids

  • models

  • group_by

  • limit

  • page

  • openai_api_key: "OpenAI API key to pass directly. If this is specified, it will override the api_key config value."

  • openai_organization_key: "OpenAI API key to pass directly. If this is specified, it will override the organization_key config value."

  • base_url: "Which API endpoint to use as base, defaults to https://api.openai.com/v1"

Link to this function

usage-vector-stores(start_time, opts \\ [])

View Source
@spec usage - vector -
  stores(integer(),
    base_url: String.t(),
    openai_organization_key: String.t(),
    openai_api_key: String.t(),
    page: String.t(),
    limit: integer(),
    group_by: list(),
    project_ids: list(),
    bucket_width: String.t(),
    end_time: integer(),
    stream_to: (... -> any()) | pid()
  ) :: {:ok, ExOpenAI.Components.UsageResponse.t()} | {:error, any()}

Get vector stores usage details for the organization.

Endpoint: https://api.openai.com/v1/organization/usage/vector_stores

Method: GET

Docs: https://platform.openai.com/docs/api-reference/organization


Required Arguments:

  • start_time

Optional Arguments:

  • stream_to: "PID or function of where to stream content to"

  • end_time

  • bucket_width

  • project_ids

  • group_by

  • limit

  • page

  • openai_api_key: "OpenAI API key to pass directly. If this is specified, it will override the api_key config value."

  • openai_organization_key: "OpenAI API key to pass directly. If this is specified, it will override the organization_key config value."

  • base_url: "Which API endpoint to use as base, defaults to https://api.openai.com/v1"