CN-Leo/dsh-deepseek-balance
deepseek-harness 插件,实时查询 DeepSeek 账号余额。
Project Overview项目介绍
This is a native plugin built exclusively for DeepSeek Harness (DSH), designed to display real-time DeepSeek account balance and session consumption directly on the DSH web interface. The balance widget is permanently docked below the conversation composer input box, and refreshes automatically every 15 seconds. It pulls balance data from DeepSeek's official GET /user/balance API endpoint, and your DeepSeek API key is resolved locally by DSH's credential service, never being exposed to the browser frontend to keep your key secure. To install the plugin, run dsh plugin add <repository-url or local-path> via the DSH CLI, then restart the DSH web process to activate it, since DSH does not currently support hot-loading new plugins.
After installation, you must configure your DeepSeek API key before the plugin can work properly. The plugin checks for the key in two locations: first the DEEPSEEK_API_KEY environment variable, then the $DSH_HOME/.credentials.yaml file, and it re-reads the key on every request so you do not need to restart the plugin after updating the configuration. The plugin calculates consumption per model in your current session, extracting token usage directly from the session log and applying DeepSeek's official pricing. It automatically differentiates between peak and off-peak Beijing time pricing for DeepSeek models, and ignores non-DeepSeek models for consumption calculation.
When you hover your cursor over the balance widget, you can view a full breakdown of your account balance and session usage. The breakdown shows total, granted, and top-up balance, your account status, token usage split by model, and current time period for pricing. The plugin relies on core DSH services including credentials, subprocess, webServer, and the React framework provided by DSH's web module. It also requires curl to be available on your system path, which is pre-installed by default on Windows and most Linux distributions. The plugin is released under the open MIT license, so you can modify or redistribute it freely per the license terms.
这是一款专为DeepSeek Harness(DSH)开发的原生插件,核心功能是在DSH的Web界面中实时显示DeepSeek账户余额。插件将余额信息常驻展示在会话输入框下方,每15秒自动刷新一次,同时还能根据DeepSeek官方最新定价,实时计算当前对话已经产生的消费金额。数据调用官方接口获取,API密钥由DSH主机端凭据库解析,绝不会传递到浏览器端,保证密钥安全。
安装插件可以通过DSH CLI执行dsh plugin add命令,填写GitHub仓库地址或本地插件路径即可完成安装,安装后需要重启DSH Web服务才能完成加载,当前DSH不支持热加载新插件。配置时需要在环境变量或$DSH_HOME/.credentials.yaml中填写DeepSeek API密钥,插件每次请求都会重新解析凭据,配置后无需再次重启服务。这款工具适合经常通过DSH使用DeepSeek API对话的用户,方便随时掌握账户余额和会话消费。
插件支持分模型计算当前会话的token用量和消费,自动区分北京时段的峰谷定价,仅对DeepSeek官方模型计价,第三方模型不会计入本次会话消费。悬停在余额条上可以查看完整明细,包括各类型余额、分模型token用量、当前时段等信息。插件依赖DSH基础服务和系统自带的curl工具,使用MIT开源协议,完全免费供用户使用,可自行按需修改源码。
请帮我安装这个 DSH 插件。安装前先完成【兼容性检查 + 安全性检查】,检查通过再动手。
插件:dsh-deepseek-balance(CN-Leo/dsh-deepseek-balance)
仓库:https://github.com/CN-Leo/dsh-deepseek-balance
本站详情页:https://www.yhbd.top/plugins/cn-leo-dsh-deepseek-balance/
本站登记:类型 plugin · 归类 原生 DSH 插件 · 许可证 MIT · ⭐ 2 · 最近提交 2026-08-17 · 主语言 JavaScript
按下面顺序执行,每步先把结论告诉我,再进入下一步:
【1 兼容性检查】
① 我这边:DSH 版本、Node 版本、操作系统、当前 profile(web / desktop)。
② 读它的 README、package.json、插件 manifest,列出它要求的 DSH 版本 / Node 版本 / 操作系统 / 外部依赖 / 需要另外先装的运行时。
③ 逐条比对,结论只写「满足 / 不满足 / 未知」三种;不满足的给出可行替代方案。
④ 检查是否和我已装的插件冲突:命令名重复、skill / tool 重名、端口占用、重复注册的 MCP server。
【2 安全性检查】
① 仓库可信度:和上面「本站登记」是否一致;star / fork 数、创建时间、最近提交,是否归档或长期停更。
② 安装脚本:逐行看 package.json 的 preinstall / install / postinstall,以及 install.sh、setup.ps1 之类脚本。出现 curl|bash、下载后直接执行、混淆代码、访问与插件功能无关的域名,立刻停下来告诉我,不要继续装。
③ 依赖:列出新增依赖,标出无人维护、或与知名包拼写近似的可疑包(typosquatting)。
④ 权限与副作用:它会读写哪些目录、访问哪些域名、需要哪些 DSH 权限(filesystem / network / shell / clipboard 等),以及怎么卸载和回滚。
⑤ 如果它要求 sudo / 管理员权限,或权限明显超出功能所需,先停下来问我。
【3 安装】
上面两步没有「不满足」和「高危项」时才执行;用官方推荐方式安装,不要自行提权。
【4 汇报】
用表格输出:检查项 / 结论 / 依据 / 是否需要我决策。拿不准的一律写「未知」并说明要我怎么确认——不要猜,也不要替我决定。
Send this message to DSH in your current session: it verifies compatibility and security first (answering met / not met / unknown item by item) and only installs once everything checks out — it will stop and ask you if it finds a high-risk item. The box scrolls; the copy is the full prompt. CLI install commands may not be accurate across systems, so DSH is the safer route.把上面这条消息直接发给当前会话里的 DSH:它会先核对兼容性与安全性(逐条给「满足 / 不满足 / 未知」),确认没问题再安装,有高危项会停下来问你。框内可滚动,复制到的是完整提示词;安装命令不一定准确,发给 DSH 更稳。
- 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 web add github:CN-Leo/dsh-deepseek-balance
把 CN-Leo/dsh-deepseek-balance 加入你的 DSH 配置(web profile)即可启用。
READMEREADME
dsh-deepseek-balance
DeepSeek 账户余额实时显示插件(DeepSeek Harness / DSH)。
在 DSH Web 界面的输入框下方(conversation.composer.dock)常驻显示 DeepSeek 官方账户余额,每 15 秒自动刷新;同时按官网最新定价实时计算本次会话消费金额。数据来自官方接口 GET https://api.deepseek.com/user/balance,API Key 由 Host 端从 DSH 凭据库解析,绝不会进入浏览器。
安装
# 从 Git 仓库(发布后)
dsh plugin add https://github.com/<你的用户名>/dsh-deepseek-balance
# 或从本地目录
dsh plugin add /path/to/dsh-deepseek-balance
安装后重启 dsh web(当前进程不会热加载新插件)。
配置(必需)
插件通过 credentials 服务解析 DEEPSEEK_API_KEY,按以下顺序查找(任选其一):
环境变量
DEEPSEEK_API_KEY$DSH_HOME/.credentials.yaml:DEEPSEEK_API_KEY: sk-xxxxxxxxxxxxxxxx
配置后无需重启插件:每次请求都会重新解析凭据。
使用
- 余额条显示在会话输入框下方:
● DeepSeek 余额 ¥71.33 | 本会话 ¥4.85- 绿点 = 正常,黄点 = 加载中,红点 = 获取失败
- 「本会话消费」按会话实际使用的模型分模型计价(从会话日志逐次提取每个模型调用的 token 用量),仅 deepseek-v4-flash / deepseek-v4-pro 套用官网价格,自动区分高峰/空闲时段(北京时间 9:00-12:00、14:00-18:00 为高峰,其余空闲),每 15 秒与余额一同刷新
- 悬停(hover)余额条可查看完整明细:
- 各币种余额:总额 / 赠送 / 充值 / 账户可用状态
- 本次会话按模型分列的 token 用量:输入(未命中/命中/写入)、输出
- 当前时段、本次会话消费金额
- 说明:非 DeepSeek 模型(如第三方 "…-pro")不套用 DeepSeek 价格表、不计入消费金额;缓存写入按缓存未命中输入价计(官方价格表仅区分命中/未命中)
原理
| 端 | 职责 |
|---|---|
| Host | credentials.resolve('DEEPSEEK_API_KEY') → subprocess 调用 curl 请求官方余额接口;同时读取本会话日志(sessionQuery.readSession),按 request/header 的模型与 assistant/message 的 usage 逐次配对、按模型聚合 token → 通过 webServer 暴露 GET /api/deepseek-balance?session=<id> |
| Client | 浏览器 fetch('/api/deepseek-balance?session=<id>') 每 15s 轮询余额与分模型用量 → 按官网定价表 + 北京时间峰谷时段本地计价(非 DeepSeek 模型跳过) |
API Key 只存在于 Host 进程的 curl 子进程参数中,浏览器端只能拿到余额 JSON。
卸载
dsh plugin remove dsh-deepseek-balance
依赖
- Host:
credentials、subprocess、sandboxPolicy、webServer(DSH 基础服务,Web 模式均有) - Client:
slots服务,react(由 DSH Web 模块表提供) - 系统:
curl(Windows 自带curl.exe;其他平台需 PATH 中有 curl)
License
MIT
MeteorNOX/DeepSeek-Balance-Whale-Widget
edison7009/EchoBird
Han-1413141/dsh-cost-meter
wssfk12138/dsh-damage-pulse
zh667/TokenLedger
edonadei/caliper
Ychris12138/dsh-usage-stats
Aisland-SJL/dsh-usage