Foreword¶
In DeepSeek Harness (dsh) sessions, simple queries and complex tasks are often mixed together. If all requests go through the main model, costs will keep rising; if everything is switched to a cheaper model, it might negatively impact requests requiring context, vision, or reasoning capabilities.
dsh-model-router is a plugin designed to address this problem: it provides heuristic routing between cheaper and stronger models, automatic fallback on transient failures, and a panel in the composer dock displaying token, cache, and cost information for the current session.
What is this¶
tianji-qingtian/dsh-model-router is a plugin for DeepSeek Harness, positioned as a model router and cost optimizer. It is maintained by tianji-qingtian under the MIT license.
It primarily handles three things:
- Routing simple requests to cheaper models;
- Retaining complex requests for the main model;
- Displaying token, cache, and cost information within the session.
Note: DeepSeek Harness is currently in developer preview, and the documentation warns of expected compatibility-breaking changes. The plugin requires the dsh CLI to be on PATH and version harness 0.1.1-rc.2 or higher.
Core Features¶
The capabilities are listed below by plugin feature.
Cheap-model judge routing¶
The plugin uses a cheaper model to judge whether a request belongs to the simple category. Obviously complex tasks are sent directly to the main model; the remaining requests enter a quick-answer judgment.
Ask before quick-answering¶
In automatic mode, after a simple request is detected, the plugin will first let the user choose: either get a quick answer from the cheaper model, or send it to the main model. Choosing the main model proceeds with the normal flow.
Direct quick-answer¶
When the user chooses a quick answer, the request is directly generated by the cheaper model, and the main model does not participate in that request.
Vision-aware routing¶
When a message contains image blocks, the plugin routes to an available vision model. If no vision model is available in the current environment, it falls back to the main model.
Model picker respected¶
The plugin does not override the model selected by the user in the composer picker or selectModel.
Auto / off toggle¶
Quick-answering can be toggled using /router auto or /router off, or via the route_model tool.
Automatic fallback¶
On transient failures, the plugin degrades the current request to the cheaper model.
Real usage metering¶
The plugin aggregates token usage, cache hits, and cost information for the current session, providing estimated costs based on model price tables. Cost figures are marked with ≈.
Composer dock panel¶
In the Web UI’s composer dock, the panel displays the toggle, token, cache, and cost information. The interface text supports zh/en.
Installation and Enabling¶
Prerequisites¶
First, ensure the dsh CLI is on PATH. If you previously only ran the harness via npx, you might not have a global dsh command. You can install the global CLI first:
npm install -g @deepseek-ai/dsh
If using pnpm, you can also run:
pnpm add -g @deepseek-ai/dsh
The runtime requirement declared in package.json is node ^22.19.0 || >=24.0.0, with peer dependencies including @deepseek-ai/cordis ^4.0.1.
Adding the plugin¶
Next, add the plugin to the web profile:
dsh plugin --profile web add "github:tianji-qingtian/dsh-model-router#v0.9.3"
The add command only modifies profile files; a running dsh instance will not hot-load the new bundle. You need to restart that profile:
dsh --profile web
Verification¶
After restarting, go to Settings → Plugins and confirm that dsh-model-router is listed.
Typical Usage¶
After completing the steps above, a Router panel will appear below the composer in the Web UI.
Common operations are as follows:
- Enable automatic routing:
/router auto
- Disable automatic routing:
/router off
-
In automatic mode, simple requests will first ask if you want a quick answer; choosing the main model proceeds with the normal flow.
-
When sending a message with images, the plugin will prioritize selecting an available vision model.
-
View the token, cache, and cost information in the composer dock panel.
Use Cases and Considerations¶
- Suitable for developers using the
DeepSeek HarnessWeb UI who wish to distinguish between simple and complex requests. - Suitable for scenarios where you need to view token, cache-hit, and estimated cost information during a session.
- The plugin runs with the permissions of the current
dshprocess. It is recommended to review the source code, dependencies, and license before installation. DeepSeek Harnessis in developer preview, and compatibility-breaking changes may occur.- Cost figures are estimates based on model price tables; the panel uses
≈for marking;TokenUsagefields are disjoint, andinputTokensexcludes cache reads. - DSH’s philosophy is “everything is a plugin”; the plugin directory page belongs to an independent community directory, not an official app store, and does not imply an official affiliation with
DeepSeekor幻方.
References¶
- Directory page:
https://www.skillhub.cn/plugins/tianji-qingtian/dsh-model-router - GitHub:
https://github.com/tianji-qingtian/dsh-model-router
If you want to distinguish between simple and complex requests in a dsh session while viewing token, cache, and cost information for the current session, dsh-model-router provides the capabilities of model routing, failure fallback, and a session cost panel.