Introduction¶
When running agents in DeepSeek Harness (DSH), you often configure multiple channels and dozens of provider/model pairs. The real frustration in daily conversations isn’t “which model to choose,” but rather the current model suddenly hitting quota limits, invalid keys, rate limiting, or a network hiccup—interrupting the response before it even starts. Manually switching models and resending requests disrupts the workflow and often leads to mistaking a temporary channel failure for a “bad model.”
The community plugin dsh-model-rotator (Maintainer: chimneyQ, Category: Model Inference) addresses a different set of issues: without modifying your existing provider/model configurations, it automatically discovers available conversation models on your machine, ranks them by measured connectivity and speed, and takes over the llm/stream waterfall. When the current attempt yields absolutely no body content, it switches to the next candidate within the same turn to continue the streaming response. By default, the user sees a standard reply, while switch logs are kept in a separate “Model Switching” tab, occupying no conversation context.
The following section explains “What it does → How to install → How to use → What to note.” Facts are subject to the GitHub Repository and SkillHub Directory Page. SkillHub is a community-maintained plugin directory and has no official affiliation with DeepSeek or Hunyuan.
What is this¶
dsh-model-rotator is a model inference plugin for DSH (npm package name dsh-model-rotator, currently documented version 0.2.14, MIT license, requires Node >= 18). In one sentence: It adds “measured ranking + transparent same-turn failover” to the Harness—discovering local provider/models, filtering out non-conversational and vision-sibling routes, ranking viable candidates, and retrying or switching within a zero-content window upon failure. It also provides a channel-grouped model list and toggles.
The plugin never reads, writes, or modifies model and provider configurations; it only observes and intervenes in streaming calls at runtime.
Core Features¶
Discovery, Filtering, and Ranking¶
- Calls
ctx.llm.listProviders()and the adapters’listModels()to enumerate reachableprovider/modelpairs on the local machine. - Removes families incapable of completing a conversation turn: Embeddings/Rerank, TTS, OCR, Image/Video Generation, Moderation, and Scoring models, preventing them from occupying cooldown slots.
- Skips
*-visionvision-sibling routes generated by dsh-vision-router (these are secondary paths for the same model and not independent candidates; however, real conversation models with “vision” in their names are retained). - Sorts remaining candidates by Laplace-smoothed success rate, TTFT median, and throughput, combined with failure cooldown. When
preferSameModel: true(default), the current model or its close relatives on other channels get weighted higher.
Retry and Same-Turn Failover¶
- A single failure doesn’t mean immediate death: The same model is retried within
retriesPerModel(default 2, range 0–5) withretryBackoffMs(default 300ms, incremental). Retries do not switch models or prompt for confirmation. - On
llm/stream: The first attempt follows the host’s original path. If it fails and there is no body content shard (reasoning-deltaand markup blocks do not count as content), it closes the upstream stream and dispatches the next candidate using a newctx.llm.stream(). - Once body content starts flowing, it will not retry or switch to avoid duplicate visible text.
- Stops the chain on user cancellation, timeout, or client disconnect to avoid wasting candidates.
- Automatic calls with
purpose: "compaction"orpurpose: "session-title"are passed through as-is (including errors) and do not participate in failover, to avoid erroneous switching on compression or title generation channels.
Switch Confirmation, Cooldown, and Logging¶
- Default
confirmSwitch: true: On zero-content failures, it asks “Switch” or “Keep Current Model” viactx.userQuestions.askTimed(). If no answer is given before timeout, it proceeds with the switch. Deterministic failures of typesquotaandunsupportedswitch directly without asking. - Failures are categorized (e.g.,
quota,auth,rate-limit,unsupported,server,network) and affect cooldown:quotacan usequotaCooldownMsandquotaCooldownHour(next day); others mostly use exponential backoff (cooldownBaseMs/maxCooldownMs). Measured stats can be persisted to%DSH_HOME%/model-rotator/stats.json(subject tostatsPersistTtlMs). - Switching is silent by default; logs are kept in the “Model Switching” tab at the top of the conversation (
GET /_dsh/model-rotator/switches?session=<id>). OptionalnoticeSwitch: trueposts a notification like “Model switched: A -> B” at turn boundaries. - When
adoptSwitchedModel: true(default), the model actually answering is written back to the current session display, without touching global default configurations.
Tools, Lists, and UI¶
| Tool | Function |
|---|---|
model_rotator_status |
Read-only: Enabled status, pool size, ranking, active config source, cooldowns, and question channel status. |
model_rotator_benchmark |
Probes candidates with minimal real requests to refresh latency and cooldown (has request limits and consumes quota). |
model_rotator_select |
Pins or unpins the head of the failover queue. |
Settings entry: Settings → Model Auto-Switching, as well as the model-rotator card in the plugin panel. Below is a searchable, channel-grouped model list (GET /_dsh/model-rotator/models, POST {key, enabled} to toggle rows or channels). Configuration merge order: Defaults < %DSH_HOME%/model-rotator/config.json < Settings Page (keys not overridden by the settings page still come from the file).
Installation and Enablement¶
Recommended installation via npm to the desktop profile:
dsh plugin --profile desktop add dsh-model-rotator
Alternatively, install from GitHub:
dsh plugin --profile desktop add github:chimneyQ/dsh-model-rotator
The package includes cordis.patch.yml and requires no additional build. A full restart of the DSH application is required for it to load. If you suspect the bundle isn’t loaded, check if dsh.profile.bundles in <DSH_HOME>/profiles/desktop/package.json includes dsh-model-rotator.
Optional config file path: %DSH_HOME%/model-rotator/config.json, supports hot-reload; it runs with defaults if the file is absent. Common fields include enabled, maxCandidates (default 4), confirmSwitch, retriesPerModel, noticeSwitch, disabledModels / disabledProviders. See the repository README.zh.md for a full example.
Typical Usage¶
1. Verify the pool and ranking after installation
Run in conversation or tool invocation:
model_rotator_status
Focus on discovered and the ranking table; the number of local candidates depends entirely on your configured providers, so do not copy example numbers from the docs.
2. Refresh measured metrics when needed
model_rotator_benchmark
Note: This initiates real requests and may consume quota.
3. Pin the failover queue head (Optional)
model_rotator_select
Or set pinned in config.json.
4. Turn off channels or individual models in the UI
Open Settings → Model Auto-Switching and toggle off a row or channel header in the list; this is equivalent to writing to disabledModels / disabledProviders.
5. To see switch notifications in the body text
Enable the corresponding option in the settings page or configure noticeSwitch: true.
Applicable Scenarios and Notes¶
Who is it for
- Users with multiple API channels and multiple same-name or related models on the same machine who want “automatic switch to the next channel when the current one fails” without modifying cordis/provider configs.
- Long-running or unattended scenarios requiring automatic ranking by connectivity and speed, and differentiated cooldowns for quota/rate limits (default allows timed confirmation, proceeds to switch on timeout).
Important Notes
- The plugin runs with current DSH process permissions and intercepts and re-initiates
llm/stream. Please read the source code and MIT license before installation to assess the trust boundary yourself. allowImageFailoverisfalseby default: Turns containing images do not participate in failover by default, to prevent pure text backups from giving incorrect answers.- Vision-siblings are excluded from candidates by default; if wrapper naming does not follow the
*-visionconvention, they can be added back viaenabledModels. - Community directory ratings and GitHub stars (documented as 1) only reflect exposure, not official endorsement; version and behavior are subject to the package you install.
Conclusion¶
dsh-model-rotator turns “multi-model, multi-channel” management from manual firefighting into runtime ranking and same-turn failover: failures are retried or switched within a zero-content window, switches are logged with optional confirmation, lists and cooldown strategies are configurable, and it promises not to touch provider configurations. If you already have a stack of channels in DSH, it is worth trying as a resilience plugin for the model inference layer.
- Directory Page: https://www.skillhub.cn/plugins/chimneyQ/dsh-model-rotator
- Source & Docs: https://github.com/chimneyQ/dsh-model-rotator