linshule/dsh-balance 预览 preview

linshule/dsh-balance

DeepSeek API余额 + OpenCodeGo余量实时显示插件(dsh web GUI):可拖拽双段徽章与详情弹层 + DeepSeek/OpenCodeGo两个设置页;Key仅存本机~/.dsh/ds-balance.json,OpenCodeGo Key自动读取DSH凭据

Project Overview项目介绍

dsh-balance is a native plugin built exclusively for the DeepSeek Harness (DSH) Web GUI, designed to monitor two key metrics: your DeepSeek API account balance and your OpenCodeGo plan usage quota. You can install it via three different methods: the recommended way is running dsh plugin --profile web add github:linshule/dsh-balance in your terminal, or you can clone it locally for development, or install it from npm once published. After installation completes, you need to restart your dsh web process for the plugin to take effect. It adds a draggable floating badge to the bottom left corner of the GUI that shows real-time balance and quota data at a glance.

This plugin is built for DSH Web users who regularly use both DeepSeek API services and the OpenCodeGo plan, helping them avoid unexpected work interruptions from exhausted quota or balance. After you restart dsh web, you can click the badge in the bottom left corner to open the configuration overlay. You only need to paste and save your DeepSeek API key to start monitoring balance; OpenCodeGo quota monitoring works out of the box because it automatically reads your existing OpenCodeGo API key from DSH’s credential storage, though you can override it if needed. The badge updates automatically based on your set refresh interval, and color codes its status dot to alert you when remaining balance or quota gets low.

The plugin has no third-party runtime dependencies, only relying on built-in Node.js modules and DSH Web runtime services. All sensitive API keys are stored locally on your machine in ~/.dsh/ds-balance.json with 0600 permissions, meaning only your user account can read them. All plugin API routes are restricted to localhost access only, so keys never leave your local machine. The project is distributed under the permissive MIT open source license, and it supports automatic retry for network errors common on Windows to improve reliability. It also remembers your custom badge position and refresh interval across restarts, so you only need to configure it once.

dsh-balance 是专为 DeepSeek Harness (DSH) Web GUI 打造的原生插件,核心功能是同时监控 DeepSeek API 账户余额和 OpenCodeGo 计划的使用余量。它会在网页左下角生成一个可拖拽的悬浮徽章,用不同颜色圆点标识余量状态,点击可展开详情面板,支持自动刷新、密钥就地管理,还会记忆徽章位置和刷新间隔。

该插件面向同时使用 DeepSeek API 和 OpenCodeGo 计划的 DSH Web 用户,能帮助用户实时掌握额度消耗情况,避免因额度耗尽中断开发工作。安装完成重启 DSH Web 后,点击左下角徽章即可进入配置,输入 DeepSeek API 密钥后即可开始监控,OpenCodeGo 密钥默认会自动从 DSH 凭据中读取,无需额外配置。

插件完全遵循 DSH 原生插件规范,无需第三方运行时依赖,仅依赖 Node.js 内置模块和 DSH Web 运行时服务。所有密钥仅保存在本地,权限设置为仅本机可读,所有 API 路由仅允许回环地址访问,密钥不会流出本机。项目采用 MIT 开源许可证,用户可通过 DSH 命令行从 GitHub 或 npm 一键安装。

Pre-install check安装前体检Compatibility · Security兼容性 · 安全性 1 warning1 项注意
  • Only 5 stars - very few users, little community feedback星标只有 5,几乎没人在用,遇到问题缺少社区反馈
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 github:linshule/dsh-balance

把 linshule/dsh-balance 加入你的 DSH 配置(web profile)即可启用。

READMEREADME

dsh-balance

DeepSeek API 账户余额 + OpenCodeGo(opencode.ai Go 计划)余量 · dsh web GUI 常驻插件

一个为 DeepSeek Harness(dsh)Web GUI 打造的双指标监控插件: 左下角悬浮徽章同时显示 DeepSeek 账户余额(人民币/美元)与 OpenCodeGo 计划余量(近 5 小时 / 近 7 天 / 近 30 天三窗口),点击可展开详情、就地管理 Key,并支持自动刷新。

界面预览

上图为示意渲染。实际徽章位于左侧边栏左下角、设置按钮上方,可拖拽。


功能特性

徽章(左下角悬浮,可拖拽)

  • 双段显示:DeepSeek 余量 ¥4.92 · Go 余量 100%
  • 状态圆点:🟢 可用 / 🟡 偏低(剩余 20–50%)/ 🔴 不可用或出错 / ⚪ 未配置
  • 可拖拽:按住拖动调整位置,松手记忆(浏览器 localStorage,默认 left:12, bottom:110)
  • 点击弹层:DeepSeek 余量明细(总余额 / 充值 / 赠金、可用状态)+ OpenCodeGo 三窗口进度条(已用 % · 剩余 % · 重置时间)+ Key 内联保存 / 清除 + 立即刷新

设置页(设置 → 两个独立分区)

  • DeepSeek 余额:API Key 管理(保存 / 清除)、自动刷新间隔(30 秒 / 1 分钟 / 5 分钟)、余额明细
  • OpenCodeGo 余量:Key 管理(选填,留空自动读取 DSH 凭据)、三窗口余量明细与重置时间

刷新策略

  • 模块级轮询:插件存活期间始终按设定间隔刷新余额 + 余量(与哪个界面挂载无关)
  • 默认 1 分钟,可调;刷新间隔跨重启记忆
  • 网络抖动自愈:curl 走 HTTP/1.1 + 自动重试(规避 Windows schannel 瞬时断连 exit 56)

安全

  • 所有 /api/ds-balance/* 路由仅回环地址(127.0.0.1 / localhost)可访问,Key 绝不离开本机
  • Key 以 0600 权限持久化在 ~/.dsh/ds-balance.json(仅本机可读)
  • 设置页在线保存后重启不丢失

安装

方式一:从 GitHub 仓库安装(推荐)

dsh plugin --profile web add github:linshule/dsh-balance

方式二:本地链接(开发模式)

# 克隆到 web profile 同盘目录(pnpm 在 Windows 上对跨盘 link: 绝对路径会拼接错误)
git clone https://github.com/linshule/dsh-balance.git <profile>/plugins/ds-balance
dsh plugin --profile web add link:./plugins/ds-balance

方式三:npm 包(发布后可用)

dsh plugin --profile web add @linshule/dsh-balance

安装后重启 dsh web 生效(插件行由包内 cordis.patch.yml 的 dsh.bundle.patch 声明)。


快速开始

  1. 重启后点击左下角徽章(或 设置 → DeepSeek 余额)
  2. 粘贴 sk-... DeepSeek API Key 保存 —— 持久化到 ~/.dsh/ds-balance.json,重启无需重填
  3. OpenCodeGo 余量零配置:默认自动读取 ~/.dsh/.credentials.yaml 中的 OPENCODE_GO_API_KEY (仅当默认提供商为 opencode-go 时;也可在设置页单独指定一个 Key 覆盖)
  4. 拖动徽章调整位置,松手自动记忆

OpenCodeGo 余量详解

数据来源

官方接口:GET https://opencode.ai/zen/go/v1/usage(Bearer 认证) 前端域名备选:https://opencode.ai/api/v1/usage、https://api.opencode.ai/v1/usage

接口实现见官方仓库 anomalyco/opencode packages/console/app/src/routes/zen/go/v1/usage.ts。

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-phoenix 下一个 Next dsh-frostfin →