
vinyumao/dsh-opencode-usage
30最近提交 2026年8月15日
dsh-opencode-usage DSH 插件
该插件在 DSH 消息输入框下方添加一个持久徽章,展示滚动、每周和每月用量百分比。点击徽章可展开卡片,显示进度条、重置倒计时和配置表单。同时注册 `opencode_go_usage` 工具,供智能体直接查询用量。
如何安装 dsh-opencode-usage DSH 插件
dsh plugin --profile web add github:vinyumao/dsh-opencode-usage#<ref>来源命令需要人工核对。复制不会执行命令。
dsh-opencode-usage DSH 插件数据来源
dsh-opencode-usage DSH 插件快照日期:2026年8月16日
discovered
dsh-opencode-usage DSH 插件能做什么
- 消息输入框下的持久徽章,显示滚动/每周/每月用量百分比
- 点击徽章展开卡片,包含进度条和每秒重置倒计时
- 配置表单:设置 API 密钥、基础 URL、刷新间隔和网页用量 URL
- 双语界面(中文/英文),跟随全局 DSH 语言设置
- 密钥复用:默认使用环境变量 OPENCODE_GO_API_KEY,实现零配置
- 智能体工具 `opencode_go_usage` 返回三个窗口的用量和重置时间
- API 密钥不出现在浏览器中,通过宿主进程回环路由代理
dsh-opencode-usage DSH 插件适合哪些场景
- 在 DSH 聊天界面中直接监控 OpenCode Go 计划用量
- 在执行大型模型任务前快速检查剩余配额
- 无需离开网页界面即可配置 API 密钥和刷新间隔
- 让智能体自动检查用量并通知用户计划限制
- 跟踪滚动、每周和每月窗口的用量趋势
dsh-opencode-usage DSH 插件适合谁
- 拥有 OpenCode Go 订阅计划的 DSH 用户
- 希望在 DSH 工作区内监控 OpenCode 配额的开发者
dsh-opencode-usage DSH 插件的限制
- 仅支持 OpenCode Go 计划;不支持 OpenCode Zen(按量付费)余额
- 徽章仅在会话开启时可见;无会话时隐藏
- 用量端点未正式文档化,可能变化(插件已做防御性解析)
- 配置表单的密钥输入采用追加/覆盖语义:空密钥保留当前密钥,无法通过表单回退到环境变量
- 需要 OpenCode API 密钥(来自环境变量或配置文件)
dsh-opencode-usage DSH 插件的仓库 README 摘录
以下文字摘自 dsh-opencode-usage DSH 插件的上游仓库 vinyumao/dsh-opencode-usage 的 README,版权归原作者,仅作引用。
Official DSH bundle plugin. Install with one command: ``` dsh plugin --profile web add github:vinyumao/dsh-opencode-usage#<ref> ``` **English** | [中文](README.zh.md) ## Capability surface | Tool | Description | | --- | --- | | `opencode_go_usage` | Query OpenCode Go plan balance in chat: used percent + reset countdown for the three windows (no arguments) | | UI capability | Description | | --- | --- | | Persistent badge | One line under the composer input: `OpenCode Go:滚动用量 0% · 每周用量 0% · 每月用量 0%`, auto-refreshing on a configurable interval | | Usage card | Click the badge to expand: progress bars for the three windows + used percent + per-second reset countdown + instant refresh + an `opencode` link that opens the web usage dashboard in a new tab | | Config form | Fill in API key / Base URL / refresh interval / web usage URL right in the card; saved immediately | | Bilingual UI | 中文 / English — every string follows the global DSH locale (Settings → General → Language), and the card footer has a built-in 中文 / English toggle that switches the whole GUI | | Key reuse | API key defaults to the `OPENCODE_GO_API_KEY` environment variable — the same one the DSH opencode-go model prov
阅读完整 README仓库许可: MIT
dsh-opencode-usage DSH 插件常见问题
如何安装 OpenCode 用量插件?
在终端中运行命令 `dsh plugin --profile web add github:vinyumao/dsh-opencode-usage#<ref>`,其中 `<ref>` 是提交 SHA 或标签。然后重启 `dsh web` 进程。徽章会出现在消息输入框下方。详细步骤请参阅 README 的安装部分。
徽章显示“查询失败”怎么办?
这通常表示 API 密钥缺失或无效。首先检查 `OPENCODE_GO_API_KEY` 环境变量是否正确设置。你也可以点击徽章打开配置卡片,手动输入 API 密钥。密钥存储在 `~/.dsh/dsh-opencode-usage.json` 中。如果问题仍然存在,请确认你的 OpenCode Go 订阅有效且端点可访问。
这个插件支持 OpenCode Zen 吗?
不支持,此插件专门用于 OpenCode Go 计划。OpenCode Zen 使用不同的按量付费计费模型,没有公开的余额查询 API 端点。README 提到,如果将来 Zen 提供了 API,可以通过 `plan` 选项增加支持。
如何卸载插件?
使用命令 `dsh plugin --profile web remove @chen-001/dsh-opencode-usage`,然后重启 `dsh web`。徽章和智能体工具将被移除。如果不再需要,可以删除配置文件 `~/.dsh/dsh-opencode-usage.json`。手动卸载步骤请参考 README 的卸载部分。
可以配置徽章的刷新间隔吗?
可以。你可以在配置卡片中或 `~/.dsh/dsh-opencode-usage.json` 文件中设置 `refreshSeconds` 选项。默认值为 300 秒(5 分钟),最小值为 10 秒。保存后立即生效。