4060415/Deepseek-harness-routing-layer- ↗★ 1
8kinfe-llm-router
适用于 DeepSeek Harness 的可配置能力型模型路由器:对每个请求进行分类并选择最佳的已注册模型,支持视觉/代码路由、回退及受限升级。
AI 分析
适合在 DSH 中注册了多个模型并希望自动分流任务的用户。根据任务类型(如代码、视觉)自动切换最合适的模型,支持失败回退。
安装
此插件尚未提供可验证的 bundle,或兼容性检查未通过。请先阅读仓库说明。 阅读完整 README ↗
说明文档
阅读完整 README ↗第 2 步:挂载 + 最小配置
编辑该 profile 的 cordis.patch.yml:
- id: llm-router
name: '8kinfe-llm-router'
config:
mode: auto
preferred:
provider: deepseek-official
model: deepseek-v4-flash
启动 dsh 即可工作:普通聊天走 preferred,遇到图片 / 代码等任务会自动切换模型。
配置参考
插件入口(cordis.patch.yml)
- id: llm-router
name: '8kinfe-llm-router'
config:
mode: auto
costPolicy: balanced
maxEscalations: 2
preferred:
provider: deepseek-official
model: deepseek-v4-flash
models:
# key = "provider/model",替换成你实际的 provider / model
deepseek-official/deepseek-v4-flash:
coding: 0.6
reasoning: 0.6
vision: 0
cost: 1
latency: 1
context: 128000
moonshotai-cn/kimi-k2.6:
coding: 0.5
reasoning: 0.7
vision: 1
cost: 3
latency: 2
context: 128000
配置项(llm-router settings namespace,支持热重载)
| 字段 | 类型 | 默认 | 说明 |
|---|---|---|---|
enabled | boolean | true | 总开关,关闭后 Router 完全惰性 |
mode | auto | manual | auto | manual 时永不改写调用方的选择 |
debug | boolean | false | 输出选型解释日志 |
costPolicy | quality_first | balanced | cost_first | speed_first | balanced | 成本 / 延迟姿态 |
maxEscalations | number | 2 | 每个 agent 自动升级次数上限 |
preferred | {provider, model} | — | auto 模式下 simple_chat 的偏好模型 |
models | dict | {} | 能力元数据,key 为 provider/model |
weights | object | 见下 | 评分权重 |
escalation | object | 见下 | 升级触发条件 |
fallback | object | 见下 | 失败降级映射 |
models 条目字段(均可选,缺省取中性值):
| 字段 | 类型 | 说明 |
|---|---|---|
coding / reasoning / vision / toolCalling | 0..1 | 能力强度 |
context | number | 上下文窗口 token 数 |
cost | 1..5 | 成本(1 最便宜) |
latency | 1..5 | 延迟(1 最快) |
vision未配置时,从适配器报告的inputModalities是否含image自动推断。
weights 默认:
capability: 1
cost: 0.3
latency: 0.3
context: 0.2
toolCalling: 0.2
escalation 默认(能力不足触发升级):
enabled: true
triggerCodes: [EMPTY_RESPONSE, CONTEXT_WINDOW_EXCEEDED]
fallback 默认(临时 / 资源错误触发换模型):
enabled: true
routes: {} # 可显式指定 code -> {provider, model}
配置项(llm-router settings namespace,支持热重载)
| 字段 | 类型 | 默认 | 说明 |
|---|---|---|---|
enabled | boolean | true | 总开关,关闭后 Router 完全惰性 |
mode | auto | manual | auto | manual 时永不改写调用方的选择 |
debug | boolean | false | 输出选型解释日志 |
costPolicy | quality_first | balanced | cost_first | speed_first | balanced | 成本 / 延迟姿态 |
maxEscalations | number | 2 | 每个 agent 自动升级次数上限 |
preferred | {provider, model} | — | auto 模式下 simple_chat 的偏好模型 |
models | dict | {} | 能力元数据,key 为 provider/model |
weights | object | 见下 | 评分权重 |
escalation | object | 见下 | 升级触发条件 |
fallback | object | 见下 | 失败降级映射 |
models 条目字段(均可选,缺省取中性值):
| 字段 | 类型 | 说明 |
|---|---|---|
coding / reasoning / vision / toolCalling | 0..1 | 能力强度 |
context | number | 上下文窗口 token 数 |
cost | 1..5 | 成本(1 最便宜) |
latency | 1..5 | 延迟(1 最快) |
vision未配置时,从适配器报告的inputModalities是否含image自动推断。
weights 默认:
capability: 1
cost: 0.3
latency: 0.3
context: 0.2
toolCalling: 0.2
escalation 默认(能力不足触发升级):
enabled: true
triggerCodes: [EMPTY_RESPONSE, CONTEXT_WINDOW_EXCEEDED]
fallback 默认(临时 / 资源错误触发换模型):
enabled: true
routes: {} # 可显式指定 code -> {provider, model}