DeepSeek Harness Hub
← 返回列表

yishan/dsh-burn

DeepSeek Harnessspec-screened在 GitHub 查看 ↗
未验证

DeepSeek Harness Web UI 的 token 花费、峰谷计价与账户余额插件。

尚未跑自动兼容性验证,可查看页面内的依赖与入口分析。 · 最近上游提交 2026/9/3 · 已提供中文文档

DeepSeek Harness Web UI 的每会话 token 消耗、高峰/非高峰定价以及账户余额。

综合分
28.4
GitHub 分
28.4
用户评分
★ Stars
0
周下载量
安装插件(需先安装 dsh CLI 引擎:npm install -g @deepseek-ai/dsh)
dsh plugin --profile web add yishan/dsh-burn
该插件未发布到 npm,走 GitHub 源安装(pnpm 若拦截 prepare 脚本,按其提示在 pnpm-workspace.yaml 的 allowBuilds 中放行后重跑)
数据截至 2026/9/18(元数据每日更新 · 实装验证按队列轮转,单条结论的验证时间见上方)
依赖的 DSH / Cordis 模块
@deepseek-ai/schemastery@deepseek-ai/cordis@deepseek-ai/dsh-client-runtime@deepseek-ai/dsh-client-ui-conversation@deepseek-ai/dsh-client-ui-primitives@deepseek-ai/dsh-client-ui-settings@deepseek-ai/dsh-client-ui-slots@deepseek-ai/dsh-client-web-react@deepseek-ai/dsh-credentials@deepseek-ai/dsh-host-webserver@deepseek-ai/dsh-llm@deepseek-ai/dsh-session
用户评分
还没有人投票,来当第一个
订阅周报,不错过优质插件更新
每周一封 · 高评分插件 + 新用户活动

README

dsh-burn

DeepSeek Harness Web UI 的 token 花费、峰谷计价与账户余额插件。

English

dsh-burn

功能

- 悬停查看每条回复消耗——已完成的模型回复在操作区(复制/点赞/分享)显示 ↑输入 · ↓输出 ¥花费,按该回复自身生成时间所在计费档位与当前价格簿计价。
- 会话标题栏显示累计花费与账户余额——累计 ¥xx · 余额 ¥xx 位于标题栏 Standard mode 徽章右侧。累计金额从会话快照实时 fold(回复一落地即更新,历史金额不随当前时刻漂移);余额轮询 DeepSeek /user/balance API(宿主侧缓存 60 秒)。
- 设置面板(费用)——编辑各模型价格、选择计价档位(自动/高峰/空闲/均值)、一键载入 DeepSeek 官方价格、自定义峰谷时段。切换档位即时生效。

计价遵循 DeepSeek 计费规则:每条回复按其生成时刻所在档位计费——工作日高峰为北京时间 09:00–12:00 与 14:00–18:00,其余为空闲(半价);周末全天空闲价(2026-08-23 规则)。auto(默认)与 average 都按实际逐条档位计价(即时间加权均值);peak / offPeak 可固定查看单档价格。时段可自定义。价格默认使用内置官方表,零配置即可用。

兼容性

在 package.json 中声明(engines 与 dsh.compatibility.dshReleases),DSH STORE 固定源策略扫描会在每次固定 Commit 时复检:

| 目标 | 声明范围 | 证据 |
| --- | --- | --- |
| Node.js | ^22.19.0 \|\| >=24.0.0(engines) | Node 22.22.2(macOS arm64)实测 |
| DSH 发行版 | 0.1.1-rc.2: compatible(dshReleases 矩阵) | 一次性 Profile 安装 + 卸载、真实 web profile 启动且两个插件端点均 HTTP 200(见 COMPATIBILITY.md) |

peer 依赖下限为 DeepSeek Harness 0.1.0-rc.7 契约族;其他 DSH 发行线仅在逐版本实测后补充声明。DSH STORE 目录会另行维护独立的 install/start/uninstall 证据状态(verified / partial / unknown)——本矩阵属源码声明,不能替代该运行时证据。

安装

本插件是 bundle 形态:dsh plugin add 自动挂载(manifest 的 dsh.bundle.patch 会被自动应用),无需手动改 patch。

从 GitHub 安装

dsh plugin --profile web add github:yishan/dsh-burn
dsh web   # 重启 web 服务使 profile 生效

从 npm 安装(发布后)

dsh plugin --profile web add dsh-burn
dsh web

从本地目录安装

dsh plugin --profile web add /path/to/dsh-burn
dsh web

卸载

dsh plugin --profile web remove dsh-burn
dsh web

配置

默认零配置:启动时自动回填内置官方价格表(deepseek-v4-flash / deepseek-v4-pro),一切可在 设置 → 费用 中实时编辑(持久化到按 profile 隔离的设置文件——/plugins/dsh-burn/settings.json,由 Loader 的 baseUrl 推导——重启后覆盖 profile 配置)。旧全局 $DSH_HOME/plugins/dsh-burn/settings.json 会在首次启动时迁移一次;也可在 profile patch 里用 settingsPath 显式指定位置。

余额显示需要从 DEEPSEEK_API_KEY 解析出 DeepSeek API key。

高级:用 profile patch 覆盖

在 profile patch 中以 id: dsh-burn 为目标,可覆盖 bundle 行的配置(价格、计价档位、峰谷时段、余额接口):

