DSH HUB
HomePlugin StoreRankingsPublish Guide
Plugin source
Back to catalog

TheTianzz /

dsh-billing

Verified

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

★ 7 Stars1 Forks0 IssuesN/A Community rating0 Confirmed installs
View on GitHubProject homepage
READMESource: main@af0a8e40

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):刷新一次,结算本轮收尾的步(短轮也靠它结算)
  • 挂载 / 切换会话 / 点击胶囊 / 页面从后台切回可见:立即刷新
  • 空闲时零请求:没有定时轮询;只有上述事件发生时才有请求
  • 服务端按需从内存会话日志计算,无后台常驻任务

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

  • 启动时 + 每 12 小时自动拉取官方价格页(https://api-docs.deepseek.com/zh-cn/quick_start/pricing/)解析最新单价(含峰谷价与生效时间)
  • 解析失败自动回退:上次成功在线值 → 内置默认值;费用输出会标注当前来源与同步时间
  • 优先级:用户显式配置 > 官方在线同步 > 内置默认(用户对某个模型写过 pricing 就永远以它为准)
  • 可在 config.priceSync 关闭或调整:{ enabled: true, url: "...", intervalMs: 43200000 }

计费口径

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

维护提示

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

官方文档:

  • 查询余额:https://api-docs.deepseek.com/zh-cn/api/get-user-balance/
  • 模型 & 价格:https://api-docs.deepseek.com/zh-cn/quick_start/pricing/
  • Harness 客户端模块:https://deepseek-harness.github.io/deepseek-harness/reference/subsystems/client-modules
DSH HUB

A community index for DSH plugins. Not an official GitHub or DeepSeek AI product.

APIPublish GuideAbout
—/ 5

No ratings yet

Verified DSH bundle

Commit af0a8e40dbe3

Community comments

No comments yet. Be the first to write one.