zoumutou/dsh-cost-balance

DeepSeek Harness 插件:输入框下方 iOS 风格统计条——会话花费、账户余额、缓存命中、Token 用量一键展开

Project Overview项目介绍

This is a native Web UI plugin built exclusively for DeepSeek Harness (DSH). After installation, it adds an interactive control below the DSH conversation input box. By default, it folds into a small black bar similar to the iOS home indicator, and clicking it expands a semi-transparent frosted glass panel that displays various statistics for the current conversation. You can install it with one command using the official DSH CLI, which pulls the published package from the npm registry and adds it to your profile's bundle layer automatically. After installation, you just need to refresh or restart the DSH Web UI to start using the plugin.

The plugin displays conversation stats including turn count, LLM inference time, average first token latency, cache hit rate, input and output token usage, current session cost, and real-time balance of your DeepSeek account. The balance automatically refreshes every 60 seconds by calling DeepSeek's official API using your stored API key, so you don't have to open a separate browser tab to check your account status. This plugin is especially useful for DSH users who frequently call the DeepSeek API and need to keep a close eye on their usage cost to avoid unexpected overage charges.

The plugin comes with DeepSeek's latest official model pricing built in, and supports custom price overrides. If DeepSeek adjusts its pricing or introduces new billing rules like peak/off-peak pricing, you can update the pricing directly in your DSH profile's configuration file, no need to wait for a plugin update. The entire plugin is open source under the permissive MIT license, and can be installed either from the npm public registry or directly from source code for development purposes. If your API key is not configured or the balance fetch fails, the plugin will simply show a placeholder for the balance field.

这是一个专为 DeepSeek Harness (DSH) 开发的原生 Web UI 插件,安装后会在 DSH 对话输入框下方新增一个可交互控件,默认折叠为类似 iOS 底部横条的小黑条,点击即可展开半透明毛玻璃面板,展示当前会话的各类统计数据。统计内容包含对话轮次步数、LLM 耗时、首 token 平均延迟、缓存命中率、Token 输入输出用量、本会话花费以及 DeepSeek 账户实时余额。可通过 DSH 官方 CLI 命令一键安装,安装后刷新 Web UI 即可使用,卸载也仅需一条 CLI 命令。

DSH 用户可以在每次对话过程中实时查看当前会话的花费情况和账户剩余余额,不用手动跳转到 DeepSeek 官方后台查询,也能直观看到缓存命中率和 Token 吞吐等性能数据,帮助用户更好地控制 API 调用成本。对于需要频繁使用 DeepSeek API 进行开发的 DSH 用户,这个插件可以随时提醒当前的花费进度,避免因忘记关注用量导致意外超支,也方便用户调整对话策略来控制 API 使用成本。

插件内置 DeepSeek 官方最新的模型定价表,支持自定义修改定价,用户可以在自己的 profile 配置文件中覆盖内置价格,适配 DeepSeek 未来的价格调整或峰谷计费规则,不需要等待插件更新。插件代码基于 MIT 许可证开源,支持从 npm 官方源或源码两种方式安装,余额读取自用户自己的 API Key 账户,未配置 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 web add dsh-cost-balance

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

READMEREADME

dsh-cost-balance

npm version npm downloads License: MIT

DeepSeek Harness(DSH)Web UI 插件:在输入框下方显示一条 iOS 风格的小黑条,点击展开轻盈的半透明多行面板,查看会话花费、账户余额、缓存命中、Token 用量等统计。

默认折叠为一条居中的小黑条(类似 iOS 底部横条),点击展开毛玻璃面板:

行 内容
轮次 · 步数 3 轮 · 12 步
LLM 耗时 / 工具调用 45.2s / 12.3s
首 token 平均 / 吞吐 1.4s / 25.4 tok/s
缓存命中 87%
Token 输入 12.2K · 输出 517
花费 $0.0123(本会话,按官方定价)
余额 ¥9.00(DeepSeek 账户实时余额,60s 自动刷新)

安装(npm 发布版)

dsh plugin --profile web add dsh-cost-balance

该命令从 npm registry 拉取已发布的 dsh-cost-balance(dsh.bundle),自动加入 profile 的 bundle 层。

然后重启(或刷新)DSH Web UI。卸载:dsh plugin --profile web remove dsh-cost-balance。

工作原理

  • Client 半(lib/client.js):注册在 conversation.composer.dock 槽位(接管 shipped 的 stats 单元格,与产品自带统计行同源同数据),展示折叠/展开 UI;通过同源 GET /api/cost-balance 读取数据,每 60 秒自动刷新,token 用量变化时即时重算。
  • Host 半(lib/index.js):经 webServer 注册 /api/cost-balance 路由——花费按会话累计 token(未命中输入 / 缓存命中 / 缓存写入 / 输出)× 模型单价计算;余额经 credentials 服务解析 DEEPSEEK_API_KEY 后调用 DeepSeek 官方 GET /user/balance(60s 缓存、失败 30s 抑制)。

余额取自用户自己的 API Key 账户,无需任何配置;未配置或抓取失败时面板显示 余额 --。

定价与覆盖

内置 DeepSeek 官方定价(USD / 1M tokens):

模型 缓存命中 缓存未命中 输出
deepseek-v4-flash $0.0028 $0.14 $0.28
deepseek-v4-pro $0.003625 $0.435 $0.87

DeepSeek 将于 2026-08-16 16:00 UTC 起切换峰谷计费(off-peak 为 peak 的一半)。价格变更时无需等插件更新——在 profile 的 cordis.patch.yml 里覆盖即可:

# ~/.dsh/profiles/<你的profile>/cordis.patch.yml
- id: cost-balance
  config:
    prices:
      deepseek-v4-flash:
        cacheHit: 0.014
        cacheMiss: 0.44
        output: 1.32

(覆盖是整行替换,务必保留 id: cost-balance。)

从源码安装(开发)

git clone https://github.com/zoumutou/dsh-cost-balance.git
cd dsh-cost-balance
dsh plugin --profile web add .

发布新版本:修改 package.json 的 version 后 npm publish(账号需 2FA 绕过 token,见 npm 文档)。

许可

MIT

← 上一个 Prev dsh-desktop 下一个 Next dsh-reasoning-translator →