- Inicio
- Plugins
- Modelos y proveedores
- dsh-reasoning-adapter
dsh-reasoning-adapter
hatiaa/dsh-reasoning-adapter
Gives hand-declared models on custom or relay routes a vendor-matched reasoning-effort picker: detects Claude, GPT, DeepSeek, GLM, Kimi, Qwen, Gemini, Grok, Doubao or MiMo from the model id, display name or endpoint host, fills in only the levels that vendor accepts plus the pi-ai compat fields its request format needs, and writes them into the profile config so the Models page reasoning switch turns on. Models you edit or switch off are left alone, and a Models page card hands them back on request.
Instalar
dsh plugin --profile web add github:hatiaa/dsh-reasoning-adapterREADME
dsh-reasoning-adapter
中文 | English
DeepSeek Harness 插件:让中转站 / 自建网关 / 算力平台上的模型,也能在对话框里选推理等级。
官方路由的模型自带推理元数据,选择器里有档位行。自己添加的路由只有 api、baseURL 和一串模型 id,
DSH 不知道这些模型支持哪些档位、该发什么字段,于是档位行不显示;手动打开「模型设置」里的推理开关,
得到的是通用的 off / low / medium / high,换成 GLM、Kimi、Claude 这类模型,要么缺档位,要么请求被服务端拒绝。
这个插件根据模型名认出厂商,填入这家模型真正接受的档位和对应的请求字段, 并把结果写进你的配置,「模型设置」页的推理开关会自动打开。装上即生效,不需要配置。
效果
| 模型 id | 路由协议(api) | 选择器档位 | 请求里发送 |
|---|---|---|---|
claude-opus-5.5、cl-op-5.5 | anthropic-messages | low / medium / high / xhigh / max | thinking: {type: adaptive} + output_config.effort |
DeepSeek-V4.1-Flash-1017 | openai-completions | off / low / high / max | thinking + reasoning_effort,工具循环回放 reasoning_content |
deepseek-v4.1-flash | anthropic-messages | off / high | thinking: {type: enabled, budget_tokens} |
GLM-5.3 | openai-completions | low / high / max | thinking(Z.ai 格式)+ reasoning_effort |
Kimi-K3.1-Pro-HighSpeed | openai-completions | low / high / max | reasoning_effort,工具循环回放 reasoning_content |
qwen3.8-max | openai-completions | low / medium / xhigh | enable_thinking + reasoning_effort |
gpt-6.1-sol | openai-completions | low / medium / high / xhigh / max | reasoning_effort |
gemini-3.5-flash | openai-completions | minimal / low / medium / high | reasoning_effort |
my-private-model | 任意 | 不改动 | — |
同一个模型走不同协议,档位可能不同,以上只是举例。全部 28 种组合(含线上值和 compat 字段) 见 docs/levels.md,该表由代码生成,CI 校验它与代码一致。
覆盖的厂商:Claude、GPT、DeepSeek、GLM、Kimi、Qwen、Gemini、Grok、豆包、MiMo。
厂商识别依次看模型 id、显示名、关键词模糊匹配(容忍 claud、deepsek 这类拼写),最后看接口域名;
deepseek/deepseek-v4-pro 这种带前缀的 id 和 cl-op-5.5 这种中转站缩写也能认。
认不出的模型不会被改动:猜错档位会让请求直接失败,不如保持原样。
安装
需要 DeepSeek Harness 0.2.x(dsh --version 查看)。插件声明了 engines.dsh: ^0.2.0-0,
版本不符时 DSH 会拒绝安装。
# 桌面版
dsh plugin --profile desktop add dsh-reasoning-adapter
# Web 版
dsh plugin --profile web add dsh-reasoning-adapter
装好后重启 DSH。
确认是否生效:打开对话框的模型选择器,切到一个自定义路由的模型,看是否出现推理等级行; 或者打开「设置 → 模型」,这些模型的推理开关应该已经打开,档位与上表一致。
工作方式
插件分两层工作:
- 运行时匹配:DSH 每次加载模型配置时,插件给自定义路由上的模型补上档位和 compat 字段。 这一层只在内存里生效,不改文件。插件启用后,选择器立刻出现档位。
- 写回配置:大约一秒后,插件通过 DSH 自带的配置编辑器(与「模型设置」页保存时走同一个接口: 加锁、校验、失败回滚)把同样的档位写进 profile 配置。这样「模型设置」页的开关显示为打开, 即使以后停用或卸载插件,档位也会保留。
只处理同时写了 api 和 baseURL 的路由,官方目录路由不改。新添加的模型或路由会在保存后自动匹配。
不想让插件写配置文件,把 writeConfig 设为 false,只保留运行时匹配。
你的设置优先
插件按模型记录自己写过什么(<profile>/.dsh-reasoning-adapter/auto-match.json),判断哪些模型由你管理:
| 你做了什么 | 插件的处理 |
|---|---|
| 新加了一个模型 | 识别厂商,写入档位,开关自动打开 |
| 在「模型设置」里打开开关(生成了默认的 off/low/medium/high) | 替换为该厂商的真实档位,之后由插件管理 |
| 手动改过某个模型的档位 | 视为你在管理,不再写入;你的档位原样使用,只补充你没写的 compat 字段 |
| 关掉了某个模型的开关 | 不再打开,选择器里也不显示这个模型的档位 |
| 删除了某个模型 | 清掉对应记录,之后重新添加会当作新模型 |
交回插件:「用插件档位覆写」
「设置 → 模型」里每个自定义路由的卡片下方有一块「推理等级(dsh-reasoning-adapter)」, 列出这条路由上每个模型的状态(已自动匹配 / 已关闭 / 手动设置 / 未识别厂商……)。
对于已关闭或手动设置过的模型,旁边有 用插件档位覆写 按钮:点一下,插件立即把该厂商的档位写进配置, 开关重新打开,此后这个模型重新由插件管理。鼠标悬停在按钮上可以看到将要写入的档位。 一条路由上有多个这样的模型时,还会出现 全部交回插件。
识别不出厂商的模型没有这个按钮,因为插件不知道该写什么;请先用 overrides 指定厂商。
writeConfig: false 时这块只显示状态,不提供按钮。
配置
默认配置适合大多数情况。需要调整时,编辑 ~/.dsh/profiles/<profile>/cordis.patch.yml,
添加一条按 id 覆盖的配置(不要另写一条 insert),只写需要改的项:
- id: reasoning-adapter
config:
writeConfig: false
| 选项 | 默认值 | 说明 |
|---|---|---|
enabled | true | 总开关 |
writeConfig | true | 是否把匹配结果写进 profile 配置 |
replaceSettingsTemplate | true | 是否把「模型设置」开关生成的默认档位替换成厂商真实档位 |
fixCompat | true | 是否补充 compat 字段(adaptive thinking、reasoning_content 回放、非 OpenAI 厂商用 system 而不是 developer 角色等) |
keepCommonLevels | false | 设为 true 后,厂商缺少的 low / medium / high 也会显示,并映射到最接近的真实档位 |
defaultEffort | high | 路由默认档位。只有该路由所有模型都支持这一档时才设置,且只在运行时生效,不写进配置 |
anthropicAdaptiveVendors | [] | 声明哪些厂商的 Anthropic 兼容接口支持 adaptive thinking(如 [deepseek, glm]),这些厂商在该协议下会获得更多档位 |
overrides | {} | 针对单个模型的规则,见下文 |
overrides
键是 glob(* 通配,不区分大小写),匹配 路由/模型id 或 模型id,按顺序取第一条命中的规则:
- id: reasoning-adapter
config:
overrides:
# 认不出的模型:指定厂商,档位和字段按该厂商规则生成
"my-relay/my-llm": { vendor: deepseek }
# 直接写死档位和 compat
"*my-model*": { reasoningEfforts: { off: null, high: high }, compat: { thinkingFormat: qwen } }
# 不让插件处理这个模型
"some-relay/some-model": { skip: true }
vendor 可选值:claude openai deepseek glm kimi qwen gemini grok doubao mimo minimax。
验证情况
在 DSH 0.2.1-rc.5(Windows)上,通过两个中转站对 11 个模型做了实测:每个模型以默认档位完成一次带工具调用的往返, 同时抓取请求体,检查推理字段:
- ✅
openai-completions:DeepSeek V4.1 Flash、GLM-5.3、GLM-5.3-FlashX、Kimi K3.1,推理字段正确,reasoning_content正确回放,system 消息以system角色发送; - ✅
anthropic-messages:三个 Claude 模型(Opus / Sonnet 5.5、Fable 5.1;adaptive +output_config.effort)、DeepSeek V4 Pro / V4.1 Flash(budget_tokens);
Qwen、Gemini、Grok、豆包、MiMo,以及经 openai-completions 访问 GPT/Claude 的规则,依据 DSH 内置模型目录的元数据编写,
未实测。如果你实际使用中发现档位不对,欢迎提 issue 或 PR。
排查
插件把诊断信息写到 ~/.dsh/profiles/<profile>/.dsh-reasoning-adapter/status.json(每个 profile 单独一份):
reports:每个模型识别出的厂商、依据(id / 显示名 / 模糊匹配 / 域名)、档位、补充的 compat;models:DSH 实际提供给选择器的档位和默认档位;match:写回配置的结果。wrote: true表示这次写入了,reason: "already matched"表示配置已经一致,无需写入;其他reason是失败原因,此时档位仍由运行时匹配提供。
提 issue 时附上这个文件,能大大加快定位。
卸载
dsh plugin --profile <profile> remove dsh-reasoning-adapter
已经写进配置的档位会保留,模型继续按这些档位工作。如果不需要,在「设置 → 模型」里关掉对应开关即可。
插件的记录目录 ~/.dsh/profiles/<profile>/.dsh-reasoning-adapter/ 可以直接删除。
开发
不需要构建,没有运行时依赖。测试使用 Node 内置的测试运行器(Node 20+):
npm test # 单元测试:厂商识别、档位规则、compat 过滤、写回逻辑
npm run check # 语法检查 + 单元测试
npm run matrix # 根据 rules.js 重新生成 docs/levels.md
在 DSH 里调试本地代码:dsh plugin --profile <profile> add link:/绝对路径/dsh-reasoning-adapter,
修改后在插件管理里关闭再打开插件即可重新加载。
新增厂商或修正档位的步骤见 CONTRIBUTING.md,安全问题见 SECURITY.md。
许可证
MIT © HatiaaYu
Plugins relacionados
dsh-our-free-model
ebony-vinyl/dsh-our-free-model
dsh-routing-suite
yjh051108/dsh-routing-suite
dsh-connect-workbuddy
dingminhua/dsh-connect-workbuddy
dsh-workbuddy-connect
corrinehu/dsh-workbuddy-connect