Chuyển đến nội dung chính

dsh-model-router

Đã xác minh

@incrhst/dsh-model-router · v0.1.2 · MIT · Giao diện 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.

Cài đặt

dsh plugin add @incrhst/dsh-model-router

Xác nhận layer đã áp bằng dsh --profile default --dump-config — xem hướng dẫn cài plugin.

Mã nguồn

Thẻ

Tác giả

Readme

@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