dsh-cost-chip
dsh profile plugin: /cost — cumulative token usage and estimated monetary cost for the current session, plus a floating web UI cost chip (peak/off-peak time-of-day pricing)
安装
此插件尚未提供可验证的 bundle,或兼容性检查未通过。请先阅读仓库说明。 阅读完整 README ↗
说明文档
阅读完整 README ↗dsh-cost-chip
dsh profile 插件:注册 /cost 斜杠命令,显示当前会话的模型、累计 token 消耗、
当前计费时段(🔴 高峰 / 🟢 空闲)与估算费用。
行为
在 Web UI(或任何组合了 @deepseek-ai/dsh-commands 的交互界面)中输入 /cost,直接返回类似:
Session token usage & estimated cost
model: deepseek-official · deepseek-v4-pro
period: 🟢 空闲时段 · 北京时间 02:38 · 现行价:原价(分时价自 2026-08-17T00:00:00+08:00 起生效)
prices: deepseek-v4-pro
原价: input 3 / cache-read 0.025 / output 6 (cache-write = input 3) ¥/1M
高峰价: input 9 / cache-read 0.3 / output 27 (cache-write = input 9) ¥/1M
空闲价: input 4.5 / cache-read 0.15 / output 13.5 (cache-write = input 4.5) ¥/1M
input (uncached) 6,000,000 tok
cache read 4,000,000 tok
cache write 0 tok
output 600,000 tok
------------------------------------------------
total 10,600,000 tok ¥45.1500
cost by tier:
原价 1,100,000 tok ¥3.6000
高峰价 2,200,000 tok ¥23.4000
空闲价 7,300,000 tok ¥18.1500
要点:
- 模型:来自接收命令的 agent 的
options.provider/options.model。 - 时段徽章:🔴 高峰时段 / 🟢 空闲时段,按北京时间实时计算。
- 分时计费:会话日志的每个事件都带 Unix
time,因此每笔用量按它发生时刻 的档位计费(原价 / 高峰价 / 空闲价),而不是全部按"现在"计价;跨档位的会话会分行展示。 - 生效日期:
peakEffectiveAt(默认2026-08-17T00:00:00+08:00)之前一律原价; 之后按发生时刻的高峰/空闲档计价。 - 数据来源:优先直接折叠
session.events(与dsh-token-meter的tokenUsage投影完全相同的(turn, step)去重规则);日志无用量时回退到投影快照(聚合值,按当前档位计价)。 - 命令不接受参数;执行不进模型历史、不消耗 token。
cache-write默认按该档位的 input 价格计费(DeepSeek 惯例),可在每行显式覆盖。
内置价目表(人民币 / 百万 tokens)
| 模型 | 档位 | 输入(缓存命中) | 输入(未命中) | 输出 |
|---|---|---|---|---|
| deepseek-v4-flash | 原价 | 0.02 | 1.00 | 2.00 |
| deepseek-v4-flash | 高峰价 | 0.10 | 3.00 | 9.00 |
