iamfromchangsha/dsh-go-balance
OpenCode Go 订阅余额小组件,适用于 DeepSeek Harness Web:在编辑器工具行右端显示滚动/每周/每月剩余配额。
Project Overview项目介绍
This is a purpose-built plugin for the DeepSeek Harness (DSH) web interface, adding a small OpenCode Go subscription balance widget to the right of the input bar’s send button. The widget displays the remaining quota percentage for three different billing windows: rolling, weekly, and monthly. All data is pulled directly from the official OpenCode Zen usage API, so it matches the numbers shown on your OpenCode Go dashboard exactly, no estimates are used. To install the plugin, you can use the built-in DSH plugin manager, which supports installing from the official registry, the public GitHub repository, or a local development directory.
The widget is compact, fitting neatly in the existing UI layout without taking extra space or disrupting your workflow. When you hover over the widget, a tooltip pops up with extra details including total used percentage, the reset time for each quota window, and the last time the data was refreshed. If any quota drops below 30%, the widget changes color to yellow as a warning, and it turns red if the remaining quota drops below 15%. If a refresh request fails, the widget keeps the last valid snapshot and marks it as stale, and it will not render at all if you have not configured your API credentials.
The plugin stores your API key securely via DSH’s built-in credential service, so the key never leaves the host process and is never exposed to the browser. It includes multiple security hardening features, like concurrency deduplication to avoid spamming the OpenCode API, rate limiting for the plugin’s API endpoint, and scrubbing of sensitive data from logs. You must have an active OpenCode Go subscription and a configured API key to use this plugin, and it only works with the DSH web interface. The plugin is released under the open source MIT license, with no usage costs or restrictions beyond the terms of the license.
这是一个专为DeepSeek Harness(DSH)Web界面开发的原生插件,它在输入框工具栏右侧、发送按钮旁新增了一个OpenCode Go订阅余额小部件。该部件会显示滚动、每周、每月三个配额窗口的剩余百分比,数据直接来自OpenCode Zen用量接口,是和Go订阅仪表页同源的真实数值而非估算值。
面向使用DSH作为OpenCode客户端的Go订阅用户,该插件提供了多项实用功能。鼠标悬停在部件上可以查看已用百分比、各窗口重置时间和数据更新时间;任一窗口余额低于30%会变黄警示,低于15%变红提醒;刷新失败会保留上次快照,未配置凭据时不会渲染占位。
你可以通过DSH官方插件命令安装,也可以直接从GitHub仓库或本地开发目录进行安装。使用需要你拥有有效的OpenCode Go订阅,并且在DSH凭据服务中配置好OPENCODE_ZERO_API_KEY,插件仅支持DSH Web界面,采用MIT许可开源分发。
请帮我安装这个 DSH 插件。安装前先完成【兼容性检查 + 安全性检查】,检查通过再动手。
插件:dsh-go-balance(iamfromchangsha/dsh-go-balance)
仓库:https://github.com/iamfromchangsha/dsh-go-balance
本站详情页:https://www.yhbd.top/plugins/iamfromchangsha-dsh-go-balance/
本站登记:类型 plugin · 归类 原生 DSH 插件 · 许可证 MIT · ⭐ 2 · 最近提交 2026-08-20 · 主语言 JavaScript
按下面顺序执行,每步先把结论告诉我,再进入下一步:
【1 兼容性检查】
① 我这边:DSH 版本、Node 版本、操作系统、当前 profile(web / desktop)。
② 读它的 README、package.json、插件 manifest,列出它要求的 DSH 版本 / Node 版本 / 操作系统 / 外部依赖 / 需要另外先装的运行时。
③ 逐条比对,结论只写「满足 / 不满足 / 未知」三种;不满足的给出可行替代方案。
④ 检查是否和我已装的插件冲突:命令名重复、skill / tool 重名、端口占用、重复注册的 MCP server。
【2 安全性检查】
① 仓库可信度:和上面「本站登记」是否一致;star / fork 数、创建时间、最近提交,是否归档或长期停更。
② 安装脚本:逐行看 package.json 的 preinstall / install / postinstall,以及 install.sh、setup.ps1 之类脚本。出现 curl|bash、下载后直接执行、混淆代码、访问与插件功能无关的域名,立刻停下来告诉我,不要继续装。
③ 依赖:列出新增依赖,标出无人维护、或与知名包拼写近似的可疑包(typosquatting)。
④ 权限与副作用:它会读写哪些目录、访问哪些域名、需要哪些 DSH 权限(filesystem / network / shell / clipboard 等),以及怎么卸载和回滚。
⑤ 如果它要求 sudo / 管理员权限,或权限明显超出功能所需,先停下来问我。
【3 安装】
上面两步没有「不满足」和「高危项」时才执行;用官方推荐方式安装,不要自行提权。
【4 汇报】
用表格输出:检查项 / 结论 / 依据 / 是否需要我决策。拿不准的一律写「未知」并说明要我怎么确认——不要猜,也不要替我决定。
Send this message to DSH in your current session: it verifies compatibility and security first (answering met / not met / unknown item by item) and only installs once everything checks out — it will stop and ask you if it finds a high-risk item. The box scrolls; the copy is the full prompt. CLI install commands may not be accurate across systems, so DSH is the safer route.把上面这条消息直接发给当前会话里的 DSH:它会先核对兼容性与安全性(逐条给「满足 / 不满足 / 未知」),确认没问题再安装,有高危项会停下来问你。框内可滚动,复制到的是完整提示词;安装命令不一定准确,发给 DSH 更稳。
- Only 2 stars - very few users, little community feedback星标只有 2,几乎没人在用,遇到问题缺少社区反馈
DSH walks through these 9 checksDSH 会逐条核对这 9 项
Compatibility兼容性
- DSH, Node, OS and profile requirementsDSH 版本 / Node 版本 / 操作系统 / profile 是否满足要求
- External dependencies and runtimes (Electron / Python / Docker, ...)外部依赖与运行时(Electron / Python / Docker 等)是否齐备
- Conflicts with installed plugins: command names, skill / tool names, ports, duplicate MCP registration与已装插件是否冲突:命令名、skill / tool 重名、端口占用、重复 MCP 注册
Security安全性
- Repo matches the facts registered here; archived or abandoned?仓库是否与页面登记一致,是否归档或长期停更
- Safety of preinstall / install / postinstall and install.sh / setup.ps1preinstall / install / postinstall 与 install.sh、setup.ps1 是否安全
- curl|bash, download-then-execute, obfuscation, unrelated domains → stop immediatelycurl|bash、下载即执行、混淆代码、无关域名 → 立刻停止
- Typosquatting or unmaintained packages among the new dependencies新增依赖里有没有 typosquatting 或无人维护的包
- Requested permissions vs. what the feature actually needs申请了哪些权限、是否超出功能所需(filesystem / network / shell / clipboard)
- Any sudo / admin requirement, plus uninstall and rollback是否要求 sudo / 管理员权限,以及卸载与回滚方式
Anything uncertain must be marked unknown with a note on how to confirm it. This site's signal screen is a static snapshot, not a security audit.拿不准的必须标「未知」并说明要我怎么确认。本站的信号筛查是静态快照,不能替代安全审计。
Or use CLI install (for developers)或使用命令行安装(适合开发者)
CLI Install命令行安装
dsh plugin --profile web add dsh-go-balance
把 iamfromchangsha/dsh-go-balance 加入你的 DSH 配置(web profile)即可启用。
READMEREADME
dsh-go-balance
给 DeepSeek Harness(DSH)Web 界面加一个 OpenCode Go 订阅余额小部件:在输入框工具行右侧(发送按钮旁)显示滚动 / 每周 / 每月三个配额窗口的剩余百分比,数据直接来自 OpenCode Zen 用量接口(Go 订阅仪表页同源),不是估算值。
功能
- 真实余额,非估算 — 用您的 Go API 密钥轮询
https://opencode.ai/zen/go/v1/usage,渲染与 Go 仪表页完全一致的数字。 - 紧凑胶囊 —
Go 96% · 94% · 97%(滚动 / 每周 / 每月剩余),位于发送按钮右侧。 - 悬停明细 — 已用百分比、各窗口重置时间、数据更新时间。
- 警示配色 — 任一窗口剩余低于 30% 变黄、低于 15% 变红。
- 容错 — 刷新失败保留上次快照并淡化标记;未配置凭据或尚无数据时不渲染。
- 凭据安全 — API 密钥运行时经 DSH 凭据服务解析(
OPENCODE_ZERO_API_KEY),只留在 host 进程内;本仓库不含任何密钥,也不会下发到浏览器。
截图



