dsh-session-cost
by Lzh3070
DeepSeek Harness(dsh)Web 界面的 会话花费插件 :把当前会话的 DeepSeek API 累计花费显示为输入框旁的一个小徽标。
Composer cost chip: prices the current session DeepSeek API spend message-by-message with the official pricing table (incl. the 2026-08-17 peak/off-peak policy); hover for the breakdown, today (DSH) total and account balance. DeepSeek models only.
安装
dsh plugin --profile web add github:Lzh3070/dsh-session-costGitHub 源码安装:首次需按提示配置 allowBuilds 构建授权后重试
安装与环境配置指引、插件开发教程见 DSH 中文社区文档 ↗
安装即在你的机器上以你的权限运行第三方代码——它可读写文件、使用凭据、访问网络,DSH 的工具审批不会为插件代码加沙箱。「检测到 manifest」仅代表发现 dsh.bundle / dsh.plugin 清单,不构成兼容性或安全审查;安装前请审阅源码,不熟悉的插件先在不含密钥的环境试用。
README
English | 中文
dsh-session-cost
DeepSeek Harness(dsh)Web 界面的会话花费插件:把当前会话的 DeepSeek API 累计花费显示为输入框旁的一个小徽标。
特性
- 输入框实时花费:在
conversation.input.right槽位(模型选择器左侧)显示当前会话的 DeepSeek API 花费(¥),每 5 秒刷新。 - 严格模型门槛:仅当会话当前模型为 DeepSeek 时生效;使用其他模型(MiniMax、Kimi 等)时徽标自动隐藏,且非 DeepSeek 模型的请求完全不计价、不进入统计。
- 悬停浮窗:弹出与项目风格一致的浮窗,展示:
- 会话花费明细表格:输入(未命中) / 缓存命中 / 输出 × 数量 × 有效单价 = 金额;
- 今日(DSH) 用量:本机 DSH 会话今日(北京时间)消耗的 DeepSeek 花费;
- 账户余额:读 DSH 凭证中的
DEEPSEEK_API_KEY,经 DeepSeek 官方user/balance接口获取。
- 官方计价引擎:按 DeepSeek 官方价格时间表对每条
assistant/message消息按其发生时刻逐条计价,自动应用 2026-08-17 起的高峰/空闲定价(北京时间 09:00–12:00 / 14:00–18:00 为高峰,其余时段半价),并包含插件安装之前的历史。 - 性能友好:会话日志按 revision 缓存(5 秒轮询 = 一次 stat 比对,不重复解压解析);今日/余额独立 60 秒节奏。
安装
⚠️ 注意:npm 上的
dsh-session-cost(0.1.3)是另一个同名插件(ChengChe106/dsh-session-cost),与本仓库无关。请务必用下面的仓库地址安装本插件。
dsh plugin --profile web add github:Lzh3070/dsh-session-cost
国内网络可走 Gitee 镜像:
dsh plugin --profile web add https://gitee.com/lzh10602042_gitee/dsh-session-cost/repository/archive/main.zip
装完重启 dsh web 服务,浏览器硬刷新(Ctrl+Shift+R)。
首次使用:设置 → 模型 中需配置 DEEPSEEK_API_KEY(余额与今日统计读取该凭证;未配置时余额显示 --,会话花费不受影响)。
界面
输入框右侧的小徽标(¥0.12),悬停弹出浮窗:

浮窗内容示例:
当前会话花费 ¥6.55
项目 数量 单价 金额
输入(未命中) 3.5M ¥1.000/M ¥3.49
缓存命中 111.8M ¥0.020/M ¥2.24
输出 410.5K ¥2.00/M ¥0.821
──────────────────────────────
今日(DSH) ¥0.356
账户余额 ¥197.66
价格说明
内置 DeepSeek 官方政策时间表(元 / 百万 tokens):
| 模型 | 阶段 | 输入(未命中) | 缓存命中 | 输出 |
|---|---|---|---|---|
| deepseek-v4-flash | 当前价(2026-05-22 起) | 1 | 0.02 | 2 |
| deepseek-v4-flash | 2026-08-17 起·高峰 | 3 | 0.1 | 9 |
| deepseek-v4-flash | 2026-08-17 起·空闲 | 1.5 | 0.05 | 4.5 |
| deepseek-v4-pro | 当前价(2026-05-22 起) | 3 | 0.025 | 6 |
| deepseek-v4-pro | 2026-08-17 起·高峰 | 9 | 0.3 | 27 |
| deepseek-v4-pro | 2026-08-17 起·空闲 | 4.5 | 0.15 | 13.5 |
价格表位于 lib/index.js 的 OFFICIAL_PRICING_POLICIES,官方调价时按 since 时间轴追加条目即可。
结构
cordis.patch.yml inserts the plugin row into the host composition
dsh.plugin.json plugin metadata (entry id + client platform)
lib/index.js host entry: SessionCostRuntime (TypertRemoteService) +
official pricing engine + strict Typert manifest
lib/client.js single-file client bundle (ModuleLoader handshake):
composer cost chip + hover popover (class component)
lib/invariant.js invariants companion entry
数据流
- 宿主
sessionCost(sessionId):经sessionPersistence.readRaw回放会话日志,逐条计价,按日志 revision 缓存。 - 宿主
accountSummary():回放全部会话统计今日(北京时间)DeepSeek 用量;凭证DEEPSEEK_API_KEY→ 官方user/balance取余额。 - 客户端:
conversation.input.right槽位注册,5s 轮询 + 60s 账户节奏 + 悬停浮窗。
许可
MIT。计价引擎移植自 dsh-deepseek-quota(MIT,其本身移植自 bpc-oss/dsh-web-billing MIT)。
原始 README: https://github.com/Lzh3070/dsh-session-cost/blob/master/README.md ↗
同类插件
查看全部 →
archify
Agent 技能:生成美观、可校验的架构图、工作流图、时序图、数据流图与生命周期图——自包含 HTML、带动画与清晰导出

dsh-turn-rewind
对话回退:基于持久 Change Ledger 回滚会话与工作区状态。

dsh-plugin-cc
把 DeepSeek Harness 接入 Claude Code:评审、批评、委派与会话导入

dsh-interconnect
跨实例互联:经 interconnect 服务在多个 DSH 实例间转发消息与事件。

dsh-chat-import
把 13 家 coding agent(Claude Code、Codex、ChatGPT、Cursor、Gemini、opencode 等)的完整对话历史导入为可续聊的 DeepSeek Harness 会话,并支持反向导出回 Claude Code。

dsh-crew
DSH 插件:从 Claude Code / Codex 向 DSH agent 派活——原生 subagent 进度、宿主内 worker 会话(分级预设),以及为纯文本宿主补上视觉与图像生成的多模态桥