dsh-routing-forensics
IdentifiedForensic analysis of past model-routing decisions. Replays each session, classifies every turn's task complexity from its request shape (deterministic, no LLM), and reports two kinds of waste: an expe
dsh-routing-forensics — 模型路由浪费取证(DSH 插件)
每次模型调用都是一次路由决定。用贵模型改错别字,是浪费;用便宜模型写引擎,失败重试后更贵。 这个插件回放会话日志,把过去的每一次路由决定摊开算账。
安装
dsh plugin --profile desktop add @bushizhanghan/dsh-routing-forensics
重启 DSH 后生效。只读:从不修改会话日志。
Agent 工具
| 工具 | 作用 |
|---|---|
routing_audit | 审计单个会话:回放每轮,按任务复杂度分档,找过配/欠配 |
routing_sweep | 扫描全部会话,按浪费金额排序 |
routing_rules | 从证据产出可执行的路由规则 |
怎么判断复杂度(确定性,不调 LLM)
按请求形状打分,分数决定档位:
| 信号 | 权重 |
|---|---|
| 请求长度 >2000 / >400 / >60 字符 | +3 / +2 / +1 |
| 工具调用 ≥8 / ≥3 / ≥1 | +3 / +2 / +1 |
| 有文件写入 | +2 |
| 重试 ≥3 次 / 有重试 | +6 / +2 |
| 上下文峰值 >100k / >20k | +5 / +1 |
| 分数 | 档位 | 建议模型层 |
|---|---|---|
| 0 | trivial | cheap |
| 1-3 | simple | cheap |
| 4-5 | standard | standard |
| ≥6 | complex | premium |
上下文权重刻意压得很重:一个人只打了「继续」但带着 300k 上下文,那是真在干活,不是琐事。
两类浪费
| 规则 | 级别 | 抓什么 |
|---|---|---|
over-provision | ! warn | 便宜活用了贵模型——差额是可计算的浪费 |
under-provision-retried | ✗ error | 贵活用便宜模型且失败了(非容量类错误)——每次重试重发整个上下文,比直接升级更贵 |
under-provision-capacity-retry | · info | 便宜活干重活但失败原因是限流/超时——不是模型能力问题,换个更好的模型也会撞同一堵墙 |
这个区分很重要:把 RATE_LIMIT 算成"模型不行"会让工具天天喊狼来了。
设计取舍
- 参考价取该档第一个声明的模型,不是全局最便宜。按 input+output 之和挑"最便宜"在混合定价下是错的:glm (0.1/0.3) 之和低于 deepseek (0.14/0.28),但输出密集时 glm 更贵、输入密集时 deepseek 更贵。
- 金额是估算,不是账单。内置价目表按公开标价,明确标注
estimateNotice;不在表里的模型只计数不定价(unpricedSessions),不猜。 SERVER不算容量限制。它太泛,常常就是模型自己的失败;当成容量会让误路由藏在借口后面。只有RATE_LIMIT/TIMEOUT/TRANSPORT算。- 确定性:复杂度分级、浪费计算、规则推导全是纯函数,同一份日志永远同一结论。
开发
node --test test/ # 33 个单测 + 15 项集成测试
测试用真机上的会话日志做 fixture。
License
MIT
Comments
Loading…
Similar plugins
Flash-only reasoning-effort routing for DeepSeek Harness, setting the DeepSeek flash model reasoning effort per step. The model never changes; effort max is opt-in.
★ 0
dsh plugin --profile web add dsh-model-router-enRule-based multi-provider model routing for DeepSeek Harness with pre-first-token failover, cooldown circuit-breaking, usage accounting, and a status API.
★ 0
dsh plugin --profile web add @botton/dsh-model-routerby zhangzhangco
Automatic tier-based model routing for DeepSeek Harness (dsh): a virtual `smart` model classifies every request by difficulty (hard / normal / easy) and by vision need, then delegates it to the models you already configured.
★ 0
NOASSERTION
JavaScript
Sep 22, 2026
dsh plugin --profile web add dsh-tier-routerby wanghaixu-hai
DSH 模型分流插件:按每一轮请求的难度自动选模型与思考强度——简单问题走便宜快模型,难题才叫强模型。零 token 规则判定,只在判不准的灰区问一次小模型。发送前把本轮计划同步到输入框的模型框,座位=实际;不改你的默认模型。
★ 0
MIT
JavaScript
Sep 10, 2026
dsh plugin --profile web add dsh-effort-routerAutomatic model-tier routing for DeepSeek Harness: one user instruction enters, one tier decision comes out — complex intent is planned on the strong tier and implemented on the cheap tier, simple int
★ 1
↓ 829/wk
Apache-2.0
TypeScript
dsh plugin --profile web add dsh-autotierUnified model routing for DeepSeek Harness: one logical ModelID over multiple providers with first-token failover and cooldown, health-aware candidate ranking, three tiers (tier1/tier2/tier3) auto-sel
★ 0
↓ 384/wk
dsh plugin --profile web add @welsione/dsh-model-router