← 返回列表
未验证
一个为 opencode.ai Zen 套餐提供实时用量与可用模型展示的 DeepSeek HarnessDSH…
尚未跑自动兼容性验证,可查看页面内的依赖与入口分析。 · 最近上游提交 2026/8/19 · 已提供中文文档
DeepSeek Harness (DSH) 动态插件:在设置行和上下文环上实时显示 opencode.ai Zen 配额使用情况(5小时/1周/1月)及套餐模型
综合分
27.9
GitHub 分
27.9
用户评分
—
★ Stars
1
周下载量
—
安装插件(需先安装 dsh CLI 引擎:npm install -g @deepseek-ai/dsh)
dsh plugin --profile web add xiaojiecode/opencode-helper该插件未发布到 npm,走 GitHub 源安装(pnpm 若拦截 prepare 脚本,按其提示在 pnpm-workspace.yaml 的 allowBuilds 中放行后重跑)
数据截至 2026/9/16(元数据每日更新 · 实装验证按队列轮转,单条结论的验证时间见上方)
用户评分
还没有人投票,来当第一个
订阅周报,不错过优质插件更新
每周一封 · 高评分插件 + 新用户活动
README
opencode-helper
一个为 opencode.ai Zen 套餐提供实时用量与可用模型展示的 DeepSeek Harness(DSH) 动态插件。
A DeepSeek Harness (DSH) dynamic plugin that shows real-time opencode.ai Zen quota usage and available models.
DSH
opencode
✨ Features / 功能
English
1. Live quota & plan models (host.js)
Polls opencode.ai every 30s, reads the available models of the current plan and three usage windows 5h / 1w / 1m:
- Usage: GET https://opencode.ai/zen/go/v1/usage → { usage: { rolling, weekly, monthly: { status, percent, resetsAt } } }
- Models: GET …/zen/go/v1/models (go family) / GET …/zen/v1/models (zen family)
- API keys come from DSH credentials and never appear in any RPC payload.
2. Settings → Models rows (client.js → ocu-models)
Compact inline usage mini-bars (5h / 1w / 1m) + plan model count in the free space between the provider name and its action buttons; hovering a row shows a full usage card (reset times + available models).
3. Context ring (ContextMeter) (client.js → ocu-ring)
When the active model belongs to an opencode provider:
- Hover: the native tooltip is suppressed and replaced by a DSH-styled usage bubble above the ring.
- Click: the native panel stays, and the usage block is appended inside the panel's lower part (no layout reflow — space is reserved before the first paint via a MutationObserver).
The progress bar color changes continuously with usage (green → amber → red via color-mix on theme tokens, theme-aware), and the ring keeps its stock behaviour for non-opencode models.
中文
1. 实时用量与可用模型(host.js)
每 30 秒轮询 opencode.ai,读取当前套餐的可模型列表与 5h / 1w / 1m 三档用量:
- 用量:GET https://opencode.ai/zen/go/v1/usage → { usage: { rolling, weekly, monthly: { status, percent, resetsAt } } }
- 模型:GET …/zen/go/v1/models(go 系)/ GET …/zen/v1/models(zen 系)
- API key 经 DSH credentials 解析,不经过任何 RPC 返回。
2. “设置 → 模型”行内用量(client.js → ocu-models)
在 provider 名称与操作按钮之间的空白处内联显示 5h / 1w / 1m 迷你用量条与套餐可用模型数;
悬停该行显示完整用量卡片(含重置时间与可用模型数)。
3. 上下文圆圈(ContextMeter)(client.js → ocu-ring)
当当前模型属于 opencode 系 Provider 时:
- 悬停:抑制原生 tooltip,改为在上方显示 DSH 风格的用量气泡;
- 点击:保留原生面板,并把用量块追加进面板内部下方(用 MutationObserver 在首帧绘制前占位,面板布局不重排)。
进度条颜色随用量连续渐变(绿 → 黄 → 红,基于主题 token 的 color-mix,明暗主题自适应);
非 opencode 模型时上下文保持原生行为不变。
🚀 Activate / 激活
DSH 动态插件仅在当前会话进程内生效(进程重启后丢失),应在 DSH GUI 中通过 Cordis 插件流程定义并运行。
The plugin is distributed as host.js (Host half) + client.js (Client half).
In DSH: define a dynamic plugin with the two halves below and run it.
code.host = contents of host.js
code.client = contents of client.js
Prereguisites / 前置条件:
- 本机可访问 https://opencode.ai。
- curl.exe(Windows 自带)或 curl,用于携带 Authorization 请求头(DSH 的 web.fetch 不允许自定义该头)。
- 凭据写入 ~/.dsh/.credentials.yaml:OPENCODE_GO_API_KEY / OPENCODE_API_KEY(或把 opencode 自身的
~/.local/share/opencode/auth.json 内容写入 DSH 凭据)。
🧩 Provider 识别规则 / Provider detection
针对 settings → llm-pi-ai.providers 中每一项,命中以下任一即为“opencode 系”:
- provider id 为 opencode / opencode-go;
- 或 apiKeyEnv 以 OPENCODE 开头;
- 或 baseURL 含 opencode.ai。
无任何匹配时回退扫描 OPENCODE_GO_API_KEY / OPENCODE_API_KEY 两个标准环境变量名。
相同 key 的多个 Provider 只抓取一次。
📁 Files / 文件
| File | Role |
| --- | --- |
| host.js | Host half: polling fetch, snapshot cache, ocu/state RPC |
| client.js | Client half: models-page inline bars + ring hover/click overlays |
🏷 Topics / 标签
GitHub topics:deepseek-harness, deepseek, dsh, cordis, plugin, opencode, opencode-zen, llm, usage, javascript
📄 License
MIT(如需其他协议,在 issue 中说明即可 / open an issue to request a change)。扫码进群