TheTianzz/dsh-billing 预览 preview

TheTianzz/dsh-billing

DeepSeek Harness 插件:账户余额 + 会话费用(/balance /cost 命令、deepseek_billing 工具、Web UI 双胶囊),官方价格每 12 小时自动同步

Project Overview项目介绍

dsh-billing is a native DeepSeek Harness plugin built exclusively to track DeepSeek API usage costs and display account balance for DSH web users. It can be installed in one command through the DSH CLI: users can run dsh plugin --profile web add followed by the local directory, compressed package, npm package name, or GitHub repository address. After installation, users need to restart the dsh web process and refresh their browser page to activate the plugin, which uses the existing DeepSeek API key saved in DSH's web model settings.

Once activated, dsh-billing adds two permanent capsules to the top of each conversation that show current account balance and total session cost, and clicking either capsule immediately refreshes both values. Hovering over a capsule opens a detailed breakdown: the balance capsule shows recharge, bonus, and USD amounts, while the cost capsule breaks down spending by model and token type. Users can also call slash commands /balance and /cost or ask the AI model directly to get detailed information via the built-in deepseek_billing tool.

dsh-billing is open source under the MIT license, and it uses an event-driven refresh logic that makes zero unnecessary network requests when the plugin is idle. It automatically pulls the latest DeepSeek official pricing every 12 hours, supports automatic peak/off-peak price switching, and lets users override default prices for any model directly in the plugin configuration. All calculated costs are estimates, and actual charges will match the official DeepSeek billing statement.

这是一款专门为 DeepSeek Harness 开发的原生计费插件,用于实时统计 DeepSeek API 会话消耗费用、查询账户可用余额,自带网页端 UI 悬浮显示功能。插件提供了多个使用入口,包括会话头部常驻显示的余额和本会话费用双胶囊,点击可立即刷新,鼠标悬停即可查看按模型拆分的明细,还支持斜杠命令 /balance 和 /cost,以及供模型直接调用的 deepseek_billing 工具。

该插件适合使用 DeepSeek Harness 网页端、需要实时掌握 API 消耗和账户余额情况的开发者和普通用户使用。典型使用流程中,用户安装并重启 DSH 网页端后,无需额外手动配置就能在每个会话顶部看到余额和当前会话费用,需要更新数据或查询明细时,可以点击胶囊手动刷新,或调用斜杠命令、直接提问模型获取完整的费用拆分统计信息。

dsh-billing 采用 MIT 许可证开源,完全免费使用,插件采用事件驱动刷新逻辑,空闲时不会发起额外请求,只有特定事件触发时才会拉取更新。插件会自动每 12 小时拉取 DeepSeek 官方最新定价,支持峰谷价自动切换和用户自定义定价覆盖,费用为估算值,实际扣费以 DeepSeek 官方账单为准。安装后需要重启 dsh web 并刷新浏览器页面才能生效。

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

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

READMEREADME

dsh-billing

DeepSeek Harness 插件:账户余额 + 会话费用(人民币),带 Web UI 悬浮显示。

功能

入口 用法 说明
UI 会话头部双胶囊 无需操作,常驻显示 余额 + 本会话费用 并排显示在会话标题旁;点击任一胶囊立即刷新两个
悬停明细 鼠标悬停 余额胶囊:充值/赠金/美元;费用胶囊:按模型的 token 与费用拆分
斜杠命令 /balance 聊天框输入 /balance 查询账户余额(人民币优先,附美元)
斜杠命令 /cost 聊天框输入 /cost 当前会话费用明细
工具 deepseek_billing 直接问模型"余额多少/花了多少钱" query = balance / cost / both

结构

  • host.js — 宿主插件:命令 + 工具 + /billing/{balance,cost} RPC 通道(供浏览器胶囊轮询)
  • client.js — 浏览器 bundle(__ModuleLoader__ 工厂格式,仅依赖平台共享的 react,无构建步骤)
    • conversation.session.header.actions 槽位(负数 order = 静态会话上下文)→ 余额 + 会话费用双胶囊
  • package.json — 声明 dsh.bundle(空 patch)+ dsh.client(web 平台)
  • cordis.patch.yml — 空层;本插件由 profile 的 cordis.patch.yml 插入行激活

安装(一条命令)

组合包自带激活层(cordis.patch.yml),安装后自动生效,无需手改任何配置:

# 从本地目录安装
dsh plugin --profile web add ./deepseek-billing

# 或从打包产物安装(跨机器分发推荐)
dsh plugin --profile web add ./dsh-billing-0.2.0.tgz

# 或从 npm / git 安装(发布后)
dsh plugin --profile web add dsh-billing
dsh plugin --profile web add github:you/dsh-billing

安装后重启 dsh web,再刷新浏览器页面(F5)使新 boot graph 生效。 宿主侧 API key 使用 DEEPSEEK_API_KEY 凭据引用(在 Web 模型设置页保存即可)。

配置(全部可选)

config.pricing 按模型覆盖单价(元/百万 tokens),支持峰谷价自动切换(见 host.js 顶部默认值)。例如:

config:
  pricing:
    deepseek-v4-pro:
      cacheHit: 0.025
      cacheMiss: 3
      output: 6
      schedules:
        - effectiveAt: '2026-08-17T00:00:00+08:00'
          timezoneOffsetMinutes: 480
          peakWindows: [[9, 12], [14, 18]]
          offPeak: { cacheHit: 0.15, cacheMiss: 4.5, output: 13.5 }
          peak: { cacheHit: 0.30, cacheMiss: 9.0, output: 27.0 }

更新频率(事件驱动,空闲零请求)

  • 轮次中:每完成 10 步刷新一次(步号跨过 10 的整数倍时触发)
  • 每轮结束(turn/end):刷新一次,结算本轮收尾的步(短轮也靠它结算)
  • 挂载 / 切换会话 / 点击胶囊 / 页面从后台切回可见:立即刷新
  • 空闲时零请求:没有定时轮询;只有上述事件发生时才有请求
  • 服务端按需从内存会话日志计算,无后台常驻任务

价格自动同步(官方改价怎么办)

计费口径

  • token 取自会话日志中 provider 上报的 usage(含缓存命中拆分;失败重试也计入)
  • 单价内置官方价格,2026-08-17 起自动按北京时间峰谷价
  • 子代理是独立会话,各自单独统计
  • 输出为估算值,实际扣费以 DeepSeek 官方账单为准

维护提示

  • 改 client.js 后:客户端 HMR 会自动更新,刷新页面必生效
  • 改 host.js 后:若热重载未生效(Node ESM 缓存),可改文件名/包名触发重导入,或重启 dsh web

官方文档:

← 上一个 Prev dsh-plugin-rollout-scout 下一个 Next dsh-notify-center →