dsh-opencode-go-quota

August 14, 2026 · View on GitHub

OpenCode Go (Zen Go) quota display for the DeepSeek Harness web UI.

A dual-face DSH plugin that shows your OpenCode Go subscription quota right in the conversation session header: a compact Go 92% chip (smallest remaining window) that expands into a popover with the rolling / weekly / monthly windows, their used/remaining percentages, reset times, and a manual refresh.

Chip

Features

  • Host side — registers GET /opencode-go-quota on the DSH webserver. It resolves the OPENCODE_GO_API_KEY credential through the DSH credentials seam (never leaves the process), proxies the official OpenCode usage API (https://opencode.ai/zen/go/v1/usage), normalizes the payload into quota windows, and caches the result for 60 s so the browser never hammers the upstream API.
  • Browser side — a chip in the conversation.session.header.actions slot. Polls every 60 s, shows a tooltip on hover, and a popover with:
    • every quota window: used % / remaining % (rolling, weekly, monthly),
    • each window's reset time,
    • a manual refresh button (bypasses the server cache with ?refresh=1).

How it works

The OpenCode usage API returns usage per quota window:

{
  "usage": {
    "rolling": { "status": "ok", "percent": 17, "resetsAt": "2026-08-14T12:30:14.366Z" },
    "weekly":  { "status": "ok", "percent": 7,  "resetsAt": "2026-08-17T00:00:00.366Z" },
    "monthly": { "status": "ok", "percent": 3,  "resetsAt": "2026-09-13T14:00:14.366Z" }
  }
}

The host plugin normalizes each window into { key, limit, used, remaining, unit, resetsAt, status } (limit = 100, used = percent, remaining = 100 - percent), which the browser renders directly. A generic extractor also picks up limit/used/remaining-style objects as a defensive fallback.

Route response

GET /opencode-go-quota

{
  "ok": true,
  "fetchedAt": "2026-08-14T09:58:53.131Z",
  "source": "https://opencode.ai/zen/go/v1/usage",
  "windows": [
    { "key": "rolling", "limit": 100, "used": 17, "remaining": 83, "unit": "%", "resetsAt": "…", "status": "ok" }
  ],
  "raw": { "usage": {  } }
}

Errors: 503 { "code": "NO_CREDENTIAL" } when the credential is missing, 502 when every upstream endpoint is unreachable.

Installation

  1. Copy this package into your DSH profile's node_modules:

    Copy-Item -Recurse .\dsh-opencode-go-quota "$env:USERPROFILE\.dsh\profiles\web\node_modules\"
    
  2. Mount it in the profile's cordis.patch.yml (see profile-cordis-patch.example.yml):

    - insert:
        - id: opencode-go-quota
          name: 'dsh-opencode-go-quota'
    
  3. Restart the GUI (npx @deepseek-ai/dsh web) and hard-refresh the browser page. The chip appears in any conversation's session header.

Requirements

  • The OPENCODE_GO_API_KEY credential (an OpenCode Go API key) stored via the DSH credentials service (~/.dsh/.credentials.yaml) or exported as an environment variable.
  • Peer dependencies @deepseek-ai/cordis and @deepseek-ai/dsh-credentials (already present in a DSH profile).

Uninstall

Remove the opencode-go-quota entry from cordis.patch.yml (and optionally the package folder), then restart the GUI.

Development

The package ships as plain ESM + a hand-written browser bundle (the window.__ModuleLoader__.load contract used by DSH client plugins), so no build step is required.

lib/index.js   host plugin: cordis name/inject/apply, route, upstream fetch, parsing, cache
lib/client.js  browser bundle: header chip + popover

Test against a real OpenCode account without touching your running GUI by launching an isolated instance:

$env:DSH_HOME = ".\test-home"; $env:OPENCODE_GO_API_KEY = "<your key>"
npx @deepseek-ai/dsh web --port 3098

License

MIT © 2026 Easy19613


dsh-opencode-go-quota(中文说明)

DeepSeek Harness Web UI 添加 OpenCode Go (Zen Go) 订阅额度显示的双面插件。

在会话头部显示一个 Go 92% 额度芯片(取剩余比例最小的窗口),点击弹出详情:滚动 / 每周 / 每月三个额度窗口的 已用与剩余百分比、重置时间,以及手动刷新按钮;每 60 秒自动轮询。

功能

  • 服务端:在 DSH webserver 注册 GET /opencode-go-quota 路由,通过 credentials 服务解析 OPENCODE_GO_API_KEY(密钥不出进程),代理官方用量 API https://opencode.ai/zen/go/v1/usage, 归一化为额度窗口并缓存 60 秒。
  • 浏览器端:在 conversation.session.header.actions 槽位注册芯片,点击弹出各窗口已用/剩余百分比、 重置时间与刷新按钮。

安装

  1. 将本包复制到 profile 的 node_modules:

    Copy-Item -Recurse .\dsh-opencode-go-quota "$env:USERPROFILE\.dsh\profiles\web\node_modules\"
    
  2. cordis.patch.yml 中挂载(参考 profile-cordis-patch.example.yml):

    - insert:
        - id: opencode-go-quota
          name: 'dsh-opencode-go-quota'
    
  3. 重启 GUI(npx @deepseek-ai/dsh web)并强制刷新浏览器页面,任意会话的头部即可看到芯片。

要求:配置好 OPENCODE_GO_API_KEY 凭据(~/.dsh/.credentials.yaml 或环境变量)。

卸载

cordis.patch.yml 删除 opencode-go-quota 条目(可选删除包目录),重启 GUI 即可。

License

MIT © 2026 Easy19613