DSH Plugin Store
Back to home

TheTianzz

dsh-billing

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

Stars
1
Language
JavaScript
Created
Aug 14, 2026
Updated
Aug 14, 2026
Other
GitHub repoHomepage

Introduction

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

官方文档: