64 lines
2.9 KiB
Markdown
64 lines
2.9 KiB
Markdown
# OpenCode CLI
|
|
|
|
[← back to overview](index.md)
|
|
|
|
> **Source of truth:** [OpenCode's docs](https://opencode.ai/docs/) for config keys; the [overview](index.md) 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**:
|
|
```bash
|
|
curl -fsSL https://opencode.ai/install | bash
|
|
```
|
|
|
|
**Config** (`opencode.json`, project root or `~/.config/opencode/opencode.json`):
|
|
|
|
```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](index.md)). 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](index.md)):
|
|
- Relies on the backend's `--jinja` flag ([architecture → llama-server](../architecture.md#llama-server)); without it, OpenCode's unconditional tool-call scaffolding gets a 500.
|
|
- [anomalyco/opencode#20669](https://github.com/anomalyco/opencode/issues/20669) (closed as "not planned" — a live, unfixed risk): OpenCode's `bash` tool crashes if the model omits the optional `description` field on a tool call; some local backends return `finish_reason: tool_calls` with 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`](../research/opencode-cli-setup.md) (its base URL example predates the gateway), [`research/opencode-auto-compact.md`](../research/opencode-auto-compact.md).
|