$DSH_HOME/profiles/web/cordis.patch.yml
- id: dsh-burn
config:
displayMode: auto          # auto | peak | offPeak | average
tierSchedule: default      # default | custom
customWindows: []          # [{ start: 540, end: 720, tier: 'peak' }, ...]
defaultTier: offPeak       # 未被 customWindows 覆盖的分钟使用的档位
prices:
deepseek-v4-flash:
peak:    { input: 3.0, cacheRead: 0.1,  cacheWrite: 3.0, output: 9.0 }
offPeak: { input: 1.5, cacheRead: 0.05, cacheWrite: 1.5, output: 4.5 }
deepseek-v4-pro:
peak:    { input: 9.0, cacheRead: 0.3,  cacheWrite: 9.0, output: 27.0 }
offPeak: { input: 4.5, cacheRead: 0.15, cacheWrite: 4.5, output: 13.5 }
defaultPrice:
peak:    { input: 3.0, cacheRead: 0.1,  cacheWrite: 3.0, output: 9.0 }
offPeak: { input: 1.5, cacheRead: 0.05, cacheWrite: 1.5, output: 4.5 }
apiKeyEnv: DEEPSEEK_API_KEY   # 余额接口的凭证引用
balanceRefreshMs: 60000
balanceBaseURL: 'https://api.deepseek.com'
settingsPath: /abs/path/to/settings.json   # 可选:覆盖 profile 隔离的默认位置

价格为每百万 token 的人民币单价。不单独计费 cache 写入的提供方,cacheWrite 按未缓存输入价填写。

工作原理

- 宿主(src/index.ts、src/projection.ts):CostMeter 服务把会话日志 fold 成按模型、按计费档位的 token 分桶(cost 会话投影——每条消息按其自身时间戳所在档位入桶),提供 GET/POST /api/cost/settings,并通过凭证 seam 代理 GET /api/cost/balance(无 key 返回 401、上游失败 502、60 秒缓存 + 并发去重)。投影的 totalCost 在读取时用当前价格簿 × 当前档位实时计算,价格/档位变更对整段历史即时生效,无需重放。
- 客户端(src/client/):三个插槽席位——conversation.session.header.actions(累计花费 + 余额,位于标题栏代理预设标签右侧)、conversation.chat.assistant-actions(单条消耗,按该条自身时间计价)、settings.section(费用页)。token 分桶在渲染时按当前价格簿重新计价,因此档位/价格变更即时生效,无需重启。会话折叠是增量的(追加 O(Δ)、单条 O(1) 索引查找)。
- 运行时设置持久化到按 profile 隔离的设置文件(见「配置」),启动时覆盖 profile 配置;价格簿中缺失的模型会从官方价格表自动回填。POST /api/cost/settings 会拒绝未知 key、非法值、重叠时段(400)与超大 body(413),并在 persisted 字段上报磁盘写入结果,UI 据此提示保存失败。

开发

pnpm install
pnpm run typecheck   # tsc --noEmit
pnpm run test        # vitest(计价逻辑)
pnpm run build       # esbuild:lib/index.js(宿主)+ lib/client.js(浏览器)

客户端 bundle 是注册在 window.__ModuleLoader__ 上的 classic-script 插件,只能 import 平台模块表(见 build.mjs)。

权限、依赖与失败边界

插件运行在两处:宿主 bundle(服务端,DSH 进程内)与 web 客户端(浏览器,DSH Web UI 内)。能力面刻意收窄。

- 文件 —— 宿主只读/写自己的设置文件(/plugins/dsh-burn/settings.json,由 Loader baseUrl 推导),并一次性迁移读取旧全局 $DSH_HOME/plugins/dsh-burn/settings.json。不扫描目录、不触碰其他路径(settingsPath 配置可重定向这一份文件)。客户端不使用任何浏览器存储。
- 网络 —— 源码树中唯一的绝对外呼 URL 是余额端点(默认 https://api.deepseek.com/user/balance,可用 balanceBaseURL 覆盖),通过 DSH 凭证 seam 解析出的 Bearer key 调用。客户端全部流量均为同源(/api/cost/settings、/api/cost/balance)。无其他主机、无遥测。
- 命令 —— 无。src/ 全树不存在 child_process、shell 或操作系统命令执行。
- 凭证 —— 仅通过官方凭证服务解析一个凭证引用(默认 DEEPSEEK_API_KEY),只用作余额调用的 Bearer;插件不记录、不持久化该密钥。
- 运行依赖 —— 宿主服务仅使用宿主提供的 @deepseek-ai/* 服务(peer 范围 ^0.1.0-rc.7)加 @deepseek-ai/schemastery 做配置;运行依赖在构建期打入 lib/。无安装期生命周期脚本(preinstall/install/postinstall/prepare)——npm scripts 只有 build、typecheck、test、prepublishOnly。
- HTTP 与投影面 —— 在 profile 的 web server 上注册 GET/POST /api/cost/settings、GET /api/cost/balance,外加一个 cost 会话投影;仅在对应宿主子组件存在时挂载。
- 失败边界 —— 部分组装降级而非崩溃:无 web server(headless)时跳过 HTTP 路由;缺凭证时余额端点返回 401 {no_api_key};上游失败返回 502;设置 POST 对未知 key、非法值、重叠时段返回 400,超大 body 返回 413(1 MiB 上限),磁盘写失败在 persisted 字段上报;设置文件缺失/损坏时回退到 profile 配置并在下次成功保存时自愈。价格/档位变更无需重启即可对整段会话历史实时重新计价。

安全态势总览与漏洞上报路径见 SECURITY.md。需注意:即便有本源码级声明,商城侧仍可能要求 user-reviewed 或 blocked 状态;该声明本身不代表自动批准。

许可证

MIT

上游仓库有新提交时邮件通知你(每天最多一封,无更新不打扰),随时一键退订。

💬 加入 DPharness 群聊

插件用法、部署报错、新插件第一时间同步——群里问,比一个人翻文档快。

点击加入 QQ 群
DPharness 群聊二维码,手机 QQ 扫码进群
扫码进群