Liking cljdoc? Tell your friends :D

com.blockether.vis.internal.provider.vendor.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.

Authentication is the shared static-API-key shape, owned by com.blockether.vis.internal.provider.key-store and declared by BOOK below: lookup order, status, logout, the token envelope and the interactive vis-agent providers auth opencode-go flow all come from there.

What stays here is what only OpenCode Go knows: which model rides which wire, and the live /usage quota report (dynamic-limits! below).

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.

Authentication is the shared static-API-key shape, owned by
`com.blockether.vis.internal.provider.key-store` and declared by `BOOK` below:
lookup order, status, logout, the token envelope and the interactive
`vis-agent providers auth opencode-go` flow all come from there.

What stays here is what only OpenCode Go knows: which model rides which wire,
and the live `/usage` quota report (`dynamic-limits!` below).
raw docstring

dynamic-limits!clj

(dynamic-limits! api-key)

Fetch and normalize the live OpenCode Go quota windows for an API key.

Fetch and normalize the live OpenCode Go quota windows for an API key.
sourceraw docstring

fetch-usage!clj

(fetch-usage! api-key)

Fetch raw OpenCode Go usage JSON.

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.

Throws ex-info carrying :status for any non-2xx so the caller can tell a rejected key (401) from a key without a Go subscription (403).

Fetch raw OpenCode Go usage JSON.

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.

Throws `ex-info` carrying `:status` for any non-2xx so the caller can tell a
rejected key (401) from a key without a Go subscription (403).
sourceraw docstring

register!clj

(register!)
source

usage->dynamic-limitsclj

(usage->dynamic-limits payload)

Convert an OpenCode Go /usage payload into Vis dynamic limit rows.

Windows the payload omits are dropped rather than padded: the endpoint always reports all three, so a missing one means the shape changed and a row with no numbers would claim knowledge Vis does not have.

Convert an OpenCode Go `/usage` payload into Vis dynamic limit rows.

Windows the payload omits are dropped rather than padded: the endpoint always
reports all three, so a missing one means the shape changed and a row with no
numbers would claim knowledge Vis does not have.
sourceraw 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