yumusb/dsh-opencode-go-usage1

dsh-opencode-go-usage

DSH 插件:在侧边栏展示 OpenCode GO 计划额度小组件,提供同源使用代理及聊天命令。

AI 分析

核心用途是实时监控 OpenCode GO 订阅计划的额度消耗。适合购买了该编码订阅服务、需要随时查看滚动额度剩余的用户。

包名
dsh-opencode-go-usage
版本
1.2.2
许可证
MIT
最近更新
2026年8月14日

安装

$npx -p @deepseek-ai/dsh dsh plugin --profile web add github:yumusb/dsh-opencode-go-usage

dsh-opencode-go-usage

English | 中文

⚡ Get an OpenCode GO plan: buycodingplan.com

A DSH (DeepSeek Harness) plugin that watches your OpenCode GO plan quota — the $10/month subscription that gives you usage limits on open-source models (rolling 5-hour, weekly, and monthly windows).

Features

  • Sidebar widget — a live widget pinned at the bottom of the DSH web sidebar (sidebar.footer.action slot) showing three usage bars: rolling (5h), weekly, and monthly, each with a relative countdown to its window reset. When the sidebar is collapsed it shrinks to a compact percentage badge.
  • /opencode-go chat command — prints the same numbers as text inside any conversation.
  • Same-origin proxy — the host registers GET /opencode-go/usage, forwards to the official GO gateway with your API key. The key never reaches the browser and no CORS is involved.

How it works

The plugin is a dual-half DSH package:

halffilerole
host (Node)lib/index.jsregisters the /opencode-go/usage web route (ctx.webServer) and the /opencode-go command (ctx.commands); resolves the key through DSH credentials; caches the upstream call (30 s)
browserlib/client.jsa hand-authored window.__ModuleLoader__.load({ id, factory }) bundle that registers into the sidebar.footer.action list slot and polls the same-origin route every 60 s

package.json declares "dsh": { "client": { "platform": "web" } }, so DSH's client-modules node half scans it into the browser boot graph (window.__DSH_BOOT__) and serves the bundle at /plugins/dsh-opencode-go-usage/client.js.

How the sidebar widget loads under the official install

dsh plugin add installs the package into the profile, which satisfies the host half (routes, command, settings). DSH's client-modules scanner can only resolve browser bundles from its own installation directory, so a profile-installed third-party package would normally lose its browser half — this plugin avoids that by self-hosting its bundle: the host registers the /dsh-opencode-go-usage/client.js route and injects its boot-graph row through the official webServer.tapIndex API. The sidebar widget therefore works from any installation location.

Requirements

  • DSH installed and the web profile booted at least once (~/.dsh/profiles/web exists)
  • Node.js ≥ 18 (for fetch)
  • An OpenCode GO subscription and its API key

Install (official DSH flow)

Requirements: DSH installed with the web profile booted once, Node.js ≥ 18, an OpenCode GO subscription.


## Usage

- **Widget**: read it. Collapsed sidebar → percentage badge; expanded → three progress bars with reset countdowns.
- **Command**: `/opencode-go` in any conversation prints the three windows as text.

## The usage API

`GET https://opencode.ai/zen/go/v1/usage` with `Authorization: Bearer `:

```json
{
  "usage": {
    "rolling": { "status": "ok", "percent": 0,  "resetsAt": "2026-08-14T07:51:13Z" },
    "weekly":  { "status": "ok", "percent": 1,  "resetsAt": "2026-08-17T00:00:00Z" },
    "monthly": { "status": "ok", "percent": 22, "resetsAt": "2026-08-21T13:05:13Z" }
  }
}