Files
LLM-Server/docs/coding-cli-setup/opencode.md
T
haylanandClaude Bot a0e5e9704b docs: restructure around source-of-truth pages
- CONTEXT.md glossary
- README reduced to intro, quickstart and doc index
- new architecture.md, gateway.md (from proxy-key-onboarding.md),
  operations.md; network-access.md rewritten
- coding-cli-setup: stale OMNIROUTE_PORT:-4000 endpoint, terms and
  duplicated per-slot/classifier explanations fixed
- research/README.md index; proxy-request-priority.md moved there as
  superseded

Every doc names keys instead of restating values and links its source.

Refs #55 (#56, #57, #59, #60)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-24 21:51:01 +02:00

2.3 KiB

OpenCode CLI

← back to overview

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",
  "provider": {
    "llm-server": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "LLM-Server gateway",
      "options": {
        "baseURL": "http://<server>:<OMNIROUTE_API_PORT>/v1",
        "apiKey": "<opencode-cli API key>"
      },
      "models": {
        "qwen3.8-27b-local": {
          "name": "Qwen3.8-27B",
          "limit": { "context": <LLAMA_CTX_SIZE / LLAMA_PARALLEL>, "output": 8192 }
        }
      }
    }
  }
}

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 --jinja flag (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 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 (its base URL example predates the gateway), research/opencode-auto-compact.md.