DeepSeek Harness plugin

dsh-opencode-usage-fengyang

OpenCode Go 订阅用量监控:侧边栏底部常驻徽标(5h/周/月百分比,异常标红),点击在左侧弹出详情卡片(重置倒计时、趋势、告警、Key 配置),用量突增/超标标红提醒(防额度被他人盗刷)。

Jump to install

Source facts

Repository
FengYangXun123/dsh-opencode-usage
Latest update
Aug 15, 2026
Category
Notifications & Integrations
GitHub stars
0
Format
plugin
Catalog evidence
Upstream dsh.bundle evidence
Evidence path
package.json#dsh.bundle
Checked against
0.1.0-rc.8
Upstream check date
2026-08-20

This evidence comes from the upstream catalog. This site has not installed, run, or security-reviewed the plugin.

Install

Start with a prompt that asks an agent to review the GitHub repository and source. Switch to the command if you want to install it yourself.

Copy this prompt into DSH, Codex, or another agent and ask it to review the GitHub repository and source first.

Do not install or run any commands yet. Read this plugin's GitHub repository, README, and relevant source code. Then answer the questions below clearly and directly so I can decide whether it fits my needs:

1. What is this plugin, and what problem does it solve?
2. Who is it for, and what are its typical use cases?
3. How is it used after installation? Include one minimal example.
4. What known limitations or privacy, security, compatibility, or maintenance risks does it have?
5. Give a clear recommendation: recommend, conditionally recommend, or do not recommend, with reasons.

Distinguish statements documented by the repository, inferences from source code, and unknowns. If evidence is insufficient, say so explicitly. Do not guess or simply repeat the README.

GitHub: https://github.com/FengYangXun123/dsh-opencode-usage
Plugin: dsh-opencode-usage-fengyang
Author: FengYangXun123

Check the source files

Read the README and other files from this plugin directory before installing.

File explorer2 files
README.mdSource · read only

dsh-opencode-usage

DSH Web GUI 插件:订阅用量 / 余额监控(多 provider,当前支持 opencode-go 用量 + deepseek 余额)。两个表面共享同一份数据:

  • 侧边栏底部徽标sidebar.footer.action,设置入口上方,全局常驻——首页/空态也可见):显示主 provider(首个 usage 型)5h 0% 周 87% 月 46%,主 provider 为余额型时显示 DS CNY 110.00;侧边栏折叠时退化为小圆点,任一 provider 异常变红+红点;
  • 全局详情卡shell.overlay,点击徽标在左侧弹出,徽标正上方):每个 provider 独立区块(用量三格/余额卡、重置倒计时、趋势、告警)+ 分 provider 的 API Key 配置;Esc 或点遮罩关闭。

用于在额度被他人盗刷/余额异常消耗时第一时间发现异常,不遮挡会话内容

数据来源

provider类型接口
opencode-gousage(5h/周/月)GET https://opencode.ai/zen/go/v1/usage(官方未公开文档化接口,cc-switch #6433 发现)
deepseekbalanceGET https://api.deepseek.com/user/balance

安装

Profile Bundle(推荐)——路径用 Windows 正斜杠:

dsh plugin --profile web add "C:/path/to/dsh-opencode-usage"   # 或发布后: dsh plugin --profile web add dsh-opencode-usage

验证安装

dsh --profile web --dump-config | grep opencode-usage
# → - id: opencode-usage
#     name: 'dsh-opencode-usage'

运行验证(agent 端到端):dsh run "查一下 opencode 用量"(agent 会调用 opencode_usage 工具)。

然后重启 dsh web(Ctrl+C 后重新运行),侧边栏底部(设置入口上方)出现用量徽标。

配置 API Key(分 provider,环境变量优先——key 不落盘)

  • opencode-go:环境变量 OPENCODE_API_KEY > ~/.local/share/opencode/auth.jsonopencode /connect 登录)> 面板手动配置;
  • deepseek:环境变量 DEEPSEEK_API_KEY > 面板手动配置。

手动 Key 明文存 ~/.dsh/dsh-opencode-usage.json(权限 0600;Key 不经模型上下文,浏览器直连本机接口)——仅作兜底,推荐用环境变量。

能力与限制

  • opencode-go:官方用量统计(5h 滚动 / 周 / 月百分比 + 重置时间),写入本地历史(~/.dsh/dsh-opencode-usage-history.json,0600),默认每 5 分钟采样一次;deepseek:余额快照(不写历史);
  • 页面 60 秒自动刷新(全局单轮询)、重置倒计时每秒更新;
  • 告警:用量型单次增幅 ≥5%(6h 内)、深夜时段(23:00–06:59)增长 ≥1%、或 5h 滚动 ≥80% 标红;余额型 ≤20(任意币种)警告、≤0 标红;
  • agent 可用工具 opencode_usage 查询所有已配置 provider 状态。

安全提示:手动填写的 API Key 以明文保存在本机私有文件(0600),仅本机用户可读;请勿在不受信任的环境使用。怀疑 Key 泄露时,请到对应平台立即吊销并更换。

结构

lib/core.js     纯逻辑:Key 解析、/v1/usage 抓取与解析、历史采样、告警推导(可单测)
lib/index.js    宿主插件:/api/dsh-opencode-usage/{status,usage,refresh,config} 路由、
                opencode_usage 工具、systemPrompt 公告(loopback 信任围栏)
lib/client.js   浏览器端:composer.dock 一行 + sidebar.footer.action 徽标 + shell.overlay
                详情卡(React,shell 提供;共享 usage store 单轮询)
test/           自检:node test/selfcheck.mjs

自检(14 项)

npm test   # node test/selfcheck.mjs:解析/抓取/Key 解析/配置迁移/历史/告警(含深夜时段)/DeepSeek 余额/注册契约