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

# Provider configuration

> Provider-specific configuration details and supported models for all AI providers

OpenCode supports multiple AI providers, each with their own authentication methods and model offerings. This page documents all supported providers and their configuration requirements.

## Supported providers

OpenCode supports the following AI providers (in order of automatic detection priority):

1. **GitHub Copilot** - Free with GitHub Copilot subscription
2. **Anthropic** - Claude models
3. **OpenAI** - GPT models
4. **Google Gemini** - Gemini models
5. **Groq** - Fast inference for open-source models
6. **OpenRouter** - Access to multiple models through one API
7. **AWS Bedrock** - Claude models via AWS
8. **Azure OpenAI** - OpenAI models via Azure
9. **Google Cloud VertexAI** - Gemini models via Google Cloud
10. **xAI** - Grok models

## Anthropic

Provider for Claude models with industry-leading performance.

### Authentication

<ParamField path="ANTHROPIC_API_KEY" type="string" required>
  Your Anthropic API key. Get one at [console.anthropic.com](https://console.anthropic.com)
</ParamField>

### Configuration

```json theme={null}
{
  "providers": {
    "anthropic": {
      "apiKey": "sk-ant-api03-...",
      "disabled": false
    }
  }
}
```

### Supported models

| Model ID            | Name              | Context Window | Default Max Tokens | Cost (Input/Output per 1M tokens) | Features                       |
| ------------------- | ----------------- | -------------- | ------------------ | --------------------------------- | ------------------------------ |
| `claude-4-sonnet`   | Claude 4 Sonnet   | 200,000        | 50,000             | $3.00 / $15.00                    | Extended thinking, attachments |
| `claude-4-opus`     | Claude 4 Opus     | 200,000        | 4,096              | $15.00 / $75.00                   | Attachments                    |
| `claude-3.7-sonnet` | Claude 3.7 Sonnet | 200,000        | 50,000             | $3.00 / $15.00                    | Extended thinking, attachments |
| `claude-3.5-sonnet` | Claude 3.5 Sonnet | 200,000        | 5,000              | $3.00 / $15.00                    | Attachments                    |
| `claude-3.5-haiku`  | Claude 3.5 Haiku  | 200,000        | 4,096              | $0.80 / $4.00                     | Attachments                    |
| `claude-3-opus`     | Claude 3 Opus     | 200,000        | 4,096              | $15.00 / $75.00                   | Attachments                    |
| `claude-3-haiku`    | Claude 3 Haiku    | 200,000        | 4,096              | $0.25 / $1.25                     | Attachments                    |

<Note>
  **Extended thinking** models support the `reasoningEffort` parameter for deeper analysis.
</Note>

## OpenAI

Provider for GPT models including the reasoning-capable o-series.

### Authentication

<ParamField path="OPENAI_API_KEY" type="string" required>
  Your OpenAI API key. Get one at [platform.openai.com](https://platform.openai.com/api-keys)
</ParamField>

### Configuration

```json theme={null}
{
  "providers": {
    "openai": {
      "apiKey": "sk-...",
      "disabled": false
    }
  }
}
```

### Supported models

| Model ID          | Name            | Context Window | Default Max Tokens | Cost (Input/Output per 1M tokens) | Features                               |
| ----------------- | --------------- | -------------- | ------------------ | --------------------------------- | -------------------------------------- |
| `gpt-4.1`         | GPT 4.1         | 1,047,576      | 20,000             | $2.00 / $8.00                     | Attachments, prompt caching            |
| `gpt-4.1-mini`    | GPT 4.1 Mini    | 200,000        | 20,000             | $0.40 / $1.60                     | Attachments, prompt caching            |
| `gpt-4.1-nano`    | GPT 4.1 Nano    | 1,047,576      | 20,000             | $0.10 / $0.40                     | Attachments, prompt caching            |
| `gpt-4.5-preview` | GPT 4.5 Preview | 128,000        | 15,000             | $75.00 / $150.00                  | Attachments, prompt caching            |
| `gpt-4o`          | GPT-4o          | 128,000        | 4,096              | $2.50 / $10.00                    | Attachments, prompt caching            |
| `gpt-4o-mini`     | GPT-4o Mini     | 128,000        | -                  | $0.15 / $0.60                     | Attachments, prompt caching            |
| `o1`              | o1              | 200,000        | 50,000             | $15.00 / $60.00                   | Reasoning, attachments, prompt caching |
| `o1-pro`          | o1 Pro          | 200,000        | 50,000             | $150.00 / $600.00                 | Reasoning, attachments                 |
| `o1-mini`         | o1 Mini         | 128,000        | 50,000             | $1.10 / $4.40                     | Reasoning, attachments, prompt caching |
| `o3`              | o3              | 200,000        | -                  | $10.00 / $40.00                   | Reasoning, attachments, prompt caching |
| `o3-mini`         | o3 Mini         | 200,000        | 50,000             | $1.10 / $4.40                     | Reasoning, prompt caching              |
| `o4-mini`         | o4 Mini         | 128,000        | 50,000             | $1.10 / $4.40                     | Reasoning, attachments, prompt caching |

<Note>
  **Reasoning models** (o-series) support the `reasoningEffort` parameter: `low`, `medium`, or `high`.
</Note>

## Google Gemini

Provider for Gemini models with large context windows.

### Authentication

<ParamField path="GEMINI_API_KEY" type="string" required>
  Your Google AI Studio API key. Get one at [aistudio.google.com](https://aistudio.google.com/app/apikey)
</ParamField>

### Configuration

```json theme={null}
{
  "providers": {
    "gemini": {
      "apiKey": "AI...",
      "disabled": false
    }
  }
}
```

### Supported models

| Model ID                | Name                  | Context Window | Default Max Tokens | Cost (Input/Output per 1M tokens) | Features    |
| ----------------------- | --------------------- | -------------- | ------------------ | --------------------------------- | ----------- |
| `gemini-2.5`            | Gemini 2.5 Pro        | 1,000,000      | 50,000             | $1.25 / $10.00                    | Attachments |
| `gemini-2.5-flash`      | Gemini 2.5 Flash      | 1,000,000      | 50,000             | $0.15 / $0.60                     | Attachments |
| `gemini-2.0-flash`      | Gemini 2.0 Flash      | 1,000,000      | 6,000              | $0.10 / $0.40                     | Attachments |
| `gemini-2.0-flash-lite` | Gemini 2.0 Flash Lite | 1,000,000      | 6,000              | $0.05 / $0.30                     | Attachments |

## Groq

Provider for fast inference with open-source models.

### Authentication

<ParamField path="GROQ_API_KEY" type="string" required>
  Your Groq API key. Get one at [console.groq.com](https://console.groq.com/keys)
</ParamField>

### Configuration

```json theme={null}
{
  "providers": {
    "groq": {
      "apiKey": "gsk_...",
      "disabled": false
    }
  }
}
```

### Supported models

| Model ID                                        | Name                    | Context Window | Cost (Input/Output per 1M tokens) |
| ----------------------------------------------- | ----------------------- | -------------- | --------------------------------- |
| `qwen-qwq`                                      | Qwen QwQ 32B            | 128,000        | $0.29 / $0.39                     |
| `llama-3.3-70b-versatile`                       | Llama 3.3 70B Versatile | 128,000        | $0.59 / $0.79                     |
| `meta-llama/llama-4-scout-17b-16e-instruct`     | Llama 4 Scout           | 128,000        | $0.11 / $0.34                     |
| `meta-llama/llama-4-maverick-17b-128e-instruct` | Llama 4 Maverick        | 128,000        | $0.20 / $0.20                     |
| `deepseek-r1-distill-llama-70b`                 | DeepSeek R1 Distill     | 128,000        | $0.75 / $0.99                     |

## OpenRouter

Provider for accessing multiple models through a single API.

### Authentication

<ParamField path="OPENROUTER_API_KEY" type="string" required>
  Your OpenRouter API key. Get one at [openrouter.ai/keys](https://openrouter.ai/keys)
</ParamField>

### Configuration

```json theme={null}
{
  "providers": {
    "openrouter": {
      "apiKey": "sk-or-...",
      "disabled": false
    }
  }
}
```

### Supported models

OpenRouter provides access to models from multiple providers. Prefix model IDs with `openrouter.`:

* `openrouter.gpt-4.1`, `openrouter.gpt-4.1-mini`, `openrouter.gpt-4.1-nano`
* `openrouter.o1`, `openrouter.o1-mini`, `openrouter.o3`, `openrouter.o3-mini`, `openrouter.o4-mini`
* `openrouter.claude-3.7-sonnet`, `openrouter.claude-3.5-sonnet`, `openrouter.claude-3.5-haiku`
* `openrouter.gemini-2.5`, `openrouter.gemini-2.5-flash`
* `openrouter.deepseek-r1-free` - Free access to DeepSeek R1

<Note>
  Pricing matches the underlying provider. See OpenRouter's [model pricing](https://openrouter.ai/models) for details.
</Note>

## AWS Bedrock

Provider for Claude models via AWS infrastructure.

### Authentication

Bedrock uses AWS credentials. OpenCode detects credentials in this order:

1. `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` environment variables
2. `AWS_PROFILE` or `AWS_DEFAULT_PROFILE` environment variables
3. EC2 instance profiles or ECS task roles

<ParamField path="AWS_REGION" type="string" default="us-east-1">
  AWS region for Bedrock (e.g., `us-east-1`, `us-west-2`)
</ParamField>

### Configuration

```json theme={null}
{
  "providers": {
    "bedrock": {
      "disabled": false
    }
  }
}
```

### Supported models

| Model ID                    | Name              | Cost (Input/Output per 1M tokens) |
| --------------------------- | ----------------- | --------------------------------- |
| `bedrock.claude-3.7-sonnet` | Claude 3.7 Sonnet | $3.00 / $15.00                    |

<Note>
  Bedrock models automatically disable prompt caching as it's not supported in the Bedrock API.
</Note>

## Azure OpenAI

Provider for OpenAI models via Azure infrastructure.

### Authentication

Azure OpenAI supports two authentication methods:

**API Key authentication:**

<ParamField path="AZURE_OPENAI_ENDPOINT" type="string" required>
  Your Azure OpenAI endpoint (e.g., `https://your-resource.openai.azure.com`)
</ParamField>

<ParamField path="AZURE_OPENAI_API_KEY" type="string">
  Your Azure OpenAI API key (optional when using Entra ID)
</ParamField>

<ParamField path="AZURE_OPENAI_API_VERSION" type="string" default="2025-04-01-preview">
  Azure OpenAI API version
</ParamField>

**Entra ID authentication:**

If `AZURE_OPENAI_API_KEY` is not provided, OpenCode uses Azure's DefaultAzureCredential for authentication.

### Configuration

```json theme={null}
{
  "providers": {
    "azure": {
      "apiKey": "your-key",
      "disabled": false
    }
  }
}
```

### Supported models

Azure OpenAI supports the same models as OpenAI. Prefix model IDs with `azure.`:

* `azure.gpt-4.1`, `azure.gpt-4.1-mini`, `azure.gpt-4.1-nano`
* `azure.gpt-4o`, `azure.gpt-4o-mini`
* `azure.o1`, `azure.o1-mini`, `azure.o3`, `azure.o3-mini`, `azure.o4-mini`

<Note>
  Pricing is similar to OpenAI's standard pricing but may vary by region.
</Note>

## Google Cloud VertexAI

Provider for Gemini models via Google Cloud infrastructure.

### Authentication

VertexAI uses Google Cloud credentials. OpenCode detects credentials when these environment variables are set:

<ParamField path="VERTEXAI_PROJECT" type="string" required>
  Your Google Cloud project ID
</ParamField>

<ParamField path="VERTEXAI_LOCATION" type="string" required>
  Google Cloud region (e.g., `us-central1`)
</ParamField>

Alternatively:

* `GOOGLE_CLOUD_PROJECT` and `GOOGLE_CLOUD_REGION` (or `GOOGLE_CLOUD_LOCATION`)

### Configuration

```json theme={null}
{
  "providers": {
    "vertexai": {
      "disabled": false
    }
  }
}
```

### Supported models

\| Model ID | Name | Context Window | Default Max Tokens |
\|----------|------|----------------|--------------------|---|
\| `vertexai.gemini-2.5` | Gemini 2.5 Pro | 1,000,000 | 50,000 |
\| `vertexai.gemini-2.5-flash` | Gemini 2.5 Flash | 1,000,000 | 50,000 |

## GitHub Copilot

Provider for models via GitHub Copilot subscription. Includes access to multiple models at no additional cost.

### Authentication

GitHub Copilot authentication is auto-detected from:

1. `GITHUB_TOKEN` environment variable
2. GitHub Copilot CLI configuration:
   * `~/.config/github-copilot/hosts.json` (Linux/macOS)
   * `~/.config/github-copilot/apps.json` (Linux/macOS)
   * `%LOCALAPPDATA%\github-copilot\` (Windows)

### Configuration

```json theme={null}
{
  "providers": {
    "copilot": {
      "disabled": false
    }
  }
}
```

### Supported models

All models are included with GitHub Copilot subscription at \$0 cost:

| Model ID                    | Name              | Context Window | Default Max Tokens | Features               |
| --------------------------- | ----------------- | -------------- | ------------------ | ---------------------- |
| `copilot.gpt-4.1`           | GPT 4.1           | 128,000        | 16,384             | Reasoning, attachments |
| `copilot.gpt-4o`            | GPT-4o            | 128,000        | 16,384             | Attachments            |
| `copilot.gpt-4o-mini`       | GPT-4o Mini       | 128,000        | 4,096              | Attachments            |
| `copilot.claude-3.7-sonnet` | Claude 3.7 Sonnet | 200,000        | 16,384             | Attachments            |
| `copilot.claude-sonnet-4`   | Claude Sonnet 4   | 128,000        | 16,000             | Attachments            |
| `copilot.o1`                | o1                | 200,000        | 100,000            | Reasoning              |
| `copilot.o3-mini`           | o3-mini           | 200,000        | 100,000            | Reasoning              |
| `copilot.o4-mini`           | o4-mini           | 128,000        | 16,384             | Reasoning, attachments |
| `copilot.gemini-2.5-pro`    | Gemini 2.5 Pro    | 128,000        | 64,000             | Attachments            |
| `copilot.gemini-2.0-flash`  | Gemini 2.0 Flash  | 1,000,000      | 8,192              | Attachments            |

<Note>
  GitHub Copilot provides the best value with access to multiple providers at no additional cost beyond the subscription.
</Note>

## xAI

Provider for Grok models.

### Authentication

<ParamField path="XAI_API_KEY" type="string" required>
  Your xAI API key
</ParamField>

### Configuration

```json theme={null}
{
  "providers": {
    "xai": {
      "apiKey": "xai-...",
      "disabled": false
    }
  }
}
```

### Supported models

\| Model ID | Name | Context Window | Default Max Tokens | Cost (Input/Output per 1M tokens) |
\|----------|------|----------------|--------------------|------------------------------------|---|
\| `grok-3-beta` | Grok 3 Beta | 131,072 | 20,000 | $3.00 / $15.00 |
\| `grok-3-mini-beta` | Grok 3 Mini Beta | 131,072 | 20,000 | $0.30 / $0.50 |
\| `grok-3-fast-beta` | Grok 3 Fast Beta | 131,072 | 20,000 | $5.00 / $25.00 |
\| `grok-3-mini-fast-beta` | Grok 3 Mini Fast Beta | 131,072 | 20,000 | $0.60 / $4.00 |

## Default model selection

OpenCode automatically selects default models based on available providers in this priority order:

1. **GitHub Copilot** → `copilot.gpt-4o`
2. **Anthropic** → `claude-4-sonnet`
3. **OpenAI** → `gpt-4.1` (coder), `gpt-4.1-mini` (task/title)
4. **Gemini** → `gemini-2.5` (coder), `gemini-2.5-flash` (task/title)
5. **Groq** → `qwen-qwq`
6. **OpenRouter** → `openrouter.claude-3.7-sonnet`
7. **xAI** → `grok-3-beta`
8. **AWS Bedrock** → `bedrock.claude-3.7-sonnet`
9. **Azure OpenAI** → `azure.gpt-4.1`
10. **VertexAI** → `vertexai.gemini-2.5`

<Note>
  You can override defaults by explicitly configuring the `agents` section in your configuration file.
</Note>
