> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cake.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Configure Model Providers

> Add and maintain the providers and models available to Cake Agents sessions.

Providers are configured by administrators in the Cake Agents settings UI and made available to user sessions.

## What You Configure

Providers define which OpenCode providers and models Cake Agents can use for session execution.

They typically include:

* provider identity
* display name
* base URL or endpoint
* authentication details such as API keys or auth headers
* the list of models users may select

Cake passes these provider definitions into the OpenCode runtime for each session.

For the provider schema and provider-specific examples, see the [OpenCode providers documentation](https://opencode.ai/docs/providers/).

## How Cake Uses Providers

When a session starts, Cake builds the OpenCode configuration for that session from the providers currently configured in the control plane.

That means:

* providers are managed centrally
* sessions use the approved provider definitions
* users can only pick from models that admins have configured

If no providers are configured, users cannot start sessions.

## Configure Providers in the UI

1. Sign in to Cake Agents as an administrator.
2. Open `Settings`.
3. Navigate to `Providers`.
4. Add or edit the provider JSON configuration.
5. Enter the provider details you want to expose.
6. Add any required secrets such as API keys or authorization headers.
7. Define the models that users should be able to select.
8. Save the provider configuration.
9. Create a test session and verify the expected models appear in the model picker.

## Recommended Workflow

1. Decide which provider backends you want to expose.
2. Start from the provider format documented by OpenCode.
3. Add only the models you intend users to access.
4. Save the configuration in `Settings > Providers`.
5. Verify that new sessions can start successfully.

## Example Configurations

Anthropic example:

```json theme={null}
{
  "anthropic": {
    "models": {
      "claude-sonnet-4-6": {}
    },
    "npm": "@ai-sdk/anthropic",
    "options": {
      "apiKey": "%%SECRET%%"
    }
  }
}
```

OpenAI example:

```json theme={null}
{
  "openai": {
    "models": {
      "gpt-5": {},
      "gpt-5-mini": {}
    },
    "npm": "@ai-sdk/openai",
    "options": {
      "apiKey": "%%SECRET%%"
    }
  }
}
```

In these examples:

* the top-level key is the provider ID
* `models` defines the models users can choose from
* `npm` selects the OpenCode provider package
* `options` contains provider-specific configuration such as the API key

Use the redacted `%%SECRET%%` placeholder in the UI when editing an existing saved secret value.

If your settings UI supports separate secret fields, prefer storing API keys and auth headers as secrets rather than inline JSON.

## LiteLLM Gotchas

If you are using LiteLLM as a proxy in front of multiple upstream providers (OpenAI, Anthropic, etc.), configure a separate Cake provider entry for each upstream provider.

Each provider entry must use the corresponding `npm` package for that upstream, even if the `baseURL` points at the same LiteLLM instance.

Example (two providers that both route through the same LiteLLM base URL):

```json theme={null}
{
  "litellm-openai": {
    "models": {
      "openai/gpt-5.2": {},
      "openai/gpt-5.4": {}
    },
    "npm": "@ai-sdk/openai",
    "options": {
      "apiKey": "%%SECRET%%",
      "baseURL": "http://litellm.example.com/v1"
    }
  },
  "litellm-anthropic": {
    "models": {
      "claude-opus-4-6": {},
      "claude-sonnet-4-6": {},
      "claude-sonnet-4-7": {}
    },
    "npm": "@ai-sdk/anthropic",
    "options": {
      "apiKey": "%%SECRET%%",
      "baseURL": "http://litellm.example.com/v1"
    }
  }
}
```

## Operational Notes

* Treat provider credentials as environment-scoped secrets.
* Limit the available models to the set you want users to rely on.
* Review provider settings whenever endpoint URLs, auth material, or model names change.
* Test session creation after any provider change.
