dsh-model-router
已验证@incrhst/dsh-model-router · v0.1.2 · MIT · Web 界面
Routes each DSH agent request to the least powerful model that can handle it — flash for simple work, pro for complex, vision for images — with a settings page and live composer readout.
安装
dsh plugin add @incrhst/dsh-model-router 用 dsh --profile default --dump-config 确认 layer 已生效 —— 参见安装指南。
源码
标签
作者
说明文档
@incrhst/dsh-model-router
Route each DeepSeek Harness agent request to the least powerful model that can handle the task, so simple work never pays for a more capable model than it needs.
What it does
Every agent agent/request is scored on cheap signals (conversation size,
tool-call count, code fences, and hard-task keywords), then routed:
| Signal | Model |
|---|---|
| Images present in the conversation | deepseek-v4-flash-vision-exp (text-only models reject images) |
| Complexity score ≥ threshold | deepseek-v4-pro |
| Otherwise | deepseek-v4-flash |
It also adds a Settings → "Model Router" page and a one-line
Router: flash → pro · score 3 readout under the composer.
Install
dsh plugin --profile web add -w @incrhst/dsh-model-router
dsh web
The -w flag is required: dsh plugin add forwards to pnpm add, and the
profile directory is a pnpm workspace root, so pnpm refuses to add to it
without --workspace-root.
The package declares dsh.bundle, so dsh plugin add reconciles it into the
profile's bundle stack automatically — no manual patch editing.
Configuration
Config lives in the durable model-router settings namespace (schema defaults
shown). Edit it in the Settings UI, or in $DSH_HOME/settings.yaml:
model-router:
enabled: true
provider: deepseek-official # only this provider is routed; others pass through
cheap: deepseek-v4-flash
pro: deepseek-v4-pro
vision: deepseek-v4-flash-vision-exp
escalateScore: 3 # >= this score escalates to `pro`
tokenBands: [4000, 12000, 30000] # est-token thresholds, +1 each when exceeded
Set enabled: false to disable routing without uninstalling.
Routing history
Routing decisions are shown in Settings → "Model Router" (a "Routing
history" list with a Clear button) and the most recent decision appears in the
composer readout. History is a bounded (40-entry) rolling log persisted in the
model-router-history settings namespace, so it survives restart.
Notes
- Only the three configured models on the configured provider are steered; anything else passes through untouched.
- Routing decisions are also logged to the host terminal as
[model-router] ….
License
MIT