Automatic Flash/Pro routing for DeepSeek Harness subagent calls: light tasks run on a cheap model (e.g. V4 Flash), heavy tasks stay on the strong model — with per-call overrides and /delegate session modes.
Install
# from npm (prebuilt)
dsh plugin --profile web add dsh-delegate-router
# from GitHub (first run asks for allowBuilds approval — follow the hint, retry)
dsh plugin --profile web add github:penguin-oo/dsh-delegate-router
Any plugin you install runs third-party code with your own permissions — it can read your files, use your credentials, and reach the network, and tool approvals don’t sandbox it. GitHub-sourced plugins also run build scripts at install time — pnpm blocks those until you allow them, so an install can stop with ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED or ERR_PNPM_IGNORED_BUILDS; dsh prints the exact key to add under allowBuilds in your profile’s pnpm-workspace.yaml, and the install works on the next run. Allowing a build is a trust decision: only install sources you trust, and pin a commit (github:owner/repo#sha).
README
Automatic Flash/Pro routing for DeepSeek Harness subagent calls.
Your main conversation keeps running on a strong model (e.g. V4 Pro). When the agent delegates a task to a subagent, this plugin classifies the task and sends light tasks to a cheap model (e.g. V4 Flash) while heavy tasks stay on the strong model — deterministically, without relying on the model's cooperation. Every decision is recorded in a ledger you can inspect from the sidebar (⚡ 分派记录).
- Auto routing — light tasks run on Flash, heavy tasks stay on Pro.
- DIY rules — all rules live in
~/.dsh/dsh-delegate-router.json: keyword lists, the short-task threshold, the budget cap, and the Beijing peak-hour demotion. - Manual overrides — per-call
provider/modelparameters on thesubagent/subagent_forktools. /delegatecommand — per-session mode:/delegate auto | off | flash-all, plus/delegate statusto print the routes in force.- Decision ledger — the ⚡ 分派记录 panel lists every routed delegation (task, route, trigger) for the active session.
Why
DeepSeek V4 Flash costs exactly one third of V4 Pro on every line (official
pricing, effective 2026-08-17; peak/off-peak only scales both). Stock DSH runs
every subagent on the parent's model — a search task delegated from a Pro
session costs the full Pro rate. Measured on real sessions: 4 routed runs,
~156K tokens, ¥0.32 actual (Flash) vs ¥0.96 hypothetical (Pro) — 66.7%
saved on every routed task. Run node scripts/measure-savings.mjs against
your own ~/.dsh/sessions to reproduce.
Rules (in order)
- explicit per-call
provider/model→ used as-is (manual) /delegate off→ inherit;/delegate flash-all→ all Flash- session tokens over
budgetCapTokens→ Flash (budget) - keyword dominance scoring: heavy wins ties, but a strictly-light task
beats one incidental heavy word (
auto-heavy/auto-light) - task text ≤
shortTaskMaxChars→ Flash (auto-short) - unmatched + Beijing peak hours (default 9–12, 14–18) → Flash (
peak) - unmatched +
unknownToFlash: true(opt-in, aggressive) → Flash (auto-unknown) - otherwise → inherit the parent model
Task text = the subagent call's description + prompt. Matching is precise:
pure-ASCII keywords use word boundaries (list never matches specialist,
design never matches designer); CJK keywords shorter than two characters
are ignored.
Works great with dsh-routing-suite
dsh-routing-suite owns the thinking-mode / persona layer; this plugin owns the child-model cost layer. They stack: light subagent tasks get routed to Flash by this plugin, then run under the router preset's flash-optimized persona. The routing suite's own experiments (P11/P24) found the optimal weak persona is flash-specific and that spec-style personas actively hurt Flash — so Flash + that router preset is the best-matched combination for cheap delegation, and this plugin supplies the automatic Flash routing for it.
Honest measurement
Relative prices are guaranteed by the official price table (Flash = 1/3 of Pro
on every line, 2026-08-17 peak/off-peak pricing). Absolute numbers depend on
how much work a run does — LLM runs are nondeterministic, so compare per
token (or same-task), never raw totals. scripts/measure-savings.mjs prices
your real session logs with the official table; read it before quoting numbers.
Install
dsh plugin --profile web add dsh-delegate-router
Configure
All knobs are optional and live in ~/.dsh/dsh-delegate-router.json:
{
"flashProvider": "opencode-go",
"flashModel": "deepseek-v4.1-flash",
"proProvider": "opencode-go",
"proModel": "deepseek-v4-pro",
"mode": "auto",
"lightKeywords": ["search", "搜索", "查找", "总结", "summarize", "list", "列出"],
"heavyKeywords": ["refactor", "重构", "implement", "实现", "debug", "调试"],
"shortTaskMaxChars": 120,
"peakDemoteUnknown": true,
"unknownToFlash": false,
"peakHours": [[9, 12], [14, 18]],
"budgetCapTokens": 0
}
shortTaskMaxChars: 0disables the short-task rule;peakDemoteUnknown: falsedisables peak-hour demotion;unknownToFlash: truesends ANY unmatched task to Flash (aggressive — leavefalseunless you are sure);budgetCapTokens: 0disables the cap.- Providers can also come from
DSH_DELEGATE_ROUTER_FLASH_PROVIDER/DSH_DELEGATE_ROUTER_FLASH_MODEL/DSH_DELEGATE_ROUTER_PRO_PROVIDER/DSH_DELEGATE_ROUTER_PRO_MODELenv vars. - Config edits apply to the next delegation — no DSH restart needed. Switch
mode at runtime with
/delegate auto | off | flash-all, and print the routes in force with/delegate status.
Development
npm install
npm run smoke # manifest sanity
node scripts/test-routing.mjs # deterministic rule checks
node scripts/measure-savings.mjs # real savings over ~/.dsh/sessions
node scripts/e2e-panel-loop.mjs # browser E2E against a test instance
License
MIT
Acknowledgements
Built for the DeepSeek Harness plugin ecosystem — thanks to the community on LINUX DO for feedback and testing.
Links
More in this category
corrinehu/dsh-workbuddy-connect★ 886
Brings the models in the WorkBuddy desktop app straight into DeepSeek Harness — zero configuration in the DSH chat.
V1ki/dsh-plugin-subscriptions★ 465
Use ChatGPT (Codex), Claude, and Grok subscriptions as DeepSeek Harness LLM providers, with Settings login, model catalogs, usage, plus image_generate, video_generate, and x_search tools.
Mars-Sea/dsh-commandcode-provider★ 390
Unofficial Command Code LLM provider: registers a `commandcode` route with a live model catalog and reasoning-effort support.
cv-superding/dsh-deepseek-web-login★ 270
Adds a deepseek-web provider that uses chat.deepseek.com web models in DSH, with browser login capture, PoW request signing, SSE streaming, and prompting-based tool calls.
FishBottle7/opencode2dsh★ 196
Exposes OpenCode Zen free models to DeepSeek Harness, with no API key.
WSL043/dsh-codex-subscription★ 175
ChatGPT OAuth provider for Codex models with subscription web search, quota and safe reset, image tools, Fast mode, and model-aware context; no API key or Codex CLI.
Community comments
Comments are public GitHub Discussions. Loading them connects to GitHub and Giscus; a GitHub account is required to post.