- Accueil
- Plugins
- Utilisation et facturation
- dsh-session-cost-fan
dsh-session-cost-fan
number-10/dsh-session-cost-fan
Prices each Session's provider-reported token usage in CNY and shows the running cost under the composer and beside every Session in the sidebar, with a token breakdown on hover.
Installer
dsh plugin --profile web add github:number-10/dsh-session-cost-fanREADME
dsh-session-cost-fan
DeepSeek Harness 插件:读取每个会话累计的 token 用量,按单价折算成元,显示在输入框底部统计行与侧边栏对应会话上。
安装
dsh plugin add github:number-10/dsh-session-cost-fan
(也可以把本目录作为本地 bundle 装进 profile:Plugin Manager → 添加插件 → 选择目录。)
显示位置
- 输入框底部统计行:和「轮/步 · tok/s · tok · 缓存命中」并在同一行,右侧显示当前会话的实时花费(
¥3.79),随每条已落定的模型回复刷新;悬停可看完整一句话说明。 - 侧边栏每个会话行的时间右侧:
¥1.73这样的小字(悬停该行时这一条会隐藏,属于侧边栏行本身的行为)。金额固定两位小数;不足一分的会话显示<¥0.01,避免行宽忽长忽短。 - 悬停会话弹出的卡片里:精确到 6 位小数的花费 + 总 token,再下面是未命中输入 / 缓存命中 / 缓存写入 / 输出 四个非零桶,以及计价用的模型(跨模型会话写“按 A 等 N 个模型计价”,用了默认价的模型会单独点名)。
用量从哪来
把会话日志里 provider 上报的 usage 折叠进一个 Host 侧的 sessionCost 投影单元(ctx.sessionProjections):
assistant/message与assistant/attempt都算;同一步骤后一次上报替换前一次,llm/retry-started之后的重新尝试在失败尝试之上累加(与dsh-token-meter的tokenUsage口径一致)。- 缓存未命中输入、缓存命中输入、缓存写入、输出四个桶分别计价;缓存写没有单独官方价,按「缓存未命中输入价」计。
- 每条 usage 按它自己发生时刻的时段和它自己的模型计价,因此跨模型、跨高峰/空闲的会话不会被一个总价糊过去。
价格配置
单价是 元 / 百万 tokens。插件包自带的 cordis.patch.yml 里已写好默认价;要改价,请在 profile 的 cordis.patch.yml(%USERPROFILE%\.dsh\profiles\<profile>\cordis.patch.yml)里加同 id 的覆盖块——profile 层优先,且不会被重装插件覆盖:
- id: session-cost-fan
name: 'dsh-session-cost-fan'
config:
currency: CNY
symbol: '¥'
offPeakRatio: 0.5 # 空闲时段 = 高峰价 × 该系数
models:
deepseek-flash: { cacheHit: 0.04, cacheMiss: 2, cacheWrite: 2, output: 8 }
deepseek-v4-pro: { cacheHit: 0.3, cacheMiss: 9, cacheWrite: 9, output: 27 }
fallback: { cacheHit: 0.04, cacheMiss: 2, cacheWrite: 2, output: 8 }
覆盖块会整份替换 config,缺的键按内置默认值补齐,所以只写想改的部分即可。默认值取 DeepSeek 官方价目表的高峰时段价(2026-11 口径):deepseek-flash 缓存命中 0.04 / 未命中 2 / 输出 8,deepseek-v4-pro 0.30 / 9 / 27(元/百万 tokens)。改价后重启 DSH 生效。
高峰 / 空闲
按官方规则,北京时间周一至周五(不含法定节假日)9:00–12:00、14:00–18:00 为高峰,其余时段为空闲,空闲价是高峰价的一半。插件按事件发生时刻判断;中国法定节假日没有内置日历,节假日的工作日会按高峰计价(偏高)。
已知限制
- 金额只在 Host 侧计算并随投影缓存下发;安装前就存在的会话,其持久化投影缓存里还没有
sessionCost行,因此要等该会话被打开或再次产生事件后才显示金额。 - 单价是插件配置里的静态表,不随官方调价自动更新。
- 子代理会话同样是独立会话,各自计价。
Plugins associés
DeepSeek-Balance-Whale-Widget
meteornox/deepseek-balance-whale-widget
dsh-context
bowenliang123/dsh-context
dsh-cost-meter
han-1413141/dsh-cost-meter
dsh-damage-pulse
wssfk12138/dsh-damage-pulse