Skip to content

OpenCode Models & LLM Providers

OpenCode is model-agnostic and supports 75+ LLM providers through AI SDK and Models.dev. Use built-in free models, connect your existing subscriptions, or bring your own API keys.


Providers

Most popular providers are preloaded by default. If you’ve added the credentials for a provider through the /connect command, they’ll be available when you start OpenCode.

Learn more about providers.


Select a model

Once you’ve configured your provider you can select the model you want by typing in:

/models

There are a lot of models out there, with new models coming out every week.

Tip Consider using one of the models we recommend.

However, there are only a few of them that are good at both generating code and tool calling.

Here are several models that work well with OpenCode (sorted by recommendation, not exhaustive):

ModelProviderHighlights
GPT 5.5OpenAILatest flagship, strongest overall
Claude Fable 5AnthropicNewest Claude, exceptional reasoning
Claude Sonnet 4.6AnthropicBest value, excellent code understanding
GPT 5.4OpenAIStable, widely used
Gemini 3.5 FlashGoogleUltra-fast, large context
Qwen3.7 MaxAlibabaBest Chinese language understanding
DeepSeek V4 FlashDeepSeekHigh cost-performance ratio
MiniMax M2.7MiniMaxBalanced performance

Set a default

To set one of these as the default model, you can set the model key in your OpenCode config.

opencode.json

{
  "$schema": "https://opencode.ai/config.json",
  "model": "anthropic/claude-fable-5"
}

Here the full ID is provider_id/model_id. For example, if you’re using OpenCode Zen, you would use opencode/gpt-5.5 for GPT 5.5.

If you’ve configured a custom provider, the provider_id is key from the provider part of your config, and the model_id is the key from provider.models.


Configure models

You can globally configure a model’s options through the config.

opencode.jsonc

{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "openai": {
      "models": {
        "gpt-5.5": {
          "options": {
            "reasoningEffort": "high",
            "textVerbosity": "low",
            "reasoningSummary": "auto",
            "include": ["reasoning.encrypted_content"]
          }
        }
      }
    },
    "anthropic": {
      "models": {
        "claude-fable-5": {
          "options": {
            "thinking": {
              "type": "enabled",
              "budgetTokens": 16000
            }
          }
        }
      }
    }
  }
}

Here we’re configuring global settings for two built-in models: gpt-5.5 when accessed via the openai provider, and claude-fable-5 when accessed via the anthropic provider. The built-in provider and model names can be found on Models.dev.

You can also configure these options for any agents that you are using. The agent config overrides any global options here. Learn more.

You can also define custom variants that extend built-in ones. Variants let you configure different settings for the same model without creating duplicate entries:

opencode.jsonc

{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "opencode": {
      "models": {
        "gpt-5.5": {
          "variants": {
            "high": {
              "reasoningEffort": "high",
              "textVerbosity": "low",
              "reasoningSummary": "auto"
            },
            "low": {
              "reasoningEffort": "low",
              "textVerbosity": "low",
              "reasoningSummary": "auto"
            }
          }
        }
      }
    }
  }
}

Variants

Many models support multiple variants with different configurations. OpenCode ships with built-in default variants for popular providers.

Built-in variants

OpenCode ships with default variants for many providers:

Anthropic:

  • high - High thinking budget (default)
  • max - Maximum thinking budget

OpenAI:

Varies by model but roughly:

  • none - No reasoning
  • minimal - Minimal reasoning effort
  • low - Low reasoning effort
  • medium - Medium reasoning effort
  • high - High reasoning effort
  • xhigh - Extra high reasoning effort

Google:

  • low - Lower effort/token budget
  • high - Higher effort/token budget

Tip This list is not comprehensive. Many other providers have built-in defaults too.

Custom variants

You can override existing variants or add your own:

opencode.jsonc

{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "openai": {
      "models": {
        "gpt-5.5": {
          "variants": {
            "thinking": {
              "reasoningEffort": "high",
              "textVerbosity": "low"
            },
            "fast": {
              "disabled": true
            }
          }
        }
      }
    }
  }
}

Cycle variants

Use the keybind variant_cycle to quickly switch between variants. Learn more.


