Liking cljdoc? Tell your friends :D

com.blockether.vis.ext.provider-opencode-go

OpenCode Go (https://opencode.ai/go) static-API-key provider.

OpenCode Go is a flat-rate ($10/month) subscription gateway serving a curated set of open-source coding models from ONE endpoint (https://opencode.ai/zen/go/v1) over TWO wire dialects. Vis surfaces them as a SINGLE first-class provider — :opencode-go — that routes each model to the correct wire automatically:

OpenAI chat wire (/chat/completions, svar default): GLM, Kimi, DeepSeek, MiMo, Hy3.

Anthropic Messages wire (/messages, per-model :api-style :anthropic): MiniMax, Qwen.

svar reads (or (:api-style model-map) (:api-style provider)) at request build time, so a per-model :api-style override on the Anthropic models inside :default-models is all that is needed — one provider, one key, one endpoint, two wires.

Auth lifecycle:

  1. vis-agent providers auth opencode-go persists the key once under ~/.vis/opencode-auth.json as canonical snake_case JSON (api_key / saved_at) — every JSON this repo writes uses snake_case string keys.
  2. Later runs resolve the key from config (~/.vis/config.edn, written by the TUI), then OPENCODE_API_KEY, then the auth file. Config wins so status/limits report the key that model calls actually use; the env var beats the file so CI stays home-directory-free.
  3. vis-agent providers status opencode-go shows the source without exposing the key.
  4. vis-agent providers logout opencode-go deletes the persisted key.
OpenCode Go (https://opencode.ai/go) static-API-key provider.

OpenCode Go is a flat-rate ($10/month) subscription gateway serving a curated
set of open-source coding models from ONE endpoint
(`https://opencode.ai/zen/go/v1`) over TWO wire dialects. Vis surfaces them
as a SINGLE first-class provider — `:opencode-go` — that routes each model to
the correct wire automatically:

  OpenAI chat wire (/chat/completions, svar default):
    GLM, Kimi, DeepSeek, MiMo, Hy3.

  Anthropic Messages wire (/messages, per-model `:api-style :anthropic`):
    MiniMax, Qwen.

svar reads `(or (:api-style model-map) (:api-style provider))` at request
build time, so a per-model `:api-style` override on the Anthropic models
inside `:default-models` is all that is needed — one provider, one key, one
endpoint, two wires.

Auth lifecycle:
  1. `vis-agent providers auth opencode-go` persists the key once under
     `~/.vis/opencode-auth.json` as canonical snake_case JSON
     (`api_key` / `saved_at`) — every JSON this repo writes uses
     snake_case string keys.
  2. Later runs resolve the key from config (`~/.vis/config.edn`, written by
     the TUI), then `OPENCODE_API_KEY`, then the auth file. Config wins so
     status/limits report the key that model calls actually use; the env var
     beats the file so CI stays home-directory-free.
  3. `vis-agent providers status opencode-go` shows the source without
     exposing the key.
  4. `vis-agent providers logout opencode-go` deletes the persisted key.
raw docstring

com.blockether.vis.ext.provider-opencode-go.limits

OpenCode Go dynamic quota checker.

OpenCode Go is a subscription, but it is NOT unmetered: the plan meters three dollar budgets — a 5h rolling window, a calendar week and the billing month. Upstream added GET https://opencode.ai/zen/go/v1/usage on 2026-08-11 (sst/opencode #16513) and that endpoint is the only place those counters are published.

Request: Authorization: Bearer <api-key> — the endpoint reads the Bearer header only; an x-api-key header is answered as a missing key. 200: {"usage": {"rolling"|"weekly"|"monthly": {"status", "percent", "resetsAt"}}} where status is ok or rate-limited, percent is an integer 0-100 of that window's budget and resetsAt is an ISO-8601 instant. 401: key missing or unknown. 403: valid key, no OpenCode Go subscription behind it.

The dollar limits themselves ($12 / $30 / $60 at the time of writing) are NOT on the wire, so each window is normalized as a percentage tank (:limit 100.0) — the shape limits-format/percentage-limit-row? renders as "63% left".

OpenCode Go dynamic quota checker.

OpenCode Go is a subscription, but it is NOT unmetered: the plan meters three
dollar budgets — a 5h rolling window, a calendar week and the billing month.
Upstream added `GET https://opencode.ai/zen/go/v1/usage` on 2026-08-11
(`sst/opencode` #16513) and that endpoint is the only place those counters are
published.

Request:  `Authorization: Bearer <api-key>` — the endpoint reads the Bearer
          header only; an `x-api-key` header is answered as a missing key.
200:      `{"usage": {"rolling"|"weekly"|"monthly":
          {"status", "percent", "resetsAt"}}}` where `status` is
          `ok` or `rate-limited`, `percent` is an integer 0-100 of that
          window's budget and `resetsAt` is an ISO-8601 instant.
401:      key missing or unknown.
403:      valid key, no OpenCode Go subscription behind it.

The dollar limits themselves ($12 / $30 / $60 at the time of writing) are NOT
on the wire, so each window is normalized as a percentage tank
(`:limit 100.0`) — the shape `limits-format/percentage-limit-row?` renders as
"63% left".
raw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close