dsh-model-router: DeepSeek Harness Task-Aware Model Routing

Preface

The philosophy of DeepSeek Harness (DSH) is “Everything is a plugin.” When building agents, manually specifying a model for every task is both cumbersome and difficult to maintain. The dsh-model-router plugin solves this problem by classifying requests based on task type and rescheduling them to the most appropriate model—prioritizing accuracy for research tasks or prioritizing free models for casual chat.

Plugin Introduction

Maintained by chillBnetley, this plugin belongs to the “Model Inference” category. It hooks into DSH’s llm/stream pipeline to determine the routing target before a request reaches the model, based on task type, model capability scores, price, and current status (such as rate limits). Core features include task-aware routing, auxiliary call filtering, rate-limit cooldown mechanisms, and support for sub-agents and agent teams.

Core Features

  1. Task-Aware Routing: Selects strategies based on task type (e.g., coding, math_reasoning, daily_chat). Research tasks prioritize quality scores; casual chat tasks prioritize free models.
  2. Grok Restriction: Grok is prohibited from receiving tool schemas during task execution turns and is only permitted for casual chat.
  3. Auxiliary Call Filtering: Auxiliary calls such as session title generation and compression requests are not routed, keeping the original model unchanged.
  4. Rate Limit Handling: Rate-limited paths enter a cooldown state rather than retrying on every request.
  5. Chit-chat Tone: Provides a dedicated system prompt fragment that is rendered only during casual chat turns, without affecting other tasks.
  6. Sub-agent Support: Supports sub-agents and agent teams; routing replaces the model in the streaming response without affecting other interaction logic.

Installation and Enablement

The plugin is distributed as plain text files. Installation steps are as follows:

git clone https://github.com/chillBnetley/dsh-model-router.git
cp -r dsh-model-router ~/.dsh/plugins/

Once installed, list the plugin in the DSH configuration file dsh.profile.bundles. The plugin contributes its own config: block within cordis.patch.yml.

Usage

  1. Observe Routing Decisions: For first-time use, it is recommended to enable dryRun: true in the configuration. In this mode, the router only logs decision details without changing the actual request, allowing you to verify if the strategy meets your expectations.
  2. View Decision Details: Use the /route command to view details of the last routing decision, including task type, confidence, tool requirements, current mode, and the selected model.
  3. Switch Session Mode: Use /mode work (default, quality-first) or /mode chat (chat mode, prioritizing free models like Space Bunny Free) to switch session modes.

Configuration

All configurations are located under the plugin’s config: block in cordis.patch.yml. Key configuration items include:

  • dryRun: true: Only logs activity; does not actually change requests.
  • respectModels: ["provider/model"]: Allows specified fixed models to be exempted from routing selection.
  • chitchatMaxTokens: Limits the maximum output length in chat mode.

Working Mechanism

The router does not modify the original request. It creates a brand-new request envelope and returns it. The request content is a pure function of the conversation history, ensuring state predictability.

Notes

  • No Guessing for “Unknown”: If a model has no capability records, or if tool support is unknown during a tool execution turn, the request is excluded. If no fallback is configured, the request remains as-is (not routed).
  • Auxiliary Calls Always Pass Through: Regardless of configuration, auxiliary call requests (requests with a purpose) are never routed.
  • Caching and Tone: Due to the switching of system prompt prefixes, setting chitchatStyle.enabled to false can improve cache hit rates when tone priority is low.

Summary

dsh-model-router provides a complete solution for moving from static configuration to dynamic routing, helping developers automatically optimize model selection based on task type. For more details, please refer to the plugin directory or the source code repository.

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye