dsh-auto-router: A DSH Plugin That Automatically Selects an Execution Model Using a Decision Model

Preface

DeepSeek Harness (DSH) follows an “everything is a plugin” architecture, where model inference capabilities are extended through plugins. Existing plugins such as code generation and writing typically invoke a single, fixed underlying model. When the same account has access to multiple models (writing, coding, reasoning, image generation, speech, etc.), manually switching between them disrupts the workflow and tends to lock you into a more expensive model for extended periods.

The dsh-auto-router plugin registers a virtual model named bailian-auto in DSH’s model list. When a request is sent to this model, a decision model analyzes the input and automatically selects the most suitable model from the available pool to execute the task. If the selected model runs out of quota, encounters an error, or enters a cooldown period, the plugin silently falls back to the next candidate model.

Plugin Positioning

dsh-auto-router is a model inference plugin maintained by interested3041. It addresses the following problem: when an API key grants access to multiple models, how to automatically select the optimal model based on input content, eliminating manual switching while controlling cost and spending.

The plugin supports OpenAI-compatible platforms including Alibaba Cloud Bailian, SiliconFlow, OpenRouter, Volcano Ark, Zhipu Open Platform, Moonshot, and the official DeepSeek platform, without being tied to any single vendor.

Core Features

Automatic Routing & Decision

Select bailian-auto from DSH’s model list. The plugin first invokes a decision model to analyze the input, determine the task type (writing, coding, reasoning, translation, image understanding, casual chat, etc.), and then selects an appropriate model from the candidate pool to execute the task. Within the same session, the previously selected model is reused until a certain number of calls is reached, avoiding redundant decisions.

Quota Cooldown & Silent Fallback

Candidate models are pre-filtered to exclude those that have exceeded quota or failed consecutively. The decision model only selects from available models and will never pick a broken model such as UNKNOWN_MODEL or INVALID_REQUEST. A broken model is disabled for 6 hours and will not be retried on every turn.

Cost Guardrails & Caching

The plugin assigns a cost estimate to each task type (simple: 3, moderate: 4, complex: 8, deep: 12, in units of ¥/million tokens). Simple conversations or writing tasks prefer mid-to-low-priced candidate models, preventing simple questions from being routed to expensive models. Within the same session, a re-decision is triggered only when price, capability, image input, cooldown, or quota limits change.

Model Selection Strategies

Five model selection order modes are supported:
- Smart (default): Automatically selects based on task type and cost
- Price-first: Prefers the cheapest available model
- Capability-first: Prefers flagship models
- Speed-first: Prefers the fastest-responding model
- Free-quota rotation: Prioritizes the least-used lightweight model based on the ratio of “tokens used / bucket size”

Student 300-元 Coupon Protection

If you are using the 300-元 deduction coupon from Alibaba Cloud’s “Yun Gong Kai Wu” student verification program, the plugin by default will not route to models that the coupon cannot cover (omni-modal, speech, OCR/translation/roleplay/research, vector ranking, Wanxiang/Happy/image, cloud marketplace third-party, etc.). In the panel under “Model Pool & Quotas,” there is a toggle allowCouponIneligibleModels, which is off by default. When enabled, the plugin will no longer block these models for you, and any resulting charges will be settled with cash.

Account Management & Ledger

The plugin supports adding multiple accounts, with independent tracking per key. Within the same session, the floating panel and logs only display records for the current key. Configuration settings, ordering, the selected account, connection display names, per-model quotas, and other preferences are persisted to ~/.dsh/auto-router/prefs.json and automatically restored after restarting DSH.

Chat Page Floating Panel

A collapsible floating panel is located at the bottom-right corner of the chat page, displaying the current key, model pool, and “last decision.” The panel is draggable, and its position is stored in localStorage. Clicking outside the panel while it is expanded will automatically collapse it. The panel shows task type, decision model, execution model, source, strategy, retry count, decision/response tokens, success/failure status, and cache hit rate.

User-Specified Model

During a conversation, send /model model-id or @model:model-id to pin that single message to a specific model. The next message will revert to automatic routing. Logs will be tagged with “user-specified” or “auto.”

Installation & Activation

Install the plugin in DSH:

dsh plugin add github:interested3041/dsh-auto-router

After installation, bailian-auto will appear in DSH’s model list. On first use, you will need to configure your account information.

Configuration

  1. Open the DSH plugin page and scroll down to the four tabs: “Accounts & Updates / Routing & Strategy / Model Pool & Quotas / Diagnostics & Logs.”
  2. In the “Accounts & Updates” tab, add your API key. Supported platforms include Alibaba Cloud Bailian, SiliconFlow, OpenRouter, Volcano Ark, Zhipu Open Platform, and more.
  3. In the “Routing & Strategy” tab, select the model selection order (Smart by default).
  4. In the “Model Pool & Quotas” tab, configure the candidate model list, per-model inline quotas (call count / tokens), and whether to allow models not covered by the “Student 300-元 coupon.”
  5. In the “Diagnostics & Logs” tab, view runtime logs and self-check results.

The floating panel in the bottom-right corner can be collapsed or expanded. Clicking the area outside the panel will automatically collapse it.

Use Cases & Notes

This plugin is suitable for users who need to use multiple models under a single API key, especially in scenarios where writing, coding, reasoning, image generation, and other diverse capabilities are accessed simultaneously. The plugin automatically selects models based on task type, reducing the need for manual switching.

Note: Smart routing increases balance consumption. Complex tasks are routed to stronger (and more expensive) models, so the per-task cost may be higher than consistently using a single cheap model. If cost is your primary concern, the “Price-first” strategy is recommended.

The plugin runs with the current DSH process privileges. It is recommended to review the source code and license before installation. The plugin does not redirect to other keys or other accounts; all model calls use resources under your configured API key.

Summary

dsh-auto-router uses a decision model to automatically select the execution model, providing a unified entry point bailian-auto within DSH and simplifying the multi-model invocation workflow. It features quota cooldown, silent fallback, cost guardrails, student coupon protection, and independent per-account ledgers, making it well-suited for scenarios requiring intelligent switching between multiple models.

Plugin directory: https://www.skillhub.cn/plugins/interested3041/dsh-auto-router
GitHub: https://github.com/interested3041/dsh-auto-router

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

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

Xiaoye