tianji-qingtian/dsh-model-router
模型路由与成本优化器:针对DeepSeek Harness,简单问题由flash快速回答,故障自动降级,实时显示token/缓存/成本面板
Project Overview项目介绍
This is a native model routing and cost optimization plugin built exclusively for DeepSeek Harness (DSH). To install it, you first need to have the DSH CLI installed globally on your system PATH, version 0.1.1-rc.2 or newer. If you installed DSH via pnpm, you need to ensure your pnpm global bin directory is added to your system PATH, otherwise you can run the pnpm setup command first or prefix installation commands with npx. The plugin is added directly to your DSH web profile via the dsh plug command, and no additional build step is required as prebuilt artifacts are already committed.
This plugin is designed for any DSH user who wants to reduce their LLM API costs without sacrificing functionality for simple queries. It automatically classifies queries with a fast zero-prefix judge call that checks whether a query is simple enough for a cheaper model. If the plugin is set to auto mode, it will ask the user for confirmation before routing a simple query to the cheap model, and users can also disable automatic routing entirely at any time. The routing logic respects any manually selected model in the composer, and handles image queries correctly by routing them to vision-capable cheap models when available.
The plugin is released under the open-source MIT license, so it is free to use, modify, and distribute. It automatically detects cheap and strong model pairs from your existing provider catalog at runtime, based on simple model name matching rules. There are a few known limitations: transient failure degradation flags are stored process-locally and reset when DSH restarts, while the auto/off toggle state is durable and survives restarts. The forged step envelope used for direct quick answers is tightly coupled to DSH's current session structure, so users should check compatibility after DSH upgrades.
这是一款专为 DeepSeek Harness (DSH) 开发的原生模型路由与成本优化插件。它可以将简单问题路由到廉价模型回答,避免额外缓存税费,同时在服务商出现短暂故障时自动降级重试,还能在编辑器底部停靠栏实时显示会话内的 token 用量、缓存命中率和成本估算。插件支持中英双语界面,可通过 DSH 官方 CLI 命令直接安装到本地配置中。
对于日常使用 DSH 进行开发和对话的用户来说,这款插件可以在不改变原有使用习惯的前提下降低使用成本。插件会自动通过零前缀快速判断任务类型,如果判断为简单问题会弹出询问,让用户选择是使用廉价模型快速回答还是调用主模型处理,也支持手动开关自动路由功能。图像类消息会自动路由到支持视觉的廉价模型,没有对应模型则回退到主模型,不会出现无依据回答。
该插件基于 MIT 许可开源,使用前需要先全局安装 DSH CLI 0.1.1-rc.2 或更新版本,若使用 pnpm 需确保 pnpm 的全局 bin 路径已添加到系统 PATH 中。目前插件存在一些已知限制:自动路由状态可持久化保存,但故障降级标记是进程本地的,重启后会重置;直接快速回答会在会话日志中生成伪造的步骤封包,升级 DSH 后需要重新检查兼容性。
请帮我安装这个 DSH 插件。安装前先完成【兼容性检查 + 安全性检查】,检查通过再动手。
插件:dsh-model-router(tianji-qingtian/dsh-model-router)
仓库:https://github.com/tianji-qingtian/dsh-model-router
本站详情页:https://www.yhbd.top/plugins/tianji-qingtian-dsh-model-router/
本站登记:类型 plugin · 归类 原生 DSH 插件 · 许可证 MIT · ⭐ 6 · 最近提交 2026-09-29 · 主语言 JavaScript
按下面顺序执行,每步先把结论告诉我,再进入下一步:
【1 兼容性检查】
① 我这边:DSH 版本、Node 版本、操作系统、当前 profile(web / desktop)。
② 读它的 README、package.json、插件 manifest,列出它要求的 DSH 版本 / Node 版本 / 操作系统 / 外部依赖 / 需要另外先装的运行时。
③ 逐条比对,结论只写「满足 / 不满足 / 未知」三种;不满足的给出可行替代方案。
④ 检查是否和我已装的插件冲突:命令名重复、skill / tool 重名、端口占用、重复注册的 MCP server。
【2 安全性检查】
① 仓库可信度:和上面「本站登记」是否一致;star / fork 数、创建时间、最近提交,是否归档或长期停更。
② 安装脚本:逐行看 package.json 的 preinstall / install / postinstall,以及 install.sh、setup.ps1 之类脚本。出现 curl|bash、下载后直接执行、混淆代码、访问与插件功能无关的域名,立刻停下来告诉我,不要继续装。
③ 依赖:列出新增依赖,标出无人维护、或与知名包拼写近似的可疑包(typosquatting)。
④ 权限与副作用:它会读写哪些目录、访问哪些域名、需要哪些 DSH 权限(filesystem / network / shell / clipboard 等),以及怎么卸载和回滚。
⑤ 如果它要求 sudo / 管理员权限,或权限明显超出功能所需,先停下来问我。
【3 安装】
上面两步没有「不满足」和「高危项」时才执行;用官方推荐方式安装,不要自行提权。
【4 汇报】
用表格输出:检查项 / 结论 / 依据 / 是否需要我决策。拿不准的一律写「未知」并说明要我怎么确认——不要猜,也不要替我决定。
Send this message to DSH in your current session: it verifies compatibility and security first (answering met / not met / unknown item by item) and only installs once everything checks out — it will stop and ask you if it finds a high-risk item. The box scrolls; the copy is the full prompt. CLI install commands may not be accurate across systems, so DSH is the safer route.把上面这条消息直接发给当前会话里的 DSH:它会先核对兼容性与安全性(逐条给「满足 / 不满足 / 未知」),确认没问题再安装,有高危项会停下来问你。框内可滚动,复制到的是完整提示词;安装命令不一定准确,发给 DSH 更稳。
- Only 6 stars - very few users, little community feedback星标只有 6,几乎没人在用,遇到问题缺少社区反馈
DSH walks through these 9 checksDSH 会逐条核对这 9 项
Compatibility兼容性
- DSH, Node, OS and profile requirementsDSH 版本 / Node 版本 / 操作系统 / profile 是否满足要求
- External dependencies and runtimes (Electron / Python / Docker, ...)外部依赖与运行时(Electron / Python / Docker 等)是否齐备
- Conflicts with installed plugins: command names, skill / tool names, ports, duplicate MCP registration与已装插件是否冲突:命令名、skill / tool 重名、端口占用、重复 MCP 注册
Security安全性
- Repo matches the facts registered here; archived or abandoned?仓库是否与页面登记一致,是否归档或长期停更
- Safety of preinstall / install / postinstall and install.sh / setup.ps1preinstall / install / postinstall 与 install.sh、setup.ps1 是否安全
- curl|bash, download-then-execute, obfuscation, unrelated domains → stop immediatelycurl|bash、下载即执行、混淆代码、无关域名 → 立刻停止
- Typosquatting or unmaintained packages among the new dependencies新增依赖里有没有 typosquatting 或无人维护的包
- Requested permissions vs. what the feature actually needs申请了哪些权限、是否超出功能所需(filesystem / network / shell / clipboard)
- Any sudo / admin requirement, plus uninstall and rollback是否要求 sudo / 管理员权限,以及卸载与回滚方式
Anything uncertain must be marked unknown with a note on how to confirm it. This site's signal screen is a static snapshot, not a security audit.拿不准的必须标「未知」并说明要我怎么确认。本站的信号筛查是静态快照,不能替代安全审计。
Or use CLI install (for developers)或使用命令行安装(适合开发者)
CLI Install命令行安装
dsh plugin --profile web add "github:tianji-qingtian/dsh-model-router#v0.9.5"
把 tianji-qingtian/dsh-model-router 加入你的 DSH 配置(web profile)即可启用。
READMEREADME
dsh-model-router
Model Router & Cost Optimizer for 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。
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 language.
- Direct quick-answer — when the user picks the quick option (or a quick answer is otherwise produced), the router rejects the step, runs a zero-prefix one-shot stream on the cheap model (no cache-miss tax), and writes the question + answer straight into the session log inside a step envelope — the user sees an ordinary Q&A exchange prefixed with a
⚡ 快速回答 / Quick answer · <model>marker (matched to the question language), the main model never runs for it, and no subagent sessions, relay cards, or toasts are created. The main session's model and prefix cache are never touched. - Vision-aware routing — messages carrying image blocks are routed to the catalog's image-capable model when one exists (e.g.
deepseek-v4-flash-vision-exp), including the quick-answer judge/stream; without an image-capable model they fall back to the main model instead of being answered blind on a text-only flash. - Model picker respected — the router never overrides the model chosen in the composer picker or via
selectModel, including relay/proxy providers (e.g.kabuai):agent/requestpasses the harness's requested config through unchanged, and quick answers always run on the session provider's own cheap model. (No drift healing — its original cause, a forgedrequest/header, was removed at the root in v0.9.2.) - Auto / off toggle — the dock panel and
/router auto|off(plus theroute_modeltool) simply enable or disable quick-answering for the session. There is no per-request model flipping to configure. - Automatic fallback — transient failures (
RATE_LIMIT,SERVER,TIMEOUT,EMPTY_RESPONSE) degrade the turn to the cheap model and retry once; anything else delegates to the provider's own retry policy. - Real usage metering — a session projection folds the durable log: real adapter token usage (input / output / cache read / cache write / reasoning), per-model breakdown, and estimated cost from a model-class price table. Projection-based, so the numbers are replay-safe and survive cold sessions.
- Composer dock panel (i18n zh/en) — Auto / 关闭 toggle, current model,
miss/out/cache%/≈$line, aQA×Nquick-answer counter (with a brief inline highlight on each direct answer), and a per-model usage breakdown. Reactively driven byuseProjection; the toggle reuses the built-incommandsremote — no custom wire protocol. UI strings are localized through the harnesslocaleservice.
Showing the opening section of the README — the full document lives in the repository以上为 README 开头摘要,完整文档在仓库内 · View the full README on GitHub →在 GitHub 查看完整 README →
Han-1413141/dsh-cost-meter
songoao25/dsh-bottom-info-bar
Jannchie/dsh-bill
jiay98528-dev/dsh-model-sync
linkingoscar/dsh-billing-glass