Skip to main content

Overview

OpenCode supports multiple AI providers and models, allowing you to choose the best model for your use case and budget. You can configure different models for different agent types (coder, task, title).

Supported providers

OpenCode supports the following AI providers (in order of auto-configuration preference):

GitHub Copilot

Access multiple models through your GitHub Copilot subscription at no additional cost

Anthropic

Claude models with extended thinking and large context windows

OpenAI

GPT and o-series models with reasoning capabilities

Google Gemini

Gemini models with massive context windows

Groq

Fast inference for Llama and other open models

OpenRouter

Unified access to multiple providers

AWS Bedrock

Claude and other models on AWS infrastructure

Azure OpenAI

OpenAI models through Azure with enterprise features

Google Cloud Vertex AI

Gemini models on Google Cloud Platform

GitHub Copilot models

GitHub Copilot models are free with a GitHub Copilot subscription and automatically detected from your GitHub CLI credentials.

Authentication

OpenCode automatically detects GitHub Copilot credentials from:
  • GitHub CLI configuration (~/.config/github-copilot/hosts.json)
  • Environment variable: GITHUB_TOKEN

Available models

Anthropic (Claude)

Authentication

Or in .opencode.json:

Available models

Claude models support extended thinking mode via reasoningEffort parameter (low, medium, high).

OpenAI

Authentication

Or in .opencode.json:

Available models

OpenAI reasoning models (o-series) support reasoningEffort parameter for controlling inference time.

Google Gemini

Authentication

Or in .opencode.json:

Available models

Groq

Authentication

Or in .opencode.json:

Available models

OpenRouter

Authentication

Or in .opencode.json:

Available models

OpenRouter provides access to models from multiple providers with unified billing: OpenAI models:
  • openrouter.gpt-4.1, openrouter.gpt-4.1-mini, openrouter.gpt-4.1-nano
  • openrouter.gpt-4.5-preview, openrouter.gpt-4o, openrouter.gpt-4o-mini
  • openrouter.o1, openrouter.o1-pro, openrouter.o1-mini
  • openrouter.o3, openrouter.o3-mini, openrouter.o4-mini
Anthropic models:
  • openrouter.claude-3.5-sonnet, openrouter.claude-3.7-sonnet
  • openrouter.claude-3.5-haiku, openrouter.claude-3-haiku
  • openrouter.claude-3-opus
Google models:
  • openrouter.gemini-2.5, openrouter.gemini-2.5-flash
Free models:
  • openrouter.deepseek-r1-free - Free DeepSeek R1 (163K context)
See OpenRouter pricing for current rates.

AWS Bedrock

Authentication

Bedrock uses standard AWS credentials:

Available models

Azure OpenAI

Authentication

Or in .opencode.json:

Available models

Azure OpenAI provides the same models as OpenAI with the azure. prefix:
  • azure.gpt-4.1, azure.gpt-4.1-mini, azure.gpt-4.1-nano
  • azure.gpt-4.5-preview, azure.gpt-4o, azure.gpt-4o-mini
  • azure.o1, azure.o1-mini
  • azure.o3, azure.o3-mini, azure.o4-mini
Pricing matches OpenAI’s rates. See Azure OpenAI pricing.

Google Cloud Vertex AI

Authentication

Available models

xAI (Grok)

Authentication

Available models

Choosing the right model

For coding (coder agent)

  • claude-4-sonnet - Best overall for complex reasoning
  • o1 or o3 - Excellent for algorithmic challenges
  • gpt-4.1 - Strong general coding capabilities

For code search (task agent)

Fast, cost-effective models work best:
  • gpt-4.1-mini
  • gpt-4o-mini
  • claude-3.5-haiku
  • gemini-2.5-flash

For titles (title agent)

Any fast model works (auto-configured, maxTokens=80):
  • gpt-4o-mini
  • claude-3.5-haiku
  • gemini-2.0-flash-lite

Model capabilities

Reasoning models

Models with extended thinking/reasoning capabilities:
  • OpenAI: o1, o1-pro, o1-mini, o3, o3-mini, o4-mini
  • Anthropic: claude-4-sonnet, claude-3.7-sonnet
  • Groq: deepseek-r1-distill-llama-70b
Configure with reasoningEffort (low, medium, high):

File attachments

Most models support file attachments except:
  • o3-mini
  • llama-3.3-70b-versatile
  • Groq’s Qwen and DeepSeek models

Context windows

Largest context windows:
  1. 1M tokens: Gemini models, VertexAI Gemini
  2. 1M+ tokens: gpt-4.1, gpt-4.1-nano (1,047,576 tokens)
  3. 200K tokens: Claude models, OpenAI o-series, gpt-4.1-mini

Cost optimization

Prompt caching

Many models support prompt caching to reduce costs on repeated context:
  • Anthropic: All Claude models
  • OpenAI: GPT-4.1, o-series models
  • Gemini: Not yet supported

Strategy recommendations

Estimated cost: ~$0.50-2.00 per day of active use
Cost: Included in GitHub Copilot subscription
Estimated cost: ~$5-20 per day of active use