nianpangzhi233/dsh-billing
DSH Web GUI实时计费监控:Token/费用计量,DeepSeek v4峰值定价,余额锚定,侧边栏标签+设置页面,billing_balance智能体工具
Project Overview项目介绍
This is a billing monitoring plugin built exclusively for the DeepSeek Harness (DSH) Web GUI. It tracks model call usage and estimated costs for DSH running on the local machine, supports custom pricing matched by provider and specific model, and adapts to DeepSeek v4's tiered peak and off-peak pricing rules. The plugin can be installed directly via the official DSH CLI, by running the command dsh plugin --profile web add github:nianpangzhi233/dsh-billing, or from a local checked out copy or tarball. Once installed, you only need to restart the dsh web process to activate the plugin, which requires no build steps or DSH source code modifications.
After activation, the plugin adds a small real-time balance indicator pill to the bottom of the DSH sidebar that refreshes automatically every two seconds. The pill changes visual state to indicate whether your balance is sufficient, running low, or completely exhausted, so you can see your balance status at a quick glance. When you click the pill, an overview panel expands in the sidebar showing your total accumulated cost, number of API calls, token counts broken down by cached, input, and output, and a history of your recent transaction logs. The panel automatically closes when you collapse the DSH sidebar, and it also adds an agent tool called billing_balance that lets you query usage details directly from the agent.
The plugin is written entirely in plain JavaScript, has no build dependencies or required compilation steps, and is released under the permissive MIT open source license. It only tracks API calls initiated by your local DSH instance, and your DeepSeek API key is stored in plain text in a local ledger file on your personal machine. All billing calculations generated by the plugin are estimates, so actual final costs and official pricing are always determined by DeepSeek, and you should regularly sync and calibrate your official DeepSeek balance to keep your local stats accurate.
这是专为 DeepSeek Harness(DSH)Web GUI 开发的原生实时计费监控插件,可统计本机DSH上的模型调用用量与估算费用,支持按供应商和模型自定义匹配单价计费,适配DeepSeek v4的峰谷定价规则,提供余额锚定、官方单价与余额同步、账本持久化功能,全部基于DSH官方接口和客户端插槽系统实现,不需要修改DSH源码即可运行。
安装完成后重启DSH Web即可使用,插件会在侧边栏底部显示实时余额标签,每2秒自动刷新一次,并根据预设的告警阈值显示余额充足、不足或耗尽的状态提示。点击标签可展开概览面板,查看累计消费、调用次数、输入输出token用量、最近调用流水,收起侧边栏时面板会自动收起,还提供billing_balance Agent工具供查询计费明细。
本插件是纯JavaScript实现,无额外构建步骤,通过DSH的插件命令安装即可使用,遵循MIT许可开源。它仅统计本机DSH发起的模型调用,API Key以明文保存在本地用户的账本文件中,计费结果为估算值,实际单价和最终费用请以DeepSeek官方公示为准,建议用户定期同步校准官方余额。
请帮我安装这个 DSH 插件。安装前先完成【兼容性检查 + 安全性检查】,检查通过再动手。
插件:dsh-billing(nianpangzhi233/dsh-billing)
仓库:https://github.com/nianpangzhi233/dsh-billing
本站详情页:https://www.yhbd.top/plugins/nianpangzhi233-dsh-billing/
本站登记:类型 plugin · 归类 原生 DSH 插件 · 许可证 MIT · ⭐ 3 · 最近提交 2026-08-15 · 主语言 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 3 stars - very few users, little community feedback星标只有 3,几乎没人在用,遇到问题缺少社区反馈
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:nianpangzhi233/dsh-billing
把 nianpangzhi233/dsh-billing 加入你的 DSH 配置(web profile)即可启用。
READMEREADME
dsh-billing — DSH Web GUI 实时计费监控插件
English · 中文
为 DeepSeek Harness(DSH)Web GUI 定制的计费 监控插件:实时统计本机模型调用用量与费用,按供应商/模型单价计费(DeepSeek v4 峰谷价),支持余额锚定、官方单价同步与账本持久化。全部通过官方接口与客户端 slots 系统实现,不修改 DSH 源码。
能力
| 能力 | 说明 |
|---|---|
| 实时余额 | 侧边栏底部余额 pill,2 秒刷新;余额状态点(充足 / 不足 / 耗尽,告警闪烁) |
| 概览面板 | 点击 pill 在侧边栏内展开:已消费 / 调用次数 / 输入 / 输出 token + 最近流水(峰谷标签),收起侧边栏自动收起 |
| 供应商计费 | 按 供应商+模型 → 同名模型 → 供应商默认 → 全局默认 匹配单价;DeepSeek v4 自 08-17 起峰谷定价(高峰 = 北京 9–12、14–18,空闲半价),命中缓存输入按低单价计 |
| 官方余额同步 | 填入 DeepSeek API Key,一键调用官方 GET /user/balance 拉取余额(总余额 / 赠金 / 充值)并自动锚定;也支持手动粘贴校准 |
| 官方同步 | 一键拉取 DeepSeek 官方模型单价(内置基础价 + 持久化覆盖合并) |
| 设置页 | DSH 设置 → 「计费」分段:余额、阈值、默认单价、供应商单价表格、数据管理 |
| Agent 工具 | billing_balance:查询余额、费用、token 用量与按模型明细 |
| 持久化 | 账本 JSON 原子写入工作区,DSH 重启后自动恢复(余额、单价、流水) |
截图


