OpenCode is an open-source AI coding assistant that supports multiple LLM providers. It offers flexibility in model selection and configuration.
Install OpenCode:
# Install via go
go install github.com/sst/opencode@latest
# Verify installation
opencode --version# .orch/config.yaml
agent: opencodeagent: opencode
opencode:
default_model: anthropic/claude-opus-4-5
default_variant: maxagent: opencode
opencode:
default_model: anthropic/claude-opus-4-5
default_variant: max
prompt_template: |
ultrawork Please read 'ORCH_PROMPT.md' in the current directory.
{{issue}}# Use default agent (if configured as opencode)
orch run my-issue
# Explicitly specify opencode
orch run --agent opencode my-issue
# With specific model
orch run --agent opencode --model anthropic/claude-opus-4-5 my-issue
# With model variant
orch run --agent opencode --model anthropic/claude-opus-4-5 --model-variant max my-issueList available models:
orch modelsCommon models:
anthropic/claude-opus-4-5- Most capableanthropic/claude-sonnet-4- Balancedopenai/gpt-4o- OpenAI's flagshipopenai/o3- OpenAI reasoning model
Some models support variants for different configurations:
| Variant | Description |
|---|---|
default |
Standard configuration |
max |
Maximum thinking/capability |
fast |
Optimized for speed |
When starting a run, orch:
- Creates a tmux session
- Changes to the worktree directory
- Launches opencode with model and prompt:
opencode --model anthropic/claude-opus-4-5 --variant max "prompt..."
The orch daemon detects OpenCode's state similarly to Claude:
- Active output
- OpenCode UI elements
- Input prompt visible
- Waiting for user
- Shell prompt visible
- OpenCode exited
Configure presets for different use cases:
agent: opencode
opencode:
default_model: anthropic/claude-sonnet-4
default_variant: default
presets:
thorough:
agent: opencode
model: anthropic/claude-opus-4-5
model_variant: max
fast:
agent: opencode
model: anthropic/claude-sonnet-4
model_variant: fastUse presets:
# Complex task requiring deep thinking
orch run --preset thorough complex-issue
# Quick fix
orch run --preset fast simple-bugOpenCode uses environment variables for API keys:
# Anthropic
export ANTHROPIC_API_KEY=sk-ant-...
# OpenAI
export OPENAI_API_KEY=sk-...
# Other providers
export GOOGLE_API_KEY=...OpenCode works well with the ultrawork prefix for complex tasks:
opencode:
prompt_template: |
ultrawork Please read 'ORCH_PROMPT.md' in the current directory.
{{issue}}opencode:
prompt_template: |
# Task: {{issue_title}}
## Requirements
{{issue}}
## Guidelines
- Follow existing code patterns
- Write comprehensive tests
- Create a PR when completeorch attach my-issueorch send my-issue "Also update the documentation"
orch send my-issue <<'EOF'
Also update the documentation.
Call out any new config requirements.
EOForch capture my-issueopencode:
default_model: anthropic/claude-opus-4-5
# Requires ANTHROPIC_API_KEYopencode:
default_model: openai/gpt-4o
# Requires OPENAI_API_KEYopencode:
default_model: google/gemini-pro
# Requires GOOGLE_API_KEYCheck available models:
orch modelsEnsure your API key has access to the requested model.
Check environment variables:
echo $ANTHROPIC_API_KEY
echo $OPENAI_API_KEYIf using max variant, responses may take longer. Consider using default variant for faster responses:
opencode:
default_variant: defaultCheck system resources and try with a smaller model variant.
opencode:
env:
ANTHROPIC_API_KEY: ${ANTHROPIC_API_KEY}
OPENCODE_CONFIG: ~/.opencode/config.yamlConfigure different prompts for different models:
opencode:
default_model: anthropic/claude-opus-4-5
model_settings:
"anthropic/claude-opus-4-5":
prompt_template: |
ultrawork Be thorough and comprehensive.
{{issue}}
"anthropic/claude-sonnet-4":
prompt_template: |
Be concise but complete.
{{issue}}| Feature | Claude Code | OpenCode |
|---|---|---|
| Multi-provider | No (Anthropic only) | Yes |
| Model selection | Automatic | Configurable |
| Open source | No | Yes |
| MCP support | Yes | Yes |
| Custom prompts | Via templates | Via templates |