Built-in Models (Zen)

The easiest way to get started is with OpenCode Zen - no API key required:

opencode auth login --provider zen

See OpenCode Zen for detailed information about built-in models.


Major Providers

Anthropic (Claude)

Claude models are known for excellent reasoning and code understanding.

Latest Available Models:

  • Claude Fable 5 (latest flagship)
  • Claude Opus 4.8, 4.7, 4.6, 4.5
  • Claude Sonnet 4.6, 4.5
  • Claude Haiku 4.5

Setup:

opencode auth login --provider anthropic

Or configure manually:

{
  "provider": "anthropic",
  "apiKey": "sk-ant-..."
}

Use Cases:

  • Complex reasoning: Best for multi-step problem solving
  • Code understanding: Excellent at analyzing large codebases
  • Documentation: Great for generating detailed documentation

Get API Key: Anthropic Console


OpenAI (GPT)

GPT models excel at general-purpose coding tasks and have strong tool use capabilities.

Latest Available Models:

  • GPT 5.5, GPT 5.5 Pro (latest flagship)
  • GPT 5.4, GPT 5.4 Pro, GPT 5.4 Mini, GPT 5.4 Nano
  • GPT 5.3 Codex, GPT 5.3 Codex Spark
  • GPT 5.2, GPT 5.2 Codex
  • GPT 5.1, GPT 5.1 Codex

Setup:

opencode auth login --provider openai

Or configure manually:

{
  "provider": "openai",
  "apiKey": "sk-..."
}

Use Cases:

  • General coding: Well-rounded for most coding tasks
  • Fast iterations: Quick responses for rapid development
  • Tool integration: Strong function calling capabilities

Get API Key: OpenAI Platform


Google (Gemini)

Gemini models offer large context windows and strong multimodal capabilities.

Latest Available Models:

  • Gemini 3.5 Flash (recommended, ultra-fast)
  • Gemini 3.1 Pro (large context)
  • Gemini 3 Flash

Setup:

opencode auth login --provider google

Or configure manually:

{
  "provider": "google",
  "apiKey": "AIza..."
}

Use Cases:

  • Large codebases: Extra large context window
  • Fast responses: Flash models for quick tasks
  • Multimodal: Can analyze images and diagrams

Get API Key: Google AI Studio


Alibaba Cloud (Qwen)

Qwen models excel at Chinese language understanding and code generation.

Latest Available Models:

  • Qwen3.7 Max (flagship)
  • Qwen3.7 Plus
  • Qwen3.6 Plus
  • Qwen3.5 Plus

Setup:

opencode auth login --provider qwen

Use Cases:

  • Chinese coding: Best Chinese language understanding
  • Code generation: Optimized for programming
  • Cost-effective: Relatively low pricing

DeepSeek

DeepSeek provides high cost-performance coding models.

Latest Available Models:

  • DeepSeek V4 Flash (paid)
  • DeepSeek V4 Flash Free (free, limited time)

Setup:

opencode auth login --provider deepseek

MiniMax

MiniMax provides balanced performance models.

Latest Available Models:

  • MiniMax M2.7
  • MiniMax M2.5

Setup:

opencode auth login --provider minimax

Zhipu (GLM)

Zhipu provides powerful Chinese language models.

Latest Available Models:

  • GLM 5.1
  • GLM 5

Setup:

opencode auth login --provider zhipu

Moonshot AI (Kimi)

Kimi models excel at long context understanding.

Latest Available Models:

  • Kimi K2.6
  • Kimi K2.5

Setup:

opencode auth login --provider moonshot

Additional Providers

Groq

Ultra-fast inference for supported models.

Available Models:

  • Llama 3.3 70B
  • Mixtral 8x7B
  • Gemma 2 9B

Setup:

opencode auth login --provider groq

GitHub Copilot

Use your existing GitHub Copilot subscription with OpenCode.

Setup:

opencode auth login --provider github

This opens a browser for GitHub authentication.


Azure OpenAI

Use Azure-hosted OpenAI models with enterprise features.

Available Models:

  • GPT-5.5
  • GPT-5.4
  • GPT-4o

Setup:

opencode auth login --provider azure

