View Source OpenAi.Projects (OpenAI REST API Client v1.0.0)

Provides API endpoints related to projects

Summary

Functions

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

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

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.

Deletes an API key from the project.

Deletes a user from the project.

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.

Modifies a project in the organization.

Modifies a user's role in the project.

Retrieves an API key in the project.

Functions

Link to this function

archive_project(project_id, opts \\ [])

View Source
@spec archive_project(project_id :: String.t(), opts :: keyword()) ::
  {:ok, OpenAi.Project.t()} | {:error, OpenAi.Error.error()}

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

Link to this function

create_project(body, opts \\ [])

View Source
@spec create_project(body :: OpenAi.Project.CreateRequest.t(), opts :: keyword()) ::
  {:ok, OpenAi.Project.t()} | {:error, OpenAi.Error.error()}

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

Link to this function

create_project_service_account(project_id, body, opts \\ [])

View Source
@spec create_project_service_account(
  project_id :: String.t(),
  body :: OpenAi.Project.ServiceAccount.CreateRequest.t(),
  opts :: keyword()
) ::
  {:ok, OpenAi.Project.ServiceAccount.CreateResponse.t()}
  | {:error, OpenAi.Error.error()}

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

Link to this function

create_project_user(project_id, body, opts \\ [])

View Source
@spec create_project_user(
  project_id :: String.t(),
  body :: OpenAi.Project.User.CreateRequest.t(),
  opts :: keyword()
) :: {:ok, OpenAi.Project.User.t()} | {:error, OpenAi.Error.error()}

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

Link to this function

delete_project_api_key(project_id, key_id, opts \\ [])

View Source
@spec delete_project_api_key(
  project_id :: String.t(),
  key_id :: String.t(),
  opts :: keyword()
) ::
  {:ok, OpenAi.Project.ApiKey.DeleteResponse.t()}
  | {:error, OpenAi.Error.error()}

Deletes an API key from the project.

Link to this function

delete_project_service_account(project_id, service_account_id, opts \\ [])

View Source
@spec delete_project_service_account(
  project_id :: String.t(),
  service_account_id :: String.t(),
  opts :: keyword()
) ::
  {:ok, OpenAi.Project.ServiceAccount.DeleteResponse.t()}
  | {:error, OpenAi.Error.error()}

Deletes a service account from the project.

Link to this function

delete_project_user(project_id, user_id, opts \\ [])

View Source
@spec delete_project_user(
  project_id :: String.t(),
  user_id :: String.t(),
  opts :: keyword()
) ::
  {:ok, OpenAi.Project.User.DeleteResponse.t()} | {:error, OpenAi.Error.error()}

Deletes a user from the project.

Link to this function

list_project_api_keys(project_id, opts \\ [])

View Source
@spec list_project_api_keys(project_id :: String.t(), opts :: keyword()) ::
  {:ok, OpenAi.Project.ApiKey.ListResponse.t()} | {:error, OpenAi.Error.error()}

Returns a list of API keys in the project.

Options

  • limit: A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.

  • after: A cursor for use in pagination. after is 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.

Link to this function

list_project_rate_limits(project_id, opts \\ [])

View Source
@spec list_project_rate_limits(project_id :: String.t(), opts :: keyword()) ::
  {:ok, OpenAi.Project.RateLimitListResponse.t()}
  | {:error, OpenAi.Error.error()}

Returns the rate limits per model for a project.

Options

  • limit: A limit on the number of objects to be returned. The default is 100.

  • after: A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.

  • before: A cursor for use in pagination. before is 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.

Link to this function

list_project_service_accounts(project_id, opts \\ [])

View Source
@spec list_project_service_accounts(project_id :: String.t(), opts :: keyword()) ::
  {:ok, OpenAi.Project.ServiceAccount.ListResponse.t()}
  | {:error, OpenAi.Error.error()}

Returns a list of service accounts in the project.

Options

  • limit: A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.

  • after: A cursor for use in pagination. after is 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.

Link to this function

list_project_users(project_id, opts \\ [])

View Source
@spec list_project_users(project_id :: String.t(), opts :: keyword()) ::
  {:ok, OpenAi.Project.User.ListResponse.t()} | {:error, OpenAi.Error.error()}

Returns a list of users in the project.

Options

  • limit: A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.

  • after: A cursor for use in pagination. after is 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.

Link to this function

list_projects(opts \\ [])

View Source
@spec list_projects(opts :: keyword()) ::
  {:ok, OpenAi.Project.ListResponse.t()} | {:error, OpenAi.Error.error()}

Returns a list of projects.

Options

  • limit: A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.

  • after: A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.

  • include_archived: If true returns all projects including those that have been archived. Archived projects are not included by default.

Link to this function

modify_project(project_id, body, opts \\ [])

View Source
@spec modify_project(
  project_id :: String.t(),
  body :: OpenAi.Project.UpdateRequest.t(),
  opts :: keyword()
) :: {:ok, OpenAi.Project.t()} | {:error, OpenAi.Error.error()}

Modifies a project in the organization.

Link to this function

modify_project_user(project_id, user_id, body, opts \\ [])

View Source
@spec modify_project_user(
  project_id :: String.t(),
  user_id :: String.t(),
  body :: OpenAi.Project.User.UpdateRequest.t(),
  opts :: keyword()
) :: {:ok, OpenAi.Project.User.t()} | {:error, OpenAi.Error.error()}

Modifies a user's role in the project.

Link to this function

retrieve_project(project_id, opts \\ [])

View Source
@spec retrieve_project(project_id :: String.t(), opts :: keyword()) ::
  {:ok, OpenAi.Project.t()} | {:error, OpenAi.Error.error()}

Retrieves a project.

Link to this function

retrieve_project_api_key(project_id, key_id, opts \\ [])

View Source
@spec retrieve_project_api_key(
  project_id :: String.t(),
  key_id :: String.t(),
  opts :: keyword()
) ::
  {:ok, OpenAi.Project.ApiKey.t()} | {:error, OpenAi.Error.error()}

Retrieves an API key in the project.

Link to this function

retrieve_project_service_account(project_id, service_account_id, opts \\ [])

View Source
@spec retrieve_project_service_account(
  project_id :: String.t(),
  service_account_id :: String.t(),
  opts :: keyword()
) :: {:ok, OpenAi.Project.ServiceAccount.t()} | {:error, OpenAi.Error.error()}

Retrieves a service account in the project.

Link to this function

retrieve_project_user(project_id, user_id, opts \\ [])

View Source
@spec retrieve_project_user(
  project_id :: String.t(),
  user_id :: String.t(),
  opts :: keyword()
) ::
  {:ok, OpenAi.Project.User.t()} | {:error, OpenAi.Error.error()}

Retrieves a user in the project.

Link to this function

update_project_rate_limits(project_id, rate_limit_id, body, opts \\ [])

View Source
@spec update_project_rate_limits(
  project_id :: String.t(),
  rate_limit_id :: String.t(),
  body :: OpenAi.Project.RateLimitUpdateRequest.t(),
  opts :: keyword()
) :: {:ok, OpenAi.Project.RateLimit.t()} | {:error, OpenAi.Error.error()}

Updates a project rate limit.