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

# Bring Your Own Model

> Configure custom LLM providers for AI agents in Cube, including supported providers, setup, and billing implications.

> [!NOTE]
>
> Available on the [Enterprise plan](https://cube.dev/pricing).

Bring Your Own Model (BYOM) lets you connect your own LLM provider to power
AI agents in Cube, instead of using the built-in models. This gives you full
control over which models your agents use, where your data is processed, and
how you manage AI costs.

## Supported providers

| Provider | Chat models | Embedding models |
| - | - | - |
| **Anthropic** | Yes | No |
| **OpenAI** | Yes | Yes |
| **AWS Bedrock** | Yes | Yes |
| **GCP Vertex AI** | Yes | No |
| **Databricks** | Yes | No |
| **Snowflake Cortex** | Yes | No |
| **Custom OpenAI-compatible** | Yes | No |
| **Custom Anthropic-compatible** | Yes | No |

## Configuration

### Step 1: Add a model

Before assigning a BYOM model to an agent, you need to register it in the
admin panel:

1. Navigate to **Admin > Models**
2. Click **Add model**
3. Provide a **name** for the model
4. Select the **model type** (LLM or Embedding)
5. Choose a **provider** and **model**
6. Optionally, pick a [small model](#small-model)
7. Enter the required credentials for the provider

### Step 2: Assign the model to an agent

Once a model is registered, reference it in the agents YAML configuration by
name or ID:

```yaml theme={"dark"}
agents:
  - name: sales-analyst
    llm:
      byom:
        name: "my-anthropic-model"
    embedding_llm:
      byom:
        name: "my-bedrock-embeddings"
```

Each agent can use a different model. If no BYOM model is specified, the agent
uses the built-in default.

> [!WARNING]
>
> Switching embedding models for an agent means existing memories stored with
> the previous embedding model will not be compatible. Memories are tied to the
> embedding model that created them.

## Small model

The agent runs short tasks, such as suggested questions and memory, on a
small model. For an LLM on Anthropic, AWS Bedrock, GCP Vertex AI or OpenAI, pick
it in the **Small model** field under **Model**; other providers run these
tasks on the main model. The small model uses the same provider, region and
credentials as the main model.

| Provider | Default small model |
| - | - |
| **Anthropic**, **AWS Bedrock**, **GCP Vertex AI** | Claude Haiku 5.5 |
| **OpenAI** | `gpt-6-luna` |

If your account cannot use the small model (for example, it is not enabled in
your region), the agent runs these tasks on the main model instead.

On AWS Bedrock, the inference profile applies to the main model only; the
small model is called on demand in the configured region.

## Network configuration

If your provider requires IP allowlisting, allowlist the Cube
[egress IP addresses](https://docs.cube.dev/admin/deployment/infrastructure.md#egress-ip-addresses).
Agents that run in the control plane call your provider from the control-plane
addresses; agents that run in a single-tenant or BYOC region call it from that
region's own egress IPs.

## Billing

When using a BYOM model, **Cube AI tokens are not consumed**. You are billed
directly by your model provider based on their pricing.

This means:

* No Cube token quota is deducted for BYOM chat requests
* Administrators can see BYOM requests with their token counts, at no cost,
  in the **AI Tokens Usage** tab, and they're recorded in the
  **AI Calls & Cost** view in [Usage Analytics][ref-usage-analytics]
* Per-seat token grants and token packages do not apply

See [AI Tokens][ref-ai-tokens] for details on how token billing works with
built-in models.

## Provider-specific notes

### Extended thinking

Anthropic, AWS Bedrock, and GCP Vertex AI support extended thinking for
Claude Sonnet 3.7 and all later Claude models. Turn it on or off with the
**Enable thinking** toggle in the model settings. The toggle is on by default
when you add a model.

### Anthropic

Requires an API key.

### AWS Bedrock

* Credentials are optional — if left empty, the default AWS credential chain
  is used (e.g., workload identity)
* Supports assume-role configuration for cross-account access
* Supports inference profiles

### GCP Vertex AI

Requires a service account JSON key for authentication.

### Databricks

Requires a workspace URL and access token.

### Snowflake Cortex

Supports two authentication methods:

* JWT authentication
* Key-pair authentication (requires an encrypted PKCS#8 PEM private key)

### Custom OpenAI-compatible

Points an agent at any endpoint that implements the OpenAI chat completions
API — for example, an internal LLM gateway.

* **Model** and **base URL** are free text; the base URL must use `http` or
  `https` and may not target a loopback or link-local host
* The base URL is the API root, including the version segment: requests go
  to `<base URL>/chat/completions`, so use e.g. `https://gateway.acme.com/v1`
* [Small-model tasks](#small-model) run on the main model
* **API key** is optional — leave it blank if your endpoint authenticates
  requests some other way, such as a custom header
* You can add custom HTTP headers sent with every request. Header values may
  include placeholders resolved per request from the caller's identity:
  `{{userId}}`, `{{userExternalId}}`, `{{email}}`, `{{username}}`,
  `{{tenantId}}`, `{{tenantName}}`, `{{tenantUrl}}`, `{{deploymentId}}`, and
  `{{agentId}}`. A placeholder with no value for a request — `{{userExternalId}}`
  for a user who did not arrive through signed embedding, for example — is sent
  through as literal text

### Custom Anthropic-compatible

Points an agent at any endpoint that implements the Anthropic messages API.
Configuration is the same as [Custom OpenAI-compatible](#custom-openai-compatible):
a free-text model and base URL, an optional API key, and optional custom
headers with the same placeholders.

As with Custom OpenAI-compatible, [small-model tasks](#small-model) run on
the main model.

Unlike the OpenAI-compatible provider, requests go to `<base URL>/v1/messages`,
so leave out the version segment — use `https://gateway.acme.com`, not
`https://gateway.acme.com/v1`. The API key, when set, is sent in the
`x-api-key` header. Extended thinking is not available for this provider.

## Troubleshooting

### Rate limit errors

If you see rate limit errors, the limits are enforced by your model provider,
not by Cube. Check your provider's rate limits and usage quotas.

### Authentication errors

Verify that the API key or credentials configured for the model are valid and
have the necessary permissions.

### Model not found

Ensure the model ID configured in Cube matches a valid model offered by your
provider. Model availability may vary by region.

[ref-ai-tokens]: https://docs.cube.dev/admin/account-billing/ai-tokens.md

[ref-usage-analytics]: https://docs.cube.dev/admin/monitoring/usage-analytics.md


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.