xAI (Grok)

Grok models from xAI.

Available Models:

  • Grok Build 0.1

Setup:

opencode auth login --provider xai

Free Models

OpenCode Zen offers several free models (limited time):

ModelNotes
DeepSeek V4 Flash FreeFree for limited time, may be used for model improvement
MiMo-V2.5 FreeFree for limited time, may be used for model improvement
North Mini Code FreeFree for limited time, may be used for model improvement
Nemotron 3 Ultra FreeProvided by NVIDIA, trial use only
Big PickleStealth model, free for limited time

Using free models:

opencode auth login --provider zen

Then run /models in the TUI to select a free model.


Local Models

Run models locally with Ollama for complete privacy.

Ollama

Setup:

  1. Install Ollama from ollama.com
  2. Pull a model:
ollama pull llama3.3
ollama pull qwen3-coder
ollama pull deepseek-coder-v2
  1. Configure OpenCode:
opencode auth login --provider ollama

Recommended Local Models:

  • Llama 3.3 70B: Best overall quality (requires 40GB+ RAM)
  • Llama 3.3 8B: Good balance of quality and speed (requires 8GB+ RAM)
  • Qwen3 Coder: Excellent code understanding
  • DeepSeek Coder V2: Powerful coding model

Use Cases:

  • Privacy: Code never leaves your machine
  • Offline: Works without internet connection
  • Cost: No API costs after setup

LM Studio

  1. Download and install LM Studio
  2. Load a model in LM Studio
  3. Start the local server
  4. Configure OpenCode:
{
  "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)"
    }
  }
}

Model Comparison

ProviderLatest ModelBest ForSpeedPrivacy
AnthropicClaude Fable 5Complex reasoningMediumCloud
OpenAIGPT 5.5General codingMediumCloud
GoogleGemini 3.5 FlashFast responsesFastCloud
AlibabaQwen3.7 MaxChinese codingMediumCloud
DeepSeekV4 FlashCost-effectiveFastCloud
GroqLlama 3.3SpeedVery FastCloud
GitHubCopilotExisting subscriptionMediumCloud
OllamaLocal modelsPrivacyDependsLocal

All Supported Providers

OpenCode supports 75+ providers through Models.dev, including:

  • Major providers: Anthropic, OpenAI, Google, Microsoft Azure
  • Chinese providers: Alibaba Cloud, DeepSeek, MiniMax, Zhipu, Moonshot AI
  • Cloud platforms: AWS Bedrock, Google Vertex AI, Azure OpenAI
  • Inference platforms: Groq, OpenRouter, Together AI, Fireworks AI
  • Local runtime: Ollama, LM Studio, llama.cpp
  • Subscription services: GitHub Copilot, ChatGPT Plus/Pro
  • Enterprise: SAP AI Core, Snowflake Cortex, Scaleway

View all providers →


Loading models

When OpenCode starts up, it checks for models in the following priority order:

  1. The --model or -m command line flag. The format is the same as in the config file: provider_id/model_id.

  2. The model list in the OpenCode config.

    opencode.json

    {
      "$schema": "https://opencode.ai/config.json",
      "model": "anthropic/claude-fable-5"
    }

    The format here is provider/model.

  3. The last used model.

  4. The first model using an internal priority.


Deprecated Models

The following models are deprecated or will be deprecated soon:

ModelDeprecation Date
Gemini 3 ProMarch 9, 2026
MiniMax M2.1March 15, 2026
Claude Sonnet 4June 15, 2026
GPT 5.1 Codex seriesJuly 23, 2026

Please use the latest alternatives for these models.


Troubleshooting

Rate Limits

If you hit rate limits:

  • Wait for the limit to reset
  • Switch to a different provider
  • Use local models (Ollama)
  • Use free models (DeepSeek V4 Flash Free, etc.)

API Errors

Common issues:

  • 401 Unauthorized: Check your API key
  • 429 Rate Limited: You’ve exceeded your quota
  • 500 Server Error: Provider issue, try again later

Model Not Found

If a model isn’t available:

  • Check the model name is correct
  • Verify your provider supports that model
  • Check if the model requires special access

Next Steps