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".(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.
(fetch-usage! api-key)Fetch raw OpenCode Go usage JSON. 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. 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).
(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.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |