OpenCode.Generated.Provider (opencode_sdk v0.1.55)

Copy Markdown View Source

Provides API endpoints related to provider

Summary

Types

provider_list_200_json_resp()

@type provider_list_200_json_resp() :: %{
  all: [t()],
  connected: [String.t()],
  default: map()
}

t()

@type t() :: %OpenCode.Generated.Provider{
  env: [String.t()],
  id: String.t(),
  key: String.t() | nil,
  models: map(),
  name: String.t(),
  options: map(),
  source: String.t()
}

Functions

provider_auth(opts \\ [])

@spec provider_auth(opts :: keyword()) :: {:ok, map()} | :error

Get provider auth methods

Retrieve available authentication methods for all AI providers.

Options

  • directory
  • workspace

provider_list(opts \\ [])

@spec provider_list(opts :: keyword()) ::
  {:ok, provider_list_200_json_resp()} | :error

List providers

Get a list of all available AI providers, including both available and connected ones.

Options

  • directory
  • workspace

provider_oauth_authorize(providerID, body, opts \\ [])

@spec provider_oauth_authorize(
  providerID :: String.t(),
  body :: map(),
  opts :: keyword()
) ::
  {:ok, OpenCode.Generated.ProviderAuthAuthorization.t()}
  | {:error, OpenCode.Generated.BadRequestError.t()}

Start OAuth authorization

Start the OAuth authorization flow for a provider.

Options

  • directory
  • workspace

Request Body

Content Types: application/json

provider_oauth_callback(providerID, body, opts \\ [])

@spec provider_oauth_callback(
  providerID :: String.t(),
  body :: map(),
  opts :: keyword()
) ::
  {:ok, boolean()} | {:error, OpenCode.Generated.BadRequestError.t()}

Handle OAuth callback

Handle the OAuth callback from a provider after user authorization.

Options

  • directory
  • workspace

Request Body

Content Types: application/json