jiekesu967/dsh-plugin-opencode-usage 预览 preview

jiekesu967/dsh-plugin-opencode-usage

OpenCode Go 订阅用量悬浮面板:DeepSeek Harness Web 侧边栏显示滚动/每周/每月额度、已用与剩余额度。

Project Overview项目介绍

dsh-plugin-opencode-usage is a cordis plugin authored by jiekesu967 for the DeepSeek Harness (DSH) Web profile, distributed under the MIT license. Its single purpose is to register an isolated floating entry at the bottom-left corner of the DSH conversation window, then on click open a React panel that surfaces the user's OpenCode Go subscription usage across three windows (rolling, weekly, monthly), each card displaying used percent, remaining percent, and resets-at timestamp. Installation is performed with dsh plugin --profile web add dsh-plugin-opencode-usage, or alternatively from the GitHub repository or a local directory; after restarting dsh web and refreshing the page, the floating button becomes visible in the browser without taking any sidebar or input-box real estate.

The host half of the plugin resolves OPENCODE_GO_API_KEY via ctx.credentials.resolve, calls https://opencode.ai/zen/go/v1/usage with a Bearer header, and exposes the official percent plus resetsAt fields at GET /plugins/opencode-usage/stats, while the client half renders the panel anchored 12 px above the entry, capped at 392 px wide, with ResizeObserver following sidebar and detail-pane resizes. Auto-refresh runs every 60 s while open, the panel closes on Esc or outside click, and because the API only returns percentages the plugin deliberately avoids dollar conversions across differing model tiers. It is intended for DSH users who also hold an OpenCode Go subscription and want at-a-glance quota visibility inside the conversation surface.

Runtime dependencies are Node ^22.19.0 || >=24.0.0 plus @deepseek-ai/cordis ^4.0.2, @deepseek-ai/dsh-client-locale, dsh-client-ui-renderer, dsh-credentials, and dsh-host-webserver, all versioned >=0.1.5-rc.1 <0.2.0-0, with validation only against 0.1.5-rc.1 and rc.2; the plugin runs solely under the web profile (headless registers no route), and the stats route inherits the webserver bind address, defaulting to 127.0.0.1, so the API key must be present in ~/.dsh/.credentials.yaml or the Models/Credentials page before first use.

dsh-plugin-opencode-usage 是一款面向 DeepSeek Harness(DSH)Web profile 的 cordis 插件,由 jiekesu967 开发并以 MIT 协议开源。它唯一的目标是在 DSH 会话窗口左下角注入独立的悬浮入口按钮,点击后弹出 React 面板,展示 OpenCode Go 订阅的滚动、每周、每月三个窗口的用量百分比、剩余百分比与重置时间。安装方式为 dsh plugin --profile web add dsh-plugin-opencode-usage,也可从 GitHub 或本地路径装载,重启 dsh web 后即可在浏览器中看到入口。

典型流程:插件 host 半通过 ctx.credentials.resolve 解析 OPENCODE_GO_API_KEY,向 https://opencode.ai/zen/go/v1/usage 发起 Bearer 请求,将官方返回的 percent 与 resetsAt 暴露在 GET /plugins/opencode-usage/stats,再由客户端面板渲染并每 60 秒自动刷新,按 Esc 或点击外部关闭。目标用户是同时订阅 OpenCode Go 与 DeepSeek Harness、又希望在不打开外站的情况下随时核对额度的开发者。

依赖包括 Node 22.19 或 ≥24、@deepseek-ai/cordis ^4.0.2 及 dsh-client-locale、dsh-client-ui-renderer、dsh-credentials、dsh-host-webserver(均为 ≥0.1.5-rc.1 <0.2.0-0),仅验证 0.1.5-rc.1/rc.2;只适用于 web profile,headless 不注册路由,且该统计路由默认无鉴权,绑定 127.0.0.1,需在 ~/.dsh/.credentials.yaml 写入 API key。

Pre-install check安装前体检Compatibility · Security兼容性 · 安全性 1 warning1 项注意
  • 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 desktop add dsh-plugin-opencode-usage

把 jiekesu967/dsh-plugin-opencode-usage 加入你的 DSH 配置(web profile)即可启用。

READMEREADME

dsh-plugin-opencode-usage

OpenCode Go 订阅用量悬浮面板:在 DeepSeek Harness Web GUI 会话窗口左下角显示订阅额度使用情况。

DSH Plugin Platform License

功能

  • 在会话窗口左下角注册独立悬浮入口,不占用侧边栏入口,也不放入输入框,避免与其他插件冲突
  • 点击弹出悬浮面板,展示 OpenCode Go 订阅的三个窗口:滚动用量、每周用量、每月用量
  • 每张卡片显示:已用百分比 / 剩余百分比 / 重置时间
  • 不展示具体美元金额,避免不同模型额度金额不同造成误导
  • 面板以入口按钮为锚点:左边缘对齐按钮,底部在按钮上方 12px,随会话窗口/侧边栏变化自动调整
  • 打开期间每 60s 自动刷新;支持 Esc 与点击面板外部关闭
  • API key 只在 Harness host 进程内解析,不会下发浏览器

截图

OpenCode Go 订阅用量面板

工作原理

DSH Web 浏览器
   │  1. 点击会话窗口左下角按钮
   ▼
GET /plugins/opencode-usage/stats
   │
   ▼
DSH Host 插件
   │  2. ctx.credentials.resolve("OPENCODE_GO_API_KEY")
   │  3. GET https://opencode.ai/zen/go/v1/usage
   │     Authorization: Bearer <api-key>
   │  4. 透出 percent / remainingPercent / resetsAt
   ▼
返回 JSON,由 React 面板渲染

官方接口只返回 percent 与 resetsAt:

{
  "usage": {
    "rolling": { "status": "ok", "percent": 30, "resetsAt": "..." },
    "weekly":  { "status": "ok", "percent": 19, "resetsAt": "..." },
    "monthly": { "status": "ok", "percent": 9,  "resetsAt": "..." }
  }
}

插件直接展示官方 API 返回的百分比,不做金额换算。

目录结构

dsh-plugin-opencode-usage/
├── cordis.patch.yml   # bundle patch: 把插件插入 profile host 组合
├── lib/
│   ├── index.js       # Host 半: 订阅额度 API 查询 + HTTP 路由
│   └── client.js      # Client 半: 会话窗口左下角悬浮按钮 + 面板
├── LICENSE
├── package.json       # dsh.bundle / dsh.client 元数据
└── README.md

额度口径(背景说明,不用于显示)

不同模型的额度金额不同(例如 V4 Pro 月度 $15、V4 Flash 月度 $30, 整体月上限 $60),因此插件只展示官方 API 返回的百分比,不做金额换算。

窗口 官方接口字段 说明
滚动用量 usage.rolling 5 小时滚动窗口百分比
每周用量 usage.weekly 每周窗口百分比
每月用量 usage.monthly 月度窗口百分比

官方 API 只返回 percent 与 resetsAt;插件同时给出 remainingPercent = 100 - percent。

安装

DSH 桌面应用用的是 desktop profile,命令行 dsh web 用的是 web profile, 先确认要装进哪一个。

桌面端(DeepSeek Harness 桌面应用):

dsh plugin --profile desktop add dsh-plugin-opencode-usage

命令行 Web(dsh web):

dsh plugin --profile web add dsh-plugin-opencode-usage

Showing the opening section of the README — the full document lives in the repository以上为 README 开头摘要,完整文档在仓库内 · View the full README on GitHub →在 GitHub 查看完整 README →

← 上一个 Prev dsh-token-usage-ledger 下一个 Next data-asset-inspector →