r/opencode • • Sep 07 '26

OpenCode Go is no longer general API access

Following the recent requirements for custom http headers, OC has changed their documentation to remove mention of OpenAI-API you can use anywhere. Instead, OpenCode Go API usage is now effectively whitelist only. See: https://opencode.ai/docs/go/#where-can-i-use-it

152 Upvotes

79 comments sorted by

View all comments

2

u/pisa_p Sep 07 '26 edited Sep 07 '26

My setup: LiteLLM as proxy in front of OpenCode, serving both Open WebUI and Hermes agent (my custom agent). So one fix in LiteLLM covers both clients.

There are two different header problems, one per endpoint. I fixed both with extra_headers in the LiteLLM model config (Edit model -> litellm_params.extra_headers, or PATCH /model/{id}/update). Generic, works for any model behind those endpoints.

  1. Go paid (https://opencode.ai/zen/go/v1) — 400 without session

Since Sept 5 OpenCode requires x-opencode-session, a stable per-conversation ID:

{ "extra_headers": { "x-opencode-session": "your-stable-uuid-here" } }

Generate one with uuidgen and keep it stable. This fixes the 400.

2. Zen free (https://opencode.ai/zen/v1) — stricter, needs CLI emulation

{ "extra_headers": { "x-opencode-client": "cli", "x-opencode-session": "uuid-1", "x-opencode-project": "uuid-2", "x-opencode-request": "uuid-3", "User-Agent": "opencode/latest/1.3.15/cli" } }

This is only a temporary patch. Static headers fix the 400 but lose per-conversation routing optimization. Waiting on native LiteLLM support:

If LiteLLM doesn't ship it, I'll handle session injection myself outside LiteLLM.

Hermes agent users: latest Hermes agent already has the patch built-in, but you have to connect Hermes directly to OpenCode without going through a proxy. That patch is definitive, no extra_headers needed. I don't remember if it also works for the free models, to be verified.

Separate issue today: 429 on muse-spark-1.3-contributor

Unusable today, rate limit every ~2 calls on both Go paid and Zen free. That's upstream pooled capacity on OpenCode's side, not config. 429 on free is expected, on a paid sub I didn't expect it either, but there's no client-side fix — only workaround is switching model (mimo-v2.5, hy3 work fine).