安装
dsh plugin --profile web add dsh-go-balance
然后重启 DSH(dsh web)。插件会自动加入 profile 的 bundle 层,无需其他配置。
也可以直接从 GitHub 仓库安装(例如镜像源尚未同步时):
dsh plugin --profile web add github:iamfromchangsha/dsh-go-balance
本地开发目录安装:
# 在插件仓库目录下执行(相对路径锚定到当前目录)
dsh plugin --profile web add file:./
凭据
插件通过 DSH 凭据服务读取 OPENCODE_ZERO_API_KEY($DSH_HOME/.credentials.yaml 或进程环境变量,即您 Go 订阅的 API 密钥),每次刷新时在 host 进程内解析。
配置
bundle 行暴露一个可选键:
| 键 | 默认值 | 含义 |
|---|---|---|
intervalMs |
60000 |
host 轮询 OpenCode Zen 用量接口的间隔(毫秒)。 |
在 profile 补丁层($DSH_HOME/profiles/web/cordis.patch.yml)覆盖:
- id: go-balance
config:
intervalMs: 120000
原理
一个 npm 包承载插件的两个半边:
- 节点半边(
lib/index.js)—goUsage服务:经ctx.credentials解析OPENCODE_ZERO_API_KEY,定时轮询 Zen 用量接口(请求发现缓存超过 30 秒也会顺手刷新),校验响应结构后在GET /go-usage提供快照。 - 浏览器半边(
lib/client.js)— 注册进conversation.input.right插槽(输入框工具行右端),每 60 秒以及标签页重新可见时拉取/go-usage。
安全与健壮性
- 并发去重 — 刷新调用共享同一个在途 Promise,定时器与懒刷新永远不会并发打到上游 API。
- 错误脱敏与密钥安全 — 返回浏览器的错误只含
code(和可选的 HTTPstatus);DNS 失败等内部细节仅写入 host 日志,且日志中的密钥串一律替换为[REDACTED]。密钥只经Authorization: Bearer发给 opencode.ai,仅存在于 host 进程内存,不落盘、不进日志、不过/go-usage。 - 路由防护 — DSH webServer 本身不强制鉴权("No TLS, auth, or origin policy"),默认只绑定回环地址即为边界;
/go-usage另拒绝非回环Origin的浏览器跨站读取(403),并带每地址 120 次/分钟的内存级速率限制(429)。快照只含配额百分比与重置时间,绝不含密钥或身份信息。 - 范围校验 —
percent必须是[0, 100]内的有限数字,上游返回畸形值会丢弃整份快照并保留上次有效数据。
开发
node --check lib/index.js && node --check lib/client.js
lib/client.js 随仓库提交并随包发布,安装时无需构建。
已知限制
- 需要有效的 OpenCode Go 订阅,且 DSH host 上配置了
OPENCODE_ZERO_API_KEY凭据。 - 仅支持 Web 界面(渲染的插槽属于 DSH Web UI)。
- 快照是面向用户的账户额度参考,不是计费记录。
wenzetan/dsh-quota-panel
brittanistrehlowll-oss/dsh-quota-panel
MeteorNOX/DeepSeek-Balance-Whale-Widget
edison7009/EchoBird
Han-1413141/dsh-cost-meter
Ychris12138/dsh-usage-stats
wink-run/tokenbank
JingbiaoMei/Tokdash