eurt-nano/dsh-cache-cost-monitor ↗★ 1
dsh-cache-cost-monitor
DSH (DeepSeek Harness) v0.1.x Cordis 插件:自动监听每轮模型 API 调用的缓存命中/未命中/输出 tokens,实时统计缓存命中率与按官方定价(含峰谷时段)预估的 API 费用,注册 cache_report 工具,并在浏览器每条消息末尾低调显示本轮 tokens 与人民币消耗。 适合需要精细化监控DeepSeek API调用成本和缓存效率的用户。
インストール
$
npx -p @deepseek-ai/dsh dsh plugin --profile web add github:eurt-nano/dsh-cache-cost-monitorドキュメント
README 全文を読む ↗🎮 使用
- 召唤报表:对 Agent 说「调用 cache_report」,或让它「看看缓存命中率和花了多少钱」。
可选参数:
{ "detail": true, "limit": 10 }输出逐轮明细(含计价档位、实际单价、时间戳)。 - 看常驻统计条:输入框下方实时累计消耗,无需任何操作。
- 看页脚:每条助手回复末尾的灰字小标。
- 看日志:
[cache-monitor]前缀的 warn/info 输出告警与启动信息。
⚙️ 配置参考(cordis.patch.yml)
| 字段 | 默认 | 说明 |
|---|---|---|
threshold | 0.3 | 单轮缓存命中率告警阈值(0~1) |
cumulativeThreshold | 0.3 | 累计命中率告警阈值(0~1),状态翻转时提示一次 |
historySize | 20 | 趋势窗口轮数(>= 2) |
warnOnMissingUsage | true | 响应缺 usage 字段时是否输出 debug 日志 |
timeBilling | auto | 峰谷计价:auto(高峰 UTC 00:30–16:30)/ peak / off-peak |
currency | both | 费用显示:USD / CNY / both |
usdCnyRate | 6.8 | 美元→人民币汇率 |
budgetUsd | 未设置 | 累计费用预算(USD):超出后 warn 告警并在报表标注 ⚠️ |
pricing | 官方定价 | 按模型 ID 的定价表(USD / 每百万 tokens) |
内置定价(cacheHit / cacheMiss / output):
| 模型 | OFF-PEAK | PEAK |
|---|---|---|
| deepseek-v4-flash | 0.007 / 0.22 / 0.66 | 0.014 / 0.44 / 1.32 |
| deepseek-v4-pro | 0.022 / 0.66 / 1.98 | 0.044 / 1.32 / 3.96 |
| deepseek-chat | 0.028 / 0.28 / 0.42 | — |
| deepseek-reasoner | 0.14 / 0.55 / 2.19 | — |
未配置的模型按 0 计费并在报表中标注;deepseek-v4-* 变体按前缀回退。