green-dalii/dsh-shift-router ↗★ 1
dsh-shift-router
Two-tier model router for DeepSeek Harness — automatic execution/judgment routing with LLM Judge, multi-model fallback chains, and exponential-backoff runtime failover. A DSH adaptation of pi-shift-router.
安装
npx -p @deepseek-ai/dsh dsh plugin --profile web add github:green-dalii/dsh-shift-router说明文档
阅读完整 README ↗English · 简体中文
dsh-shift-router
面向 DeepSeek Harness 的双层模型路由器 —— 基于 LLM 裁判的自动执行/判定路由、多模型回退链、指数退避运行时故障转移,以及任务级编排。
由 pi-shift-router 适配到 DSH 的版本。
日常对话不该花旗舰模型的钱;真正重要的对话也不该交给便宜模型。
在每个顶层 Agent 的每一轮开始之前,一个轻量的 LLM 裁判(运行在你的 Fast 层模型链上)会把用户消息判定为 fast(日常)或 smart(重要)。被选中的层随后通过 harness 自身的 agent/request 管线驱动整轮——思考、工具调用、代码编辑。裁判只做判定,从不干活。
🦾 [deepseek-v4-flash] → fix the failing test
🧭 judging…
🧠 [deepseek-v4-pro] ← "design the auth flow" → 立即升级
⚠️ deepseek-v4-flash 429 → 冷却中,改走 glm-5.2 — 1 分钟后重试
🦾 [glm-5.2] ← 同层故障转移
特性
- 即时升级、趋势门控降级 —— 一次
smart判定立即切到强模型;降回弱模型需要滑动窗口内的多数判定(默认 5 轮、≥60%,低置信度投票被忽略)。 - 缓存感知路由 —— 当 Fast 与 Smart 共享同一 provider 时,路由器抬高降级阈值(0.9),并在 prompt 缓存仍热时保持当前层,避免切到便宜模型反而更贵。
- 运行时故障转移 —— 429 / 5xx / 配额失败会把模型置入指数退避冷却(1m → 4m → 16m → 1h,上限 6h;客户端侧限流从 16m 起步),并在同一层内重新解析到下一个健康模型——同一轮内重试,绝不跨层。
- 任务级编排 —— 复杂任务(
smart判定)会让 Smart 层担任 CTO:规划、通过 harness 的subagent工具把实现委派给 Fast 层工程师子代理、逐个审查结果并迭代。硬上限由插件强制执行而非仅靠提示词:每次委派计一轮、每个失败的工作代理结果计一次升级,一旦触顶subagent工具会被直接拒绝、系统提示词切换为"立即收尾"通知。 - 成本遥测 —— 按层统计 token/吞吐,可选的 USD 计价表(
/router stats会显示"本次会话若全程使用 Smart 模型将花费多少")。 - 零配置启动 —— 未配置分层前完全无操作;配置完成后路由立即生效。配置可通过 GUI 设置面板 和
/router config命令实时编辑(持久化,无需重启)。
安装
以 bundle 方式(推荐)
git clone https://github.com/green-dalii/dsh-shift-router.git
cd dsh-shift-router
npm install && npm run build
dsh plugin --profile web add /path/to/dsh-shift-router
bundle 的 cordis.patch.yml 会把插件插入任何声明了它的 profile。插件无需任何配置即可加载(所有默认值都安全);分层模型来自设置面板或 patch 行。