前言¶
DSH 的插件化方向是“一切皆插件”。在模型調用這條路徑上,DSH 仍負責 providers、credentials、model catalogs、modalities 和 retries;DSH Models 頁面仍是唯一的 provider configuration entry。
如果你希望按關鍵詞確定性切換模型、限制模型路由,或單獨接入一個隔離的生圖工具,dsh-model-router 提供了一個薄路由策略插件。它不替換 DSH 的模型管理,而是在其之上增加規則執行。
這是什麼¶
superboy911/dsh-model-router 是 DeepSeek Harness(DSH)的薄路由策略插件。當前版本爲 v0.2.2,已驗證 DSH 0.1.0-rc.6。許可證爲 MIT。
倉庫 owner 爲 superboy911;package.json 中的 author 字段爲 wenshan,二者不一致,維護者身份需確認。
它的核心定位是:
- 確定性關鍵詞路由
- 默認關閉的白名單
model_route工具 - 隔離的
image_gen生圖通道(Beta)
image_gen 仍爲 Beta;視頻、音頻和 3D 尚未實現。
核心功能¶
確定性關鍵詞路由¶
路由規則按配置順序執行,首次命中即停。未命中時不改動會話,繼續使用當前手動選擇,或由 DSH 默認模型接管。
寫入會話模型頭前,插件會精確校驗:
providermodel- 可選
reasoningEffort
白名單模型切換¶
model_route 默認關閉,只允許切換到明確加入白名單的模型。
示例中 agentSwitch 爲:
agentSwitch:
enabled: false
allow: []
子代理路由¶
子代理路由只在子代理規則命中並通過校驗後安裝 DSH 模型選擇。插件卸載時會清理監聽器。
隔離生圖通道¶
image_gen 使用 OpenAI 兼容端點,並做隔離處理:
- 除本機迴環 HTTP 外,要求 HTTPS
- 嚴格限制結果下載
- 憑據引用留空時不發送
Authorization請求頭
會話頭顯示的是負責調度工具的文字模型;image_gen 工具結果才記錄真正的生圖提供方和模型。
其他行爲¶
- 讀取 DSH 中啓用及休眠的提供方,不重複註冊文字模型適配器。
- 僅爲
Kimi K3增加提示約束,不隱藏或重標響應塊。 - V1 配置在內存中遷移,用戶明確保存後才持久化 V2。
安裝與啓用¶
運行要求¶
- DeepSeek Harness
0.1.0-rc.6 - Node.js
^22.19.0或>=24.0.0 - 開發或重新構建需要
pnpm 11
從 GitHub 安裝¶
下面命令先獲取源碼,再安裝到 DSH web profile。可選步驟用於復現倉庫中的構建產物。
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"
安裝後重啓 DSH Web,然後打開 Settings → Model Hub / 設置 → 模型中樞。
如果需要手動啓動 DSH Web:
npm exec @deepseek-ai/dsh -- web
典型用法¶
路由示例¶
下面示例在 model-router 配置中定義一條路由規則,將 architecture、refactor、架構、重構 映射到 deepseek-official 的 deepseek-v4-pro,並設置 reasoningEffort 爲 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: []
未命中時不改動會話:繼續使用當前手動選擇,或由 DSH 默認模型接管。
Seedream 生圖通道¶
接入 Seedream 生圖通道時,先把真實密鑰保存在 DSH Credentials 中,引用名使用 VOLCENGINE_ARK_API_KEY。不要把密鑰值直接寫進下面的配置文件。
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 用於限制結果下載主機;defaultSize 設置爲 1920x1920。
開發與驗證¶
開發或重新構建時使用 pnpm 11。下面命令用於測試、密鑰檢查、構建和打包檢查。
corepack enable
pnpm install --frozen-lockfile
pnpm test
pnpm check:secrets
pnpm build
pnpm pack:dry
accept:models 會真實調用外部模型並可能產生費用,因此不在 CI 中運行。
適用場景與注意¶
dsh-model-router 適合需要以下能力的 DSH 使用者:
- 按關鍵詞做確定性模型路由
- 限制
model_route只切換白名單模型 - 在文字模型之外單獨接入隔離生圖通道
- 在子代理規則命中後安裝模型選擇
使用注意:
- 插件以當前 DSH 進程權限運行。安裝前應檢查源碼、構建產物、依賴、配置和
MIT許可證。 image_gen仍爲 Beta;視頻、音頻和 3D 尚未實現。- 憑據引用留空時不發送
Authorization請求頭;使用真實密鑰時仍應按 DSH Credentials 管理。 - 社區目錄是獨立站點,不代表官方應用商店。下文目錄頁鏈接來自插件線索,未在本輪已抓取資料中核實。
鏈接¶
- GitHub:
https://github.com/superboy911/dsh-model-router - 插件目錄頁:
https://www.skillhub.cn/plugins/superboy911/dsh-model-router(此 URL 來自插件線索,未在本輪已抓取資料中核實)