Introduction

DeepSeek Harness (DSH) adopts the architectural philosophy that “everything is a plugin.” When developing agents or applications, developers often face a concrete pain point: directly calling low-cost Flash models is fast but has unstable quality, while calling high-cost Pro models delivers high quality at an expensive cost. A balance must be found between cost and quality.

This plugin is maintained by lengquan88 and implements automatic dual-model routing. It supports direct calls to Flash models to reduce cost, automatically escalates to Pro models when necessary, and builds an “escape-learning loop” mechanism to prevent wrong answers from being repeatedly submitted.

Core Features

This plugin provides the following core capabilities:

  1. Six-criteria routing decision: Based on the length of the input, context, domain coverage, rule conflicts, confidence, and novelty, it generates labels across six dimensions to assist decision-making.
  2. Model call switching: In the dual_model_run tool, the system first attempts to call deepseek-v4-flash directly; if it determines that an upgrade is required, it calls deepseek-v4-pro. If the upgrade call fails, it automatically falls back to the Flash model and marks it as degraded.
  3. Escape-learning loop: Through the dual_model_mark tool, users can mark the correctness of direct results. If marked as correct=false, the system learns the fingerprint and writes it to the log; the next time the same fingerprint is encountered, it forces an upgrade to the model, avoiding repeating the same mistake.
  4. Persistent storage and interoperability: State is persisted to files and is compatible with the fingerprint format of Python dao/model_router.py version v2.

Installation and Activation

Installation

Run the following command in the project directory to install the plugin:

pnpm add @lengquan88/dsh-dual-auto

Activation

  1. Open the DSH project configuration file cordis.patch.yml.
  2. Add the following content to register the plugin:
- insert:
    - id: dual-auto
      name: '@lengquan88/dsh-dual-auto'
  1. Restart the dsh web service.

After restarting, the following three tools will be available in all sessions: dual_model_route, dual_model_run, and dual_model_mark.

Typical Usage

Tool Description

  • dual_model_route: Performs the six-criteria routing decision and outputs labels across six dimensions. If the fingerprint has previously been marked as incorrect, this tool forces it to be marked for upgrade.
  • dual_model_run: Performs decision-making and actual model invocation. The flow is: first attempt the Flash model; if the decision is to upgrade, call the Pro model. For probing tasks, the system automatically verifies whether the answer is correct; if the direct answer is incorrect, it triggers escape learning.
  • dual_model_mark: Manually marks the correctness of direct results. Entering correct=false records the fingerprint and rewrites the on-disk log marker, ensuring that the next time the same fingerprint is encountered, the upgrade is forced.

Data Persistence

During operation, the plugin generates the following files for state persistence:

  • output/dsh_router_fingerprints.json
  • output/dsh_router_stats.json
  • dsh_router_decision_log.jsonl

These file formats are compatible with the dao/model_router.py v2 version of the Python project, and fingerprint data can be loaded directly.

Applicable Scenarios and Notes

  • Applicable scenario: Suitable for developers who need to balance inference cost and model quality in DSH. In particular, when handling a large volume of requests, with some requests requiring extremely high quality, the escape-learning loop can gradually reduce the number of calls to Pro models.
  • Dependencies and permissions: The plugin depends on @deepseek-ai/cordis (^4.0.1). Because the plugin runs with the current dsh process permissions, please check the source code and license before installation.

Summary

Through automated routing decisions and an escape-learning mechanism, this plugin resolves the conflict between cost and quality in DSH development. Developers can focus on business logic, leaving model switching and quality validation to the plugin. For more details, refer to the community catalog or the source repository.