Introduction¶
The DeepSeek Harness (DSH) philosophy is “everything is a plugin”. In model inference scenarios, you often need to maintain multiple models at the same time (such as low-cost fast models, high-performance models, and fallback models). When the primary model fails, manually switching or adjusting configurations disrupts the development flow. dsh-model-router transforms model selection into routing logic: you declare a virtual model ID, bind it to a pool of candidate models, and let the plugin select and dispatch them via algorithms to achieve transparent failover.
Plugin Introduction¶
- Plugin name: dsh-model-router
- Maintainer: andrepontesmelo
- Category: Model inference
- License: MIT
- Positioning: A DSH plugin that maps virtual model IDs to candidate models from real providers using pluggable routing algorithms (such as priority and round robin), and supports transparent failover.
Core Features¶
- Virtual model IDs and routing algorithms: Supports algorithms such as priority and round robin, mapping a virtual model ID to a set of candidate models from real providers.
- Transparent failover: When a candidate model encounters a streaming response error, it automatically switches to the next available candidate model without requiring application-layer awareness.
- Configuration-driven routing: Parameters such as the candidate model list, ordering, and inference strength are all managed through configuration files, without modifying code logic.
- Response source tracking: Records the identity of the model that actually produced the response in response metadata, making troubleshooting and auditing easier.
Installation and Activation¶
This plugin requires Node.js version 22 or higher, and a DSH profile must be configured first.
Installation command:
dsh plugin --profile <your-profile> add github:andrepontesmelo/dsh-model-router
Configuration example (cordis.patch.yml):
- insert:
- id: model-router
name: 'dsh-model-router'
config:
routes:
- id: routed-chat
algorithm: priority
candidates:
- provider: deepseek-official
model: deepseek-v4-flash
reasoning: high
Verification and Testing¶
The plugin includes a built-in test suite. Run it under the repository directory:
npm test # 76 个单元测试
npm run smoke # 5 个内存故障转移演练
Notes¶
- No session stickiness: Consecutive turns in the same conversation may be routed to different candidate models.
- Reasoning Effing limitation: The
reasoningparameter of a candidate model only takes effect when the model supports the corresponding effort; otherwise, the provider default is silently used. - Configuration trust: The plugin trusts the configuration; each listed candidate model is a real provider-backed model that will actually receive requests.
- Dependency requirements: The runtime environment must satisfy Node >= 22 and have a valid DSH profile.
Summary¶
dsh-model-router simplifies failure handling and load-balancing configuration in multi-model scenarios by introducing virtual model IDs and routing algorithms. It moves failover logic to the plugin layer, allowing upper-layer applications to invoke models only through virtual IDs. For more details, refer to the plugin catalog page or the GitHub repository.