跳到正文

tianji-qingtian/dsh-model-router

231最近提交 2026年8月14日

dsh-model-router DSH 插件

dsh-model-router 是 DeepSeek Harness 的插件,根据复杂度智能地将用户查询路由到廉价或强模型。它使用零前缀闪断判断调用来分类步骤,并在廉价模型上直接提供快速回答,无需缓存未命中开销。该插件还提供了一个编辑器面板,显示实时令牌使用量、缓存命中率和成本估算。

如何安装 dsh-model-router DSH 插件

dsh plugin --profile web add "github:tianji-qingtian/dsh-model-router#v0.7.2

复制不会执行命令。安装 dsh-model-router DSH 插件前请核对仓库和版本。

dsh-model-router DSH 插件数据来源

dsh-model-router DSH 插件快照日期:2026年8月16日

discovered

dsh-model-router DSH 插件能做什么

  • 廉价模型判断路由:使用零前缀闪断判断调用将步骤分类为 SIMPLE 或 AGENTIC,将繁重工作路由到主模型,简单问题路由到廉价模型。
  • 快速回答模式:启用后,在廉价模型上运行零前缀流,并直接将问答写入会话日志,完全绕过主模型。
  • 自动降级:临时故障(RATE_LIMIT、SERVER、TIMEOUT、EMPTY_RESPONSE)将步骤降级到廉价模型并重试一次。
  • 实时用量计量:会话投影显示每个模型的令牌使用量、缓存命中和成本估算,可重放并支持冷会话。
  • 编辑器面板:提供自动/关闭开关、当前模型、实时令牌/缓存/成本数据以及按模型的使用量细分,支持中英文国际化。

dsh-model-router DSH 插件适合哪些场景

  • 通过将简单问题(如“法国首都是什么?”)路由到廉价模型来降低 API 成本。
  • 通过使用零前缀闪断模型改善琐碎查询的响应延迟。
  • 监控每个会话的令牌使用量和成本细分,用于预算管理。
  • 优雅地处理临时提供商故障,回退到更便宜的模型。
  • 集成到基于 DSH 的应用程序中,优化模型使用。

dsh-model-router DSH 插件适合谁

  • 希望优化会话成本和延迟的 DSH 用户。
  • 在 DeepSeek Harness 上构建应用、需要精细模型路由控制的开发者。

dsh-model-router DSH 插件的限制

  • 路由状态分裂:自动/关闭模式是持久的,但临时故障降级标志是进程本地的,在 Harness 重启后重置。
  • 直接快速回答会将会话日志中写入一个伪造的步骤信封,这是插件与 Harness 耦合最紧密的部分,Harness 升级后可能失效。
  • useProjection 统计反映整个会话日志,包括安装前记录的历史。

dsh-model-router DSH 插件的仓库 README 摘录

以下文字摘自 dsh-model-router DSH 插件的上游仓库 tianji-qingtian/dsh-model-router 的 README,版权归原作者,仅作引用。

Model Router & Cost Optimizer for [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) (`dsh`). Answers simple questions directly on the cheap model (zero prefix, no cache tax), degrades gracefully on transient provider failures, and shows live per-session token / cache-hit / cost figures right under the composer. > The harness is in developer preview and iterates quickly — expect compatibility-breaking changes. > 中文说明见 [README.zh.md](README.zh.md)。 ## Features - **Cheap-model judge routing** — clearly heavy work (strong keywords / long payloads) goes straight to the main model with zero added latency. Everything else is decided by a **zero-prefix flash judge call** (`SIMPLE` / `AGENTIC`, one word, 64-token cap, thinking off). The judge also sees the last assistant reply, so context-dependent follow-ups (它 / 这个 / 继续 …) are never misrouted to a context-free answer. - **Ask before quick-answering** — in auto mode, every SIMPLE hit asks the user through the built-in question UI: **⚡ 快速回答(flash)** or **主模型回答**. Choosing the main model (or dismissing the question) takes the normal flow; subagent sessions fall back automatically. The question text follows the request l

阅读完整 README仓库许可: MIT

dsh-model-router DSH 插件常见问题

如何安装 dsh-model-router?

首先确保全局安装了 `dsh` CLI(`npm install -g @deepseek-ai/dsh`)。然后运行 `dsh plugin --profile web add "github:tianji-qingtian/dsh-model-router#v0.7.2"`。最后重启 Harness(`dsh --profile web`)即可看到插件生效。

如何启用或禁用快速回答?

你可以在聊天中使用 `/router auto|off` 命令切换,或者使用编辑器面板中的自动/关闭开关。该设置会跨会话持久化,但如果仅在会话内使用命令,则重启后会重置。

如何查看当前会话的成本明细?

编辑器面板会显示实时会话指标:当前模型、令牌使用量(未命中/缓存)、缓存命中率、估算成本以及按模型的使用量细分。这些数字来自会话投影,可重放且支持冷会话。

如果快速回答过程中廉价模型失败怎么办?

对于临时故障(RATE_LIMIT、SERVER、TIMEOUT、EMPTY_RESPONSE),插件会自动回退到廉价模型并重试一次。如果仍然失败,则交由提供商自身的重试策略处理。

可以自定义成本估算的价格表吗?

可以。价格表定义在插件仓库的 `src/index.js` 中。你可以编辑 `PRICE_TABLE` 数组以匹配你账户的实际定价。面板中的成本均带有 `≈` 前缀,表示这是估算值。