yyy-yq1/dsh-plugin-token-governor ↗★ 1
dsh-plugin-token-governor
给 DeepSeek Harness 装一只账单仪表盘与省钱引擎:真实 ¥ 计费(命中/未命中/输出、峰谷)、缓存前缀哨兵与自动回滚、工具输出无损压缩、换会话省钱(−94%/请求)。
Install
$
npx -p @deepseek-ai/dsh dsh plugin --profile web add github:yyy-yq1/dsh-plugin-token-governorREADME
Read the full README ↗配置速查
只改你需要的;其余留默认。完整注释见 cordis.patch.yml。
- id: token-governor
config:
currency: CNY # CNY | USD(官方两套价,不是汇率)
modelPrices: {} # 自定义模型价:{ "": { hit, miss, out } }
effortPolicy:
enabled: false # 实测≈不省,A/B 过再开
continuationEffort: high
switchGuard: { autoRollback: true, maxContextTokens: 250000 }
contextAdvice: { minContextTokens: 150000 } # 超过就建议换新会话
toolOutput: { compressEnabled: true, nearDedupeEnabled: true, dedupeEnabled: true }
tsvCodec: { enabled: true, minSavingRatio: 0.3 } # 无损重编码
readReuse: { enabled: true }
compressionBudget: { aggressiveAboveTokens: 4000, aggressiveTargetRatio: 0.35 }
newSession: { enabled: true, model: deepseek-flash }
apiPath: /token-governor
priceStaleDays: 90 # 价格表过期告警