opencode_go
provider that defaults the base URL, so you only need an API key.
Configure
config.yaml:
https://opencode.ai/zen/go/v1. Authentication uses
Authorization: Bearer <api_key> with the key generated in the OpenCode Zen
console.
Models
GET /v1/models proxies OpenCode Zen’s model list, exposing IDs such as
glm-5.1, kimi-k2.7-code, deepseek-v4-pro, and mimo-v2.5-pro. Restrict the
advertised set with a configured list when you only want a subset:
Endpoints
OpenCode Zen serves most models on OpenAI-style/chat/completions (Bearer
auth) and a few models only on the Anthropic-native /messages endpoint
(x-api-key auth). GoModel routes per model:
- OpenAI-style models (GLM, Kimi, DeepSeek, MiMo, MiniMax, most Qwen) go to
/chat/completions./modelsand/v1/responses(translated to chat completions) use the same path. - Anthropic-only models are translated to the Anthropic Messages dialect and
sent to
/messages, mirroring how GoModel already serves native Anthropic. Both paths normalize to the same OpenAI-compatible response, so clients see one consistent surface regardless of which model they pick — whether they call/v1/chat/completionsor/v1/messages.
/messages-only models is currently maintained manually (default:
qwen3.7-max) because OpenCode Zen does not yet expose per-model endpoint
metadata. Override it when needed:
This manual split is temporary and will be replaced by metadata-driven routing
once the upstream model list distinguishes endpoints.
Session header
OpenCode Zen asks every client to send anx-opencode-session header so it
can route one conversation to the same upstream and keep its prompt cache
warm. Upstream has announced that requests without it may start failing.
GoModel adds the header to every OpenCode Go request by default, on both the
/chat/completions and /messages paths, using the first available value:
- An
x-opencode-sessionheader sent by the client (OpenCode itself, pi, and other tools that speak OpenCode Zen’s dialect) is forwarded verbatim. - Otherwise the session GoModel detected through
session keeping: OpenCode’s
X-Session-Id, Claude Code’s session id, a session body field, or the content-derivedauto-…id for agents that send no signal at all.
x-opencode-client (forwarding the client’s own value
when present, gomodel otherwise) and a gomodel/<version> User-Agent, as
the upstream usage guidelines
require.
Disable session forwarding only if upstream asks you to:
Reasoning
Some OpenCode Zen models always think and reject requests that leave the reasoning parameter out:reasoning_effort: "low" on /chat/completions when a
request carries no reasoning parameter at all. Models that ignore the parameter
are unaffected. Raise the default per deployment:
none (or off) to inject nothing and forward requests untouched.
Clients keep control when they ask for reasoning themselves: nothing is injected
over an explicit reasoning.effort or a top-level reasoning_effort. GoModel’s
recognized effort levels are mapped to their nearest equivalent in the low /
high / max set OpenCode Zen accepts:
Any other value (
turbo, say) is forwarded unchanged for the upstream to judge.
reasoning.effort is GoModel’s canonical field, so a request that sets both it
and a top-level reasoning_effort is sent with the mapped reasoning.effort —
the same precedence every other GoModel provider applies.
Models routed to /messages use the Anthropic thinking dialect instead and are
not affected by this mapping.
Not supported
- Embeddings (returns
invalid_request_error).