Unified 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-selected by purpose, per-candidate reasoning effort, and a settings-page management panel.
Install
# from npm (prebuilt)
dsh plugin --profile web add @welsione/dsh-model-router
# from GitHub (first run asks for allowBuilds approval — follow the hint, retry)
dsh plugin --profile web add github:welsione/dsh-model-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
Unified model routing plugin: one logical ModelID backed by multiple providers' equivalent models, organized into plans (each with three tiers
tier1/2/3) — first-token failover with cooldown, health-aware ranking, per-candidate reasoning effort; manual per-session tier picking in the chat window, and a settings panel that auto-saves every change to routes and model capabilities.📦 Published on npm:
@welsione/dsh-model-router
中文说明见 README.md。
dsh plugin --profile web add @welsione/dsh-model-router
Screenshots
| Chat window · plan & manual tier picker | Settings panel · route management |
|---|---|
![]() |
![]() |
Left: the chat-window "plan · tier" picker — per-plan custom tier names (e.g. 穷鬼套餐: 夯 / NPC / 拉完了), click to pick a tier manually, and the current provider/model + reasoning effort shown at the bottom.
Right: the "统一模型路由" settings panel — candidate chains per plan with per-candidate failure/success counts (health), reasoning effort, switch stats (280 requests · 9 switches), cooldown and model-capability editing, all auto-saved.
Overview
| Capability | One line |
|---|---|
| Multi-plan routing | Multiple plans (Route Groups) coexist, each with its own three-tier candidate chain and tier names |
| Auto failover | Pre-first-token failures (rate limit / quota / auth / network / unknown model / empty response) switch to the next candidate; the failed one enters graded cooldown (short for rate-limit, medium for server, long for auth) with exponential backoff (capped at 30 min) |
| Health-aware ranking | Sliding-window time-decayed, error-code-weighted scores reorder chains — recent results weigh more, server-class failures cost more than rate-limit ones; toggle off in one click |
| Three tiers + manual tier | Per-plan tier1 light · tier2 standard · tier3 powerful, auto-selected by purpose with downgrade; per-session manual tier in the chat window |
| Reasoning effort | Per-candidate reasoningEffort, prechecked with a real request at save time — only host-accepted levels allowed |
| Tier names | Per-plan custom tier display names (routes.<id>.tierNames), click-to-rename colored capsules, synced to the chat plan menu |
| Model capability write-back | Edit custom-provider model capabilities (reasoning effort / contextWindow / maxTokens) in the panel, written back to the host llm-pi-ai, hot-reloaded |
| Management panel | Built-in 模型路由 card in DSH Settings with route stats / cooldown / health / capability editing, auto-save; live routing status in the chat toolbar |
| UI language | Panel copy goes through the host locale registry (model-router namespace) with shipped zh/en dictionaries and reload-free switching; third-party language packs can register more languages for the same namespace |
| Session safety | Recoverable route events, automatic replayState sanitization across providers |
Compatibility
- DSH
0.1.0-rc.x–0.1.5-rc.x(verified on0.1.5-rc.1; compatible with thesettings.installSectionAPI introduced in 0.1.2) · Node.js ≥ 22 (React 18/19) · Last verified 2026-09-11.
Install / Uninstall
Published on npm as @welsione/dsh-model-router; dsh plugin add pulls it from npm automatically:
dsh plugin --profile web add @welsione/dsh-model-router # install
dsh plugin --profile web remove @welsione/dsh-model-router # uninstall
npm unreachable? Fall back to the GitHub source:
dsh plugin --profile web add github:welsione/dsh-model-router.
After install, a 模型路由 card appears in Settings; the chat model picker becomes a plan picker with tier switching. See docs/usage.md.
Quick start
Open Settings → 模型路由, add a unified ModelID (e.g. deepseek-v4-flash) and configure tier1/2/3 candidates — any change auto-saves instantly. Minimal config and full examples: docs/usage.md.
Configuration
Visual editing for enabled / cooldownMs / maxSwitchesPerStep / healthRanking / reasoningEffortsFallback / routes (including per-plan tierNames). Full config table, llm-pi-ai capability write-back and panel API: docs/usage.md.
Permissions & data
No outbound calls, no workspace file access, no telemetry, no API-key handling; runtime state is in-memory, manual tiers persist to host settings.
Troubleshooting
Missing 模型路由 card / candidate not in catalog / auto-save failed / constant switching / session stuck at step 1 → quick checklist: docs/usage.md.
Development
npm test # unit tests (node:test, zero deps)
npm test && npm pack --dry-run # pre-publish gate
Pure logic in lib/core.mjs + wiring in lib/index.js + Web UI in lib/client.js; compliance evidence: docs/self-check.md.
Publishing a new version (auto-publish to npm)
Push a v<version> tag and the GitHub Action (npm-publish.yml) verifies the tag matches package.json version, then runs npm publish:
npm version patch # bump version (patch/minor/major, update CHANGELOG)
git push && git push --tags
Publishing requires the repo's NPM_TOKEN secret (an Automation token for the welsione npm account).
License
MIT. Report security issues privately through the repository.
Links
More in this category
Ebony-Vinyl/dsh-our-free-model★ 34394
Adds free model lanes to DeepSeek Harness — DeepSeek V4.1 Flash, Kimi K3 and others — with no login, sign-up or API key, plus a local OpenAI-compatible gateway, fallback routing and a usage dashboard.
V1ki/dsh-plugin-subscriptions★ 491
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★ 423
Unofficial Command Code LLM provider: registers a `commandcode` route with a live model catalog and reasoning-effort support.
dingminhua/dsh-connect-workbuddy★ 372
Connects locally signed-in WorkBuddy models to DSH, supports per-model image input opt-in, account switching, and a read-only credits overview with daily check-in.
FishBottle7/opencode2dsh★ 319
Exposes OpenCode Zen free models to DeepSeek Harness, with no API key.
cv-superding/dsh-deepseek-web-login★ 294
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.


Community comments
Comments are public GitHub Discussions. Loading them connects to GitHub and Giscus; a GitHub account is required to post.