* fix: send x-opencode-session header on OpenCode endpoints OpenCode Go/Zen (opencode.ai) enforces an x-opencode-session header from 2026-09-06 and uses it for prompt-cache routing. Add an "opencode" session-affinity mode detected by baseUrl host (covers zen/go/v1 and zen/v1, OpenAI-completions and Anthropic transports). For opencode hosts the header is sent whenever a stable session id is available, without requiring the sendSessionAffinityHeaders opt-in; the flag-gated generic modes are unchanged. Fixes #137165 * fix: emit x-opencode-session regardless of cache retention on OpenCode endpoints Review follow-up: extract isOpencodeEndpoint (trailing-dot safe, parse guarded) shared by both transports; the compliance header now survives cacheRetention none; add Anthropic zen/go and OpenAI zen/v1 regression coverage. * fix(opencode): identify conversations across all model transports * fix(opencode): cover managed transports and preserve configured identity * fix(google): merge model and stream headers case-insensitively * test(opencode): use transport-specific model fixtures --------- Co-authored-by: Ghilteras <Ghilteras@users.noreply.github.com> Co-authored-by: VACInc <3279061+VACInc@users.noreply.github.com>
7.5 KiB
| summary | read_when | title | ||
|---|---|---|---|---|
| Use OpenCode Zen and Go catalogs with OpenClaw |
|
OpenCode |
OpenCode exposes two hosted catalogs in OpenClaw:
| Catalog | Prefix | Runtime provider |
|---|---|---|
| Zen | opencode/... |
opencode |
| Go | opencode-go/... |
opencode-go |
Both catalogs use the same OpenCode API key infrastructure (OPENCODE_API_KEY,
alias OPENCODE_ZEN_API_KEY). Go still requires its own paid subscription;
having a Zen key does not by itself grant Go access. OpenClaw keeps the runtime
provider ids split so upstream per-model routing stays correct.
OpenClaw sends a stable x-opencode-session conversation header on requests to
https://opencode.ai across the Anthropic, Gemini, OpenAI Chat Completions, and
OpenAI Responses transports. This header remains enabled when prompt caching is
disabled. Direct SDK callers should supply sessionId in their stream options.
Getting started
**Best for:** the curated OpenCode multi-model proxy (Claude, GPT, Gemini, GLM, DeepSeek, Kimi, MiniMax, Qwen).<Steps>
<Step title="Run onboarding">
```bash
openclaw onboard --auth-choice opencode-zen
```
Or pass the key directly:
```bash
openclaw onboard --opencode-zen-api-key "$OPENCODE_API_KEY"
```
</Step>
<Step title="Set a Zen model as the default">
```bash
openclaw config set agents.defaults.model.primary "opencode/gpt-5.6-sol"
```
</Step>
<Step title="Verify models are available">
```bash
openclaw models list --provider opencode
```
</Step>
</Steps>
**Best for:** the separately subscribed Go lineup across DeepSeek, GLM, GPT,
Grok, Hy3, Kimi, MiMo, MiniMax, and Qwen.
<Steps>
<Step title="Use the bundled Go catalog">
OpenCode Go is included with OpenClaw for this release, so no separate
plugin installation or Gateway restart is required.
</Step>
<Step title="Run onboarding">
```bash
openclaw onboard --auth-choice opencode-go
```
Or pass the key directly:
```bash
openclaw onboard --opencode-go-api-key "$OPENCODE_API_KEY"
```
</Step>
<Step title="Set a Go model as the default">
```bash
openclaw config set agents.defaults.model.primary "opencode-go/kimi-k3"
```
</Step>
<Step title="Verify models are available">
```bash
openclaw models list --provider opencode-go
```
</Step>
</Steps>
Config example
{
env: { vars: { OPENCODE_API_KEY: "sk-..." } },
agents: { defaults: { model: { primary: "opencode/gpt-5.6-sol" } } },
}
Provider catalogs
Zen
| Property | Value |
|---|---|
| Runtime provider | opencode |
| Example models | opencode/gpt-5.6-sol, opencode/kimi-k3, opencode/deepseek-v4-flash |
Run openclaw models list --provider opencode for the current active list.
Model availability and promotional routes can change independently of OpenClaw.
Live discovery combines the models available to your OpenCode account with
authoritative model metadata from https://models.opencode.ai/api.json.
OpenClaw fetches and caches that catalog only when OpenCode Zen or Go is
configured or explicitly selected with OpenCode credentials; startup and
unrelated providers never download it. New upstream models become available
without an OpenClaw update when their metadata describes a supported transport
on the trusted OpenCode endpoint. A key-scoped response can omit models
unavailable to that workspace. Metadata and lifecycle status refresh together;
deprecated models are excluded from active discovery and its offline fallback.
Deprecated explicit refs remain resolvable for existing configurations but are
not shown as current recommendations.
Account-list failures produce a failed catalog outcome, not a successful seed list. A successful empty or fully filtered account response stays empty. The separate public metadata feed can still use trusted offline metadata when it is unavailable; that does not replace or retry the account-list request.
Price estimates also refresh through the hosted model catalog,
using the same public OpenCode pricing feed as live discovery. Hosted updates
activate after the next Gateway restart; the bundled snapshot remains available
offline. Explicit model prices in your configuration or agent-local models.json
keep precedence. These are advertised-price estimates, not verified invoice totals.
Go
| Property | Value |
|---|---|
| Runtime provider | opencode-go |
| Example models | opencode-go/kimi-k3, opencode-go/deepseek-v4-flash, opencode-go/qwen3.8-max |
See OpenCode Go for discovery, routing, and access requirements. Go's model-list endpoint advertises its general lineup; listing a model does not prove your account can run it.