OpenCode
Run Mopheus agent tasks with the OpenCode CLI.
Mopheus runs SST's opencode CLI as a native provider. Install it on the daemon host; the daemon discovers it automatically.
| Field | Value |
|---|---|
| Binary | opencode |
| Path override | MOPHEUS_OPENCODE_PATH |
| Verify | opencode --version |
| Protocol | Native |
| Task skill path | .opencode/skills/ |
| Filesystem sandbox | Supported on Linux |
See the OpenCode installation guide. For a non-standard binary path:
export MOPHEUS_OPENCODE_PATH=/opt/opencode/bin/opencode
mopheus daemon startConfigure Models
OpenCode model IDs use the provider/model format.
For a default model outside Mopheus tasks, create ~/.config/opencode/opencode.json:
{
"$schema": "https://opencode.ai/config.json",
"model": "gateway/qwen3-coder",
"small_model": "gateway/qwen3-coder"
}For an OpenAI-compatible endpoint, define the provider and its model in the same file:
{
"$schema": "https://opencode.ai/config.json",
"model": "gateway/qwen3-coder",
"provider": {
"gateway": {
"npm": "@ai-sdk/openai-compatible",
"name": "OpenAI Compatible Gateway",
"options": {
"baseURL": "https://api.example.com/v1",
"apiKey": "{env:OPENCODE_API_KEY}"
},
"models": {
"qwen3-coder": {
"name": "Qwen3 Coder"
}
}
}
}
}Set the credential in the daemon environment before starting the daemon:
export OPENCODE_API_KEY=your-api-keyQwen3 with vLLM
Configure the vLLM OpenAI-compatible endpoint in ~/.config/opencode/opencode.json:
{
"$schema": "https://opencode.ai/config.json",
"model": "local/qwen3-8b",
"provider": {
"local": {
"npm": "@ai-sdk/openai-compatible",
"name": "Local vLLM",
"options": {
"baseURL": "http://127.0.0.1:8000/v1",
"apiKey": "EMPTY"
},
"models": {
"qwen3-8b": {
"name": "Qwen3 8B"
}
}
}
}
}Use the /models command in OpenCode to verify the configured model. See the OpenCode model configuration guide and provider configuration guide for provider-specific options.
The filesystem sandbox and workspace session-history behavior are described in Filesystem Sandbox and Provider CLI.