Providers
Supported Providers
| Provider | Description |
|---|---|
| Anthropic | Claude model family (Sonnet, Haiku, Opus) |
| OpenAI | GPT-4, GPT-5, o3, o4-mini models |
| Google Vertex AI | Gemini models via Google Cloud |
| Amazon Bedrock | Claude, Llama, Mistral via AWS |
| Azure OpenAI | OpenAI models hosted on Azure |
| Groq | Low-latency inference for open models |
| DeepSeek | DeepSeek-V2, DeepSeek-R1 models |
| Ollama | Local inference for open-source models |
| OpenRouter | Unified API for 200+ models |
| Together AI | Cloud inference for open models |
| xAI | Grok models |
| GitHub Copilot | Copilot-powered models |
| GitLab Duo | GitLab's AI features |
| Hugging Face | Hugging Face Inference Endpoints and Serverless |
| Deep Infra | Serverless GPU inference |
| Fireworks AI | Fast inference for open models |
| Cerebras | Wafer-scale AI acceleration |
| LM Studio | Local model server with OpenAI-compatible API |
| llama.cpp | Lightweight local LLM inference |
| Atomic Chat | Local chat interface with model serving |
| Mistral AI | Mistral models (Large, Small, Codestral) |
| Cohere | Command-R, Command-R+ models |
| Perplexity | PPLX models for search-augmented generation |
| Replicate | Cloud API for open-source models |
| Anyscale | Ray-based model serving |
| AI21 Labs | Jamba, Jurassic-2 models |
| Writer | Palmyra model family |
| OctoAI | Cloud inference platform |
| Lepton AI | Serverless model serving |
| Modal | Cloud functions for AI workloads |
| Noon AI | Korean language model provider |
| Nvidia NIM | GPU-optimized model containers |
| Sambanova | Dataflow architecture for LLMs |
| AI/ML API | OpenAI-compatible API |
And many more via Models.dev. To see the full list:
opencode providers list
Adding Credentials
Use /connect in the TUI to add credentials interactively — no manual file editing needed.
/connect
This opens an interactive prompt where you select a provider and follow the authentication flow. Credentials are stored securely in:
~/.local/share/opencode/auth.json
Authentication Methods
Providers support different authentication mechanisms:
API Key (most common):
/connect anthropic
Then paste your API key when prompted.
OAuth:
Provider Configuration
Provider-specific options are set under the provider key in opencode.json.
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"anthropic": {
"options": {
"baseURL": "https://api.anthropic.com/v1",
"timeout": 600000,
"chunkTimeout": 30000,
"setCacheKey": true
}
},
"openai": {
"options": {
"baseURL": "https://api.openai.com/v1",
"timeout": 600000
}
}
}
}
Provider Options Reference
| Option | Type | Default | Description |
|---|---|---|---|
baseURL | string | Provider default | API endpoint base URL |
timeout | number | 600000 | Request timeout in milliseconds |
chunkTimeout | number | 30000 | Streaming chunk timeout in milliseconds |
setCacheKey | boolean | false | Enable prompt caching (Anthropic) |
reasoningEffort | string | provider default | Reasoning budget (none, low, medium, high) |
thinking | object | null | Extended thinking configuration |
textVerbosity | string | "normal" | Response verbosity level |
Provider-Specific Options
Some providers have unique configuration options.
Amazon Bedrock:
{
"provider": {
"amazon-bedrock": {
"options": {
"region": "us-west-2",
"profile": "my-aws-profile",
"endpoint": "https://bedrock-runtime.us-west-2.amazonaws.com"
}
}
}
}
Google Vertex AI:
{
"provider": {
"google-vertex": {
"options": {
"projectId": "my-gcp-project",
"location": "us-central1"
}
}
}
}
Azure OpenAI:
{
"provider": {
"azure-openai": {
"options": {
"resourceName": "my-resource",
"deploymentId": "gpt-4-deployment",
"apiVersion": "2024-10-01-preview"
}
}
}
}
Custom Providers
Custom providers require an npm package implementing the @ai-sdk/openai-compatible interface.
{
"provider": {
"my-custom-provider": {
"npm": "@ai-sdk/openai-compatible",
"name": "My Internal Provider",
"options": {
"baseURL": "https://api.internal.company.com/v1",
"headers": {
"X-API-Key": "{env:INTERNAL_API_KEY}",
"X-Organization": "engineering"
}
},
"models": {
"internal-llama-3": {
"name": "llama-3-70b-instruct"
},
"internal-mixtral": {
"name": "mixtral-8x22b-instruct"
}
}
}
}
}
Custom Provider Fields
| Field | Required | Description |
|---|---|---|
npm | Yes | The npm package implementing the provider interface |
name | No | Human-readable display name in the TUI |
options | No | Provider options including baseURL, headers, timeout |
models | Yes | Map of model IDs to model definitions |
Custom Headers
Use custom headers for authentication or routing to internal proxy services:
{
"provider": {
"internal-proxy": {
"npm": "@ai-sdk/openai-compatible",
"name": "Internal Proxy",
"options": {
"baseURL": "https://ai-gateway.company.com/v1",
"headers": {
"Authorization": "Bearer {env:GATEWAY_TOKEN}",
"X-Tenant-ID": "engineering"
}
}
}
}
}
Local Model Providers
Local inference engines can be configured as OpenAI-compatible providers by pointing baseURL to the local server.
Ollama
{
"provider": {
"ollama": {
"options": {
"baseURL": "http://localhost:11434/v1"
},
"models": {
"llama3.2": { "name": "llama3.2" },
"mistral": { "name": "mistral" },
"codellama": { "name": "codellama" }
}
}
}
}
LM Studio
{
"provider": {
"lm-studio": {
"npm": "@ai-sdk/openai-compatible",
"name": "LM Studio",
"options": {
"baseURL": "http://localhost:1234/v1"
},
"models": {
"local-model": { "name": "local-model" }
}
}
}
}
llama.cpp
{
"provider": {
"llamacpp": {
"npm": "@ai-sdk/openai-compatible",
"name": "llama.cpp",
"options": {
"baseURL": "http://localhost:8080/v1"
}
}
}
}
Atomic Chat
Atomic Chat provides a built-in local inference server. Configure it like any OpenAI-compatible endpoint:
{
"provider": {
"atomic": {
"npm": "@ai-sdk/openai-compatible",
"name": "Atomic Chat",
"options": {
"baseURL": "http://localhost:1337/v1"
}
}
}
}
Base URL Customization
{
"provider": {
"anthropic": {
"options": {
"baseURL": "https://internal-ai-gateway.company.com/anthropic/v1"
}
}
}
}
Troubleshooting
Check Stored Credentials
List all configured authentication entries:
opencode auth list
This shows which providers have credentials stored and when they were added.
Verify Provider ID
Common provider IDs:
| Config Key | Provider ID |
|---|---|
anthropic | anthropic |
openai | openai |
google-vertex | google-vertex |
amazon-bedrock | amazon-bedrock |
azure-openai | azure-openai |
groq | groq |
deepseek | deepseek |
ollama | ollama |
openrouter | openrouter |
Testing Provider Connectivity
opencode models anthropic
If the models list fails to load, check:
- Network connectivity to the provider
- API key validity
- Base URL correctness
- Proxy settings that might interfere
Error Messages
| Error | Likely Cause |
|---|---|
authentication failed | Missing or invalid API key |
model not found | Incorrect model ID or unavailable model |
rate limit exceeded | Too many requests, wait and retry |
connection refused | Local server not running or wrong port |
timeout | Request exceeded configured timeout |
chunk timeout | Streaming response stalled |
Provider Configuration Inheritance
{
"provider": {
"anthropic": {
"options": {
"timeout": 300000,
"setCacheKey": true
}
}
}
}
Individual model configurations can override provider-level options.