eurt-nano/dsh-cache-cost-monitor ↗★ 1

dsh-cache-cost-monitor

实时统计API缓存命中率与预估费用 适合需要精细化监控DeepSeek API调用成本和缓存效率的用户。

套件
dsh-cache-cost-monitor
相容性
待驗證
Harness 依賴範圍
^0.1.0-rc.6
Cordis 依賴範圍
^4.0.1
版本
0.3.1
授權
MIT
最近更新
2026年8月27日

安裝

$npx -p @deepseek-ai/dsh dsh plugin --profile web add github:eurt-nano/dsh-cache-cost-monitor

🎮 使用

  1. 召唤报表:对 Agent 说「调用 cache_report」,或让它「看看缓存命中率和花了多少钱」。 可选参数:{ "detail": true, "limit": 10 } 输出逐轮明细(含计价档位、实际单价、时间戳)。
  2. 看常驻统计条:输入框下方实时累计消耗,无需任何操作。
  3. 看页脚:每条助手回复末尾的灰字小标。
  4. 看日志:[cache-monitor] 前缀的 warn/info 输出告警与启动信息。

⚙️ 配置参考(cordis.patch.yml)

字段默认说明
threshold0.3单轮缓存命中率告警阈值(0~1)
cumulativeThreshold0.3累计命中率告警阈值(0~1),状态翻转时提示一次
historySize20趋势窗口轮数(>= 2)
warnOnMissingUsagetrue响应缺 usage 字段时是否输出 debug 日志
timeBillingauto峰谷计价:auto(高峰 UTC 00:30–16:30)/ peak / off-peak
currencyboth费用显示:USD / CNY / both
usdCnyRate6.8美元→人民币汇率
budgetUsd未设置累计费用预算(USD):超出后 warn 告警并在报表标注 ⚠️
pricing官方定价按模型 ID 的定价表(USD / 每百万 tokens)

内置定价(cacheHit / cacheMiss / output):

模型OFF-PEAKPEAK
deepseek-v4-flash0.007 / 0.22 / 0.660.014 / 0.44 / 1.32
deepseek-v4-pro0.022 / 0.66 / 1.980.044 / 1.32 / 3.96
deepseek-chat0.028 / 0.28 / 0.42—
deepseek-reasoner0.14 / 0.55 / 2.19—

未配置的模型按 0 计费并在报表中标注;deepseek-v4-* 变体按前缀回退。