Providers
Using any LLM provider in OpenCode.
OpenCode uses the AI SDK and Models.dev to support 75+ LLM providers and it supports running local models.
To add a provider you need to:
- Add the API keys for the provider using the
/connectcommand. - Configure the provider in your OpenCode config.
Credentials
When you add a provider’s API keys with the /connect command, they are stored in ~/.local/share/opencode/auth.json.
Config
You can customize the providers through the provider section in your OpenCode config.
opencode.json
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"anthropic": {
"options": {
"baseURL": "https://api.anthropic.com/v1"
}
}
}
}
OpenCode Zen
OpenCode Zen is a list of models provided by the OpenCode team that have been tested and verified to work well with OpenCode.
[!TIP] If you are new, we recommend starting with OpenCode Zen.
- Run the
/connectcommand in the TUI, selectOpenCode Zen, and head to opencode.ai/auth. - Sign in, add your billing details, and copy your API key.
- Paste your API key.
- Run
/modelsin the TUI to see the list of models we recommend.
OpenCode Go
OpenCode Go is a low cost subscription plan that provides reliable access to popular open coding models.
- Run the
/connectcommand in the TUI, selectOpenCode Go. - Sign in, add your billing details, and copy your API key.
- Paste your API key.
- Run
/modelsin the TUI to see the list of models.
Directory
Anthropic
- Run
/connectand select Anthropic. - Select Claude Pro/Max option or Manually enter API Key.
- Run
/modelsto see available models.
[!NOTE] Anthropic explicitly prohibits using Claude Pro/Max subscription with third-party tools. Previous versions of OpenCode bundled plugins for this but that is no longer the case as of 1.3.0.
OpenAI
- Run
/connectand select OpenAI. - Select ChatGPT Plus/Pro or Manually enter API Key.
- Run
/modelsto see available models.
Amazon Bedrock
To use Amazon Bedrock with OpenCode:
-
Request access to models in the Amazon Bedrock console.
-
Configure authentication:
Environment Variables:
# Using AWS access keys
AWS_ACCESS_KEY_ID=XXX AWS_SECRET_ACCESS_KEY=YYY opencode
# Using an AWS profile
AWS_PROFILE=my-profile opencode
# Using a Bedrock bearer token
AWS_BEARER_TOKEN_BEDROCK=XXX opencode
Configuration File (Recommended): opencode.json
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"amazon-bedrock": {
"options": {
"region": "us-east-1",
"profile": "my-aws-profile"
}
}
}
}
Available options:
region- AWS region (e.g.us-east-1,eu-west-1)profile- Named AWS profile from~/.aws/credentialsendpoint- Custom URL for a VPC endpoint (alias of baseURL)
Azure OpenAI
- Create an Azure OpenAI resource in the Azure portal.
- Deploy a model in Azure AI Foundry.
- Run
/connectand search for Azure. - Enter your API key.
- Set your resource name as an environment variable:
AZURE_RESOURCE_NAME=XXX opencode
[!NOTE] If you encounter “I cannot assist with that request” errors, try changing the content filter from DefaultV2 to Default.
Google Vertex AI
- Enable Vertex AI API in your Google Cloud project.
- Set required environment variables:
GOOGLE_APPLICATION_CREDENTIALS=/path/to/service-account.json
GOOGLE_CLOUD_PROJECT=your-project-id
VERTEX_LOCATION=global
- Run
/modelsto select a model.
Ollama
opencode.json
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"ollama": {
"npm": "@ai-sdk/openai-compatible",
"name": "Ollama (local)",
"options": {
"baseURL": "http://localhost:11434/v1"
},
"models": {
"llama2": {
"name": "Llama 2"
}
}
}
}
}
[!TIP] If tool calls aren’t working, try increasing
num_ctxin Ollama. Start around 16k - 32k.
LM Studio
opencode.json
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"lmstudio": {
"npm": "@ai-sdk/openai-compatible",
"name": "LM Studio (local)",
"options": {
"baseURL": "http://127.0.0.1:1234/v1"
},
"models": {
"google/gemma-3n-e4b": {
"name": "Gemma 3n-e4b (local)"
}
}
}
}
}
OpenRouter
- Create an API key in the OpenRouter dashboard.
- Run
/connectand search for OpenRouter. - Enter your API key.
- Run
/modelsto select a model.
{
"provider": {
"openrouter": {
"models": {
"somecoolnewmodel": {}
}
}
}
}
DeepSeek
- Create an account at DeepSeek console.
- Create a new API key.
- Run
/connectand search for DeepSeek. - Enter your API key.
- Run
/modelsto select a model like DeepSeek V4 Pro.
GitLab Duo
[!EXPERIMENTAL] GitLab Duo support in OpenCode is experimental.
OpenCode integrates with the GitLab Duo Agent Platform.
License requirements:
- Premium or Ultimate GitLab subscription
- Available on GitLab.com and GitLab Self-Managed
- Run
/connectand select GitLab. - Choose OAuth or Personal Access Token.
- Run
/modelsto see available models.
Three Claude-based models are available:
- duo-chat-haiku-4-5 (Default) - Fast responses
- duo-chat-sonnet-4-5 - Balanced performance
- duo-chat-opus-4-5 - Most capable
GitHub Copilot
- Run
/connectand search for GitHub Copilot. - Navigate to github.com/login/device and enter the code.
- Run
/modelsto select the model.
[!NOTE] Some models might need a Pro+ subscription.
Cloudflare AI Gateway
- Create a gateway in Cloudflare dashboard (AI > AI Gateway).
- Run
/connectand search for Cloudflare AI Gateway. - Enter Account ID, Gateway ID, and API token.
- Run
/modelsto select a model.
Hugging Face
- Create a token with inference.serverless.write permission.
- Run
/connectand search for Hugging Face. - Enter your token.
- Run
/modelsto select a model.
NVIDIA
NVIDIA provides access to Nemotron models and other open models through build.nvidia.com.
- Generate an API key at build.nvidia.com.
- Run
/connectand search for NVIDIA. - Enter your API key.
- Run
/modelsto select a model.
On-Prem / NIM:
{
"provider": {
"nvidia": {
"options": {
"baseURL": "http://localhost:8000/v1"
}
}
}
}
Groq
- Create an API key at Groq console.
- Run
/connectand search for Groq. - Enter the API key.
- Run
/modelsto select a model.
Cerebras
- Create an account at Cerebras console.
- Generate an API key.
- Run
/connectand search for Cerebras. - Run
/modelsto select a model like Qwen 3 Coder 480B.
Together AI
- Create an account at Together AI.
- Generate an API key.
- Run
/connectand search for Together AI. - Run
/modelsto select a model.
Fireworks AI
- Create an account at Fireworks AI console.
- Create an API key.
- Run
/connectand search for Fireworks AI. - Run
/modelsto select a model.
Cohere
- Create an account and get an API key from the Cohere dashboard.
- Run
/connectand search for Cohere. - Enter your API key.
- Run
/modelsto select a model.
302.AI
- Create an account at 302.AI and generate an API key.
- Run
/connectand search for 302.AI. - Enter your API key.
- Run
/modelsto select a model.
Atomic Chat
Atomic Chat is a desktop app that runs local models behind an OpenAI-compatible server (127.0.0.1:1337). Configure it directly in opencode.json:
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"atomic-chat": {
"npm": "@ai-sdk/openai-compatible",
"name": "Atomic Chat (local)",
"options": {
"baseURL": "http://127.0.0.1:1337/v1"
},
"models": {
"<your-model-id>": {}
}
}
}
}
Replace <your-model-id> with a model id returned by the server, then run /models to select it.
Azure Cognitive Services
- Create an Azure OpenAI resource and deploy a model at Azure AI — the deployment name must match the model name.
- Run
/connectand search for Azure Cognitive Services. - Enter your API key.
- Set the
AZURE_COGNITIVE_SERVICES_RESOURCE_NAMEenvironment variable to your resource name. - Run
/modelsto select your deployed model.
Baseten
- Create an account at Baseten and generate an API key.
- Run
/connectand search for Baseten. - Enter your API key.
- Run
/modelsto select a model.
Cloudflare Workers AI
- Grab your Account ID and create an API token under Workers AI in the Cloudflare dashboard.
- Run
/connectand search for Cloudflare Workers AI. - Enter your Account ID and API token.
- Run
/modelsto select a model.
Cortecs
- Create an account at Cortecs and generate an API key.
- Run
/connectand search for Cortecs. - Enter your API key.
- Run
/modelsto select a model like Kimi K2 Instruct.
Deep Infra
- Create an account at Deep Infra and generate an API key.
- Run
/connectand search for Deep Infra. - Enter your API key.
- Run
/modelsto select a model.
DigitalOcean
- Sign in to your DigitalOcean account.
- Run
/connectand search for DigitalOcean. - Choose Login with DigitalOcean (OAuth) or paste a Model Access Key.
- Run
/modelsto select a model — Inference Routers appear asrouter:<name>.
FrogBot
- Create an account at FrogBot and generate an API key.
- Run
/connectand search for FrogBot. - Enter your API key.
- Run
/modelsto select a model.
GMI Cloud
- Create an API key in the GMI Cloud console.
- Run
/connectand search for GMI Cloud. - Enter your API key.
- Run
/modelsto select a model.
Helicone
Helicone provides LLM logging, monitoring, and an AI Gateway that routes requests based on the model.
- Create an account at Helicone and generate an API key.
- Run
/connectand search for Helicone. - Enter your API key.
- Run
/modelsto select a model.
IO.NET
- Create an account at IO.NET and generate an API key.
- Run
/connectand search for IO.NET. - Enter your API key.
- Run
/modelsto select a model.
llama.cpp
llama.cpp serves local models through its OpenAI-compatible llama-server.
- Start the local server:
llama-server --port 8080. - Add the provider to your
opencode.json, pointing at the local endpoint:
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"llama.cpp": {
"npm": "@ai-sdk/openai-compatible",
"name": "llama-server (local)",
"options": {
"baseURL": "http://localhost:8080/v1"
},
"models": {
"qwen3-coder:a3b": {}
}
}
}
}
- Run
/modelsto select your local model.
LLM Gateway
- Create an API key in the LLM Gateway dashboard.
- Run
/connectand search for LLM Gateway. - Enter your API key.
- Run
/modelsto select a model — many models are preloaded by default.
MiniMax
- Create an account at MiniMax and generate an API key.
- Run
/connectand search for MiniMax. - Enter your API key.
- Run
/modelsto select a model like M2.1.
Modal
- Create a shared Endpoint for your model and generate a proxy token.
- Join the token ID and secret with a period, e.g.
wk-<id>.ws-<secret>. - Run
/connect, search for Modal, and enter the combined token. - Run
/modelsto select one of the endpoints in your workspace.
Moonshot AI
- Create an account at the Moonshot AI console and create an API key.
- Run
/connectand search for Moonshot AI. - Enter your API key.
- Run
/modelsto select a model like Kimi K2.
Nebius Token Factory
- Create an account at Nebius Token Factory and click Add Key.
- Run
/connectand search for Nebius Token Factory. - Enter your API key.
- Run
/modelsto select a model like Kimi K2 Instruct.
Ollama Cloud
- Sign in or create an account at ollama.com.
- Go to Settings → Keys and create an API key.
- Run
/connectand search for Ollama Cloud. - Enter your API key.
- Run
/modelsto select a cloud model.
OVHcloud AI Endpoints
- Create an API key in the Public Cloud AI Endpoints section of the OVHcloud manager.
- Run
/connectand search for OVHcloud AI Endpoints. - Enter your API key.
- Run
/modelsto select a model like gpt-oss-120b.
Poolside
- Sign in at Poolside, open the API Keys tab, and click New key.
- Run
/connectand search for Poolside. - Enter your API key.
- Run
/modelsto select a model.
SAP AI Core
- Navigate to your SAP AI Core service instance in the SAP BTP Cockpit and create a service key.
- Run
/connectand search for SAP AI Core. - Paste the service key JSON.
- Run
/modelsto select a model.
Scaleway
- Generate an API key in the IAM settings of the Scaleway console.
- Run
/connectand search for Scaleway. - Enter your API key.
- Run
/modelsto select a model like gpt-oss-120b.
SCX.ai
- Create an account on the SCX.ai platform and generate an API key.
- Run
/connectand search for SCX.ai. - Enter your API key.
- Run
/modelsto select a model like GLM-5.2.
Snowflake Cortex
Frontier models served inside the Snowflake perimeter; tool calling support is limited to the Claude and OpenAI families.
- Create an account at Snowflake.
- Run
/connectand search for Snowflake Cortex. - Select Login with Snowflake (External Browser) and complete sign-in in your browser, or paste a Programmatic Access Token.
- Run
/modelsto select a model.
STACKIT
- Create an auth token for your project under AI Model Serving in the STACKIT Portal.
- Run
/connectand search for STACKIT. - Enter your auth token.
- Run
/modelsto select a model like Qwen3-VL 235B.
Venice AI
- Create an account at Venice AI and generate an API key.
- Run
/connectand search for Venice AI. - Enter your API key.
- Run
/modelsto select a model like Llama 3.3 70B.
Vercel AI Gateway
Access models from many providers through one unified endpoint.
- Create an API key under AI Gateway in the Vercel dashboard.
- Run
/connectand search for Vercel AI Gateway. - Enter your API key.
- Run
/modelsto select a model.
xAI
- Create an account at the xAI console and generate an API key, or plan to authenticate with a SuperGrok subscription.
- Run
/connectand search for xAI. - Enter your API key, or select SuperGrok Subscription to log in via device code.
- Run
/modelsto select a Grok model.
Z.AI
- Create an account at the Z.AI API console and create a new API key.
- Run
/connectand search for Z.AI — pick Z.AI Coding Plan if you subscribe to the GLM Coding Plan. - Enter your API key.
- Run
/modelsto select a model like GLM-4.7.
ZenMux
- Create an API key in the ZenMux dashboard.
- Run
/connectand search for ZenMux. - Enter your API key.
- Run
/modelsto select a model — many models are preloaded by default.
Other Providers
OpenCode supports 75+ providers including:
- 302.AI
- Atomic Chat
- Azure Cognitive Services
- Baseten
- Cloudflare Workers AI
- Cortecs
- Deep Infra
- DigitalOcean
- FrogBot
- IO.NET
- MiniMax
- Moonshot AI
- Nebius Token Factory
- Ollama Cloud
- SAP AI Core
- Scaleway
- Venice AI
- Vercel AI Gateway
- xAI
- Z.AI
- ZenMux
Custom provider
opencode.json
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"custom-provider": {
"npm": "@ai-sdk/openai-compatible",
"name": "Custom Provider",
"options": {
"baseURL": "https://api.example.com/v1"
},
"models": {
"model-id": {
"name": "Custom Model Name"
}
}
}
}
}
Troubleshooting
Provider not loading
- Check if API key is set:
opencode debug config - Verify environment variables are set correctly
- Check if provider supports your region
Authentication errors
- Verify API key is correct
- Check if subscription is active
- Ensure required scopes are granted
Rate limits
Consider using:
- A proxy/gateway with rate limiting (Cloudflare AI Gateway, Helicone)
- Provider-specific rate limit configurations
- Multiple provider accounts