dsh-model-router: A Thin Routing Strategy Plugin for DeepSeek Harness (DSH)

Preface

In DSH, the plugin philosophy is “everything is a plugin.” Along the model invocation path, DSH still handles providers, credentials, model catalogs, modalities, and retries; the DSH Models page remains the single entry point for provider configuration.

If you need deterministic keyword-based model switching, restricted model routing, or a separate isolated image generation tool, dsh-model-router provides a thin routing policy plugin. It does not replace DSH’s model management but adds rule enforcement on top of it.

What This Is

superboy911/dsh-model-router is a thin routing policy plugin for DeepSeek Harness (DSH). The current version is v0.2.2, verified against DSH 0.1.0-rc.6. The license is MIT.

The repository owner is superboy911; the author field in package.json is wenshan. These two are inconsistent, so the maintainer’s identity needs confirmation.

Its core positioning is:

  • Deterministic keyword routing
  • A whitelist-based model_route tool, disabled by default
  • An isolated image_gen image generation channel (Beta)

image_gen is still in Beta; video, audio, and 3D are not yet implemented.

Core Features

Deterministic Keyword Routing

Routing rules are executed in configuration order, stopping at the first match. If no rule matches, the session remains unchanged, continuing with the current manual selection or falling back to the DSH default model.

Before writing to the session model header, the plugin performs strict validation of:

  • provider
  • model
  • Optional reasoningEffort

Whitelist Model Switching

model_route is disabled by default and only allows switching to models explicitly added to the whitelist.

In the example, agentSwitch is:

agentSwitch:
  enabled: false
  allow: []

Sub-Agent Routing

Sub-agent routing only installs the DSH model selection after a sub-agent rule matches and passes validation. The plugin cleans up listeners upon unload.

Isolated Image Generation Channel

image_gen uses an OpenAI-compatible endpoint and is handled in isolation:

  • Requires HTTPS except for local loopback HTTP
  • Strictly restricts result downloads
  • Omits the Authorization header when the credential reference is left empty

The session header displays the text model responsible for dispatching the tool; the actual image generation provider and model are recorded in the image_gen tool result.

Other Behaviors

  • Reads enabled and dormant providers in DSH without re-registering text model adapters.
  • Adds prompt constraints only for Kimi K3, without hiding or re-labeling response blocks.
  • V1 configuration is migrated in memory; V2 is only persisted after the user explicitly saves.

Installation and Enablement

Requirements

  • DeepSeek Harness 0.1.0-rc.6
  • Node.js ^22.19.0 or >=24.0.0
  • pnpm 11 is required for development or rebuilding

Installing from GitHub

The commands below fetch the source code and then install it into the DSH web profile. The optional steps are used to reproduce the build artifacts committed in the repository.

git clone https://github.com/superboy911/dsh-model-router.git
cd dsh-model-router

# Optional: reproduce the committed build. / 可选:复现仓库中的构建产物。
corepack enable
pnpm install --frozen-lockfile
pnpm build

# Install into the DSH web profile. / 安装到 DSH web profile。
npm exec @deepseek-ai/dsh -- plugin --profile web add --force "$PWD"

After installation, restart DSH Web and open Settings → Model Hub / 设置 → 模型中枢.

To start DSH Web manually:

npm exec @deepseek-ai/dsh -- web

Typical Usage

Routing Example

The example below defines a routing rule in the model-router configuration that maps architecture, refactor, 架构, and 重构 to deepseek-v4-pro from deepseek-official, with reasoningEffort set to high.

model-router:
  schemaVersion: 2
  enabled: true
  matchCase: false
  rules:
    - id: architecture-review
      enabled: true
      keywords: [architecture, refactor, 架构, 重构]
      target:
        provider: deepseek-official
        model: deepseek-v4-pro
        reasoningEffort: high
  agentSwitch:
    enabled: false
    allow: []

If no rule matches, the session remains unchanged: it continues with the current manual selection or falls back to the DSH default model.

Seedream Image Generation Channel

When integrating the Seedream image generation channel, store the real key in DSH Credentials first, using the reference name VOLCENGINE_ARK_API_KEY. Do not write the key value directly into the configuration file below.

model-router:
  mediaProviders:
    - id: volcengine-seedream
      name: Doubao Seedream 5.0 Lite / 豆包 Seedream 5.0 Lite
      capabilities: [image_gen]
      adapter: openai-images
      baseUrl: https://ark.cn-beijing.volces.com/api/v3
      credential: VOLCENGINE_ARK_API_KEY
      models:
        - doubao-seedream-5-0-lite-260128
      allowedResultHosts:
        - ark-acg-cn-beijing.tos-cn-beijing.volces.com
      defaultSize: 1920x1920

allowedResultHosts restricts the hosts from which results can be downloaded; defaultSize is set to 1920x1920.

Development and Verification

Use pnpm 11 for development or rebuilding. The commands below are used for testing, secret checking, building, and packaging checks.

corepack enable
pnpm install --frozen-lockfile
pnpm test
pnpm check:secrets
pnpm build
pnpm pack:dry

accept:models makes real calls to external models and may incur costs, so it is not run in CI.

Use Cases and Notes

dsh-model-router is suitable for DSH users who need:

  • Deterministic keyword-based model routing
  • Restricting model_route to whitelist-only model switching
  • Adding an isolated image generation channel alongside text models
  • Installing model selection after a sub-agent rule match

Usage notes:

  • The plugin runs with the permissions of the current DSH process. Review the source code, build artifacts, dependencies, configuration, and MIT license before installation.
  • image_gen is still in Beta; video, audio, and 3D are not yet implemented.
  • The Authorization header is omitted when the credential reference is left empty; when using real keys, follow DSH Credentials management.
  • The community directory is a standalone site and does not represent an official app store. The directory page link below comes from plugin clues and has not been verified in the currently captured materials.

Links

  • GitHub: https://github.com/superboy911/dsh-model-router
  • Plugin directory page: https://www.skillhub.cn/plugins/superboy911/dsh-model-router (This URL comes from plugin clues and has not been verified in the currently captured materials.)
羽毛球分组比赛记分
小程序二维码

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

Xiaoye