安装
本包为纯 JS、无构建步骤(lib/ 即发布产物),git 安装即可用,无需
prepare 脚本、无需构建授权(符合官方打包规范):
# 从本仓库安装
dsh plugin --profile web add github:nianpangzhi233/dsh-billing
# 或本地 checkout / tarball
dsh plugin --profile web add ./dsh-billing
dsh plugin --profile web add ./dsh-billing-0.1.0.tgz
安装后重启 dsh web:侧边栏底部出现余额 pill(设置按钮上方)、
DSH 设置中出现「计费」分段,Agent 提示词中自动出现 billing_balance 工具说明。
配置
DSH 设置 → 「计费」分段(或侧边栏底部 pill 展开面板):
- 余额:DeepSeek API Key(sk-…)自动同步官方余额(总余额 / 赠金 / 充值, 限流约 1 次/分钟)、手动粘贴锚定、初始余额、低余额告警阈值(默认 ¥20)
- 计费单价:未知供应商默认单价(¥ / 1M tokens)+ 按供应商/模型单价表, 可增删行;「同步官方单价」一键拉取 DeepSeek 官方价目
- 数据:账本路径与保存时间、保存配置、重置用量(两次点击确认)
数据
- 账本文件:
.dsh-billing-ledger.json(工作区目录优先,spRoot 兜底), v2 结构:config(初始余额 / 阈值 / API Key / 单价嵌套表)/usage(token 分项计数)/ledger(每次调用流水,含峰谷费率)/startedAt - 单价匹配顺序:供应商+模型 → 任意供应商同名模型 → 该供应商默认 → 全局默认
- 峰谷价:高峰 = 北京 9–12、14–18;其余为谷(半价);08-17 起对 deepseek 供应商 v4 模型生效
注意事项
- 只统计本机 DSH 的模型调用;官方余额含其他渠道消费,建议定期同步校准。
- API Key 以明文存于本机账本文件(与
~/.dsh/dsh-ssh.json同一信任模型, 文件权限 0600);同步请求仅发给api.deepseek.com,响应只取余额字段。 - token 用量按分离计数:未命中输入(
inputTokens)、缓存命中输入 (cacheReadTokens)、输出(outputTokens)。 - 计费为估算,单价与费率以 DeepSeek 官方为准;「同步官方单价」仅在官方 价目页可达时生效(需要平台 web provider)。
- 路由
/api/dsh-billing/*仅限 loopback(同源校验)。
Han-1413141/dsh-cost-meter
wssfk12138/dsh-damage-pulse
Aisland-SJL/dsh-usage
songoao25/dsh-bottom-info-bar
Phant0Meow/dsh-meow-cachebilling
Rianico/dsh-better-edit
Witherwithwinter/DeepSeek-Balance-Whale-Widget-Bowl
Ghost011118/dsh-balance-meter