2.9 KiB
OpenCode CLI
Source of truth: OpenCode's docs for config keys; the overview for the gateway endpoint and context size. If this page disagrees with them, they win.
Confirmed project: anomalyco/opencode (renamed from sst/opencode — don't confuse with the unrelated opencode-ai/opencode Go TUI). Docs: https://opencode.ai/docs/
Install:
curl -fsSL https://opencode.ai/install | bash
Config (opencode.json, project root or ~/.config/opencode/opencode.json):
{
"$schema": "https://opencode.ai/config.json",
"model": "omniroute/qwen3.8-27b-local//models/Qwen3.8-27B-UD-Q4_K_XL.gguf",
"provider": {
"omniroute": {
"npm": "@ai-sdk/openai-compatible",
"name": "OmniRoute",
"options": {
"baseURL": "https://<YOUR-OMNIROUTE-PROXY>/v1"
},
"models": {
"qwen3.8-27b-local//models/Qwen3.8-27B-UD-Q4_K_XL.gguf": {
"name": "Qwen3.8-27B",
"reasoning": true,
"interleaved": {
"field": "reasoning_content"
},
"limit": {
"context": 131000,
"output": 65536
},
"cost": {
"input": 0.4,
"output": 3.0,
"cache": {
"read": 0.04,
"write": 0
}
}
}
}
}
}
}
limit.context is the per-slot context (overview). OpenCode uses it for its own context bookkeeping; the server doesn't read it.
Select the model with llm-server/qwen3.8-27b-local.
OpenCode-specific risks (on top of the shared Qwen3.8-27B tool-calling risk — see overview):
- Relies on the backend's
--jinjaflag (architecture → llama-server); without it, OpenCode's unconditional tool-call scaffolding gets a 500. - anomalyco/opencode#20669 (closed as "not planned" — a live, unfixed risk): OpenCode's
bashtool crashes if the model omits the optionaldescriptionfield on a tool call; some local backends returnfinish_reason: tool_callswith an empty array, which can hang the agent loop instead of stopping cleanly. - Thinking-mode handling (
options.reasoningEffort) is undocumented for models that emit inline<think>tags rather than a native reasoning API field — expect no effect from that config on this model; untested.
Further reading: research/opencode-cli-setup.md (its base URL example predates the gateway), research/opencode-auto-compact.md.