@peterwangze/claude-trigger-router 1.12.0 → 1.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -7
- package/config/trigger.smart-router.advanced.yaml +214 -0
- package/config/trigger.smart-router.yaml +21 -138
- package/dist/cli.js +358 -0
- package/dist/cli.js.map +4 -4
- package/docs/configuration-guide.md +7 -2
- package/docs/release-notes-v1.13.0.md +49 -0
- package/docs/releasing.md +10 -2
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -110,11 +110,14 @@ Router:
|
|
|
110
110
|
| `background` | Claude Code 轻量后台请求 |
|
|
111
111
|
| `webSearch` | 带 web search 工具的请求 |
|
|
112
112
|
|
|
113
|
+
基础路由的实际判断顺序是:显式上游模型 -> `longContext` 阈值 -> `background` -> `think` -> `webSearch` -> `default`。因此超长输入会先进入长上下文槽位;`background` 当前只识别 Claude Code 发出的 `claude-3-5-haiku*` 后台模型请求;如果请求模型已经是 `provider,model` 这类上游引用,基础槽位不会再覆盖。最终定模后还会执行 context window guard,如果已选模型放不下,会优先 fallback 到 `Router.longContext`。
|
|
114
|
+
|
|
113
115
|
可复制模板:
|
|
114
116
|
|
|
115
117
|
- [config/trigger.example.yaml](config/trigger.example.yaml):最小配置
|
|
116
118
|
- [config/trigger.routing.yaml](config/trigger.routing.yaml):基础路由五槽位
|
|
117
|
-
- [config/trigger.smart-router.yaml](config/trigger.smart-router.yaml):SmartRouter
|
|
119
|
+
- [config/trigger.smart-router.yaml](config/trigger.smart-router.yaml):SmartRouter 两模型起步模板
|
|
120
|
+
- [config/trigger.smart-router.advanced.yaml](config/trigger.smart-router.advanced.yaml):SmartRouter 多候选高级模板
|
|
118
121
|
- [config/trigger.advanced.yaml](config/trigger.advanced.yaml):高级治理示例
|
|
119
122
|
|
|
120
123
|
## SmartRouter
|
|
@@ -138,7 +141,7 @@ SmartRouter:
|
|
|
138
141
|
- `SmartRouter.rules` 负责能被关键词稳定识别的任务。
|
|
139
142
|
- `SmartRouter.candidates` 负责规则未命中时的智能兜底。
|
|
140
143
|
- `SmartRouter.routing_budget.latency_budget_ms` 和 `confidence_threshold` 用来控制速度/质量取舍。
|
|
141
|
-
- `SmartRouter.collaboration.mode` 可表达 `route_only`、`verify_only`、`compare_then_arbiter`、`cascade_on_evidence`
|
|
144
|
+
- `SmartRouter.collaboration.mode` 可表达 `route_only`、`verify_only`、`compare_then_arbiter`、`cascade_on_evidence` 这类策略 contract;当前默认仍是单模型 `route_only`,不会默认并发调用多个模型。
|
|
142
145
|
|
|
143
146
|
从 `v1.10.0` 开始,SmartRouter 会把真实 trace 中的质量、失败、延迟、cascade、shadow 和人工校准证据纳入候选模型画像,并在 route decision 中展示 `routingMode`、`collaborationMode` 和 `routingEvidence`。
|
|
144
147
|
|
|
@@ -146,10 +149,11 @@ SmartRouter:
|
|
|
146
149
|
|
|
147
150
|
```bash
|
|
148
151
|
ctr doctor
|
|
152
|
+
ctr doctor --route-preview --route-text "请做架构设计"
|
|
149
153
|
ctr ui
|
|
150
154
|
```
|
|
151
155
|
|
|
152
|
-
`ctr doctor`
|
|
156
|
+
`ctr doctor` 用来检查配置、服务启动、模型引用、上下文窗口、鉴权状态和可选模型探测。`--route-preview` 可以在不调用上游模型、不消耗额度的情况下预演当前请求会命中哪个槽位或 SmartRouter 路径;模型探测会消耗少量额度,所以会先征求确认。
|
|
153
157
|
|
|
154
158
|
`ctr ui` 默认打开:
|
|
155
159
|
|
|
@@ -218,14 +222,14 @@ ANTHROPIC_AUTH_TOKEN=<managed-key>
|
|
|
218
222
|
- 配置指南:[docs/configuration-guide.md](docs/configuration-guide.md)
|
|
219
223
|
- Models 迁移:[docs/models-migration-guide.md](docs/models-migration-guide.md)
|
|
220
224
|
- CLI 测试矩阵:[docs/cli-test-matrix.md](docs/cli-test-matrix.md)
|
|
221
|
-
- 发布说明:[docs/release-notes-v1.
|
|
225
|
+
- 发布说明:[docs/release-notes-v1.13.0.md](docs/release-notes-v1.13.0.md)
|
|
222
226
|
- 发布验证:[docs/releasing.md](docs/releasing.md)
|
|
223
227
|
|
|
224
|
-
## v1.
|
|
228
|
+
## v1.13.0 发布定位
|
|
225
229
|
|
|
226
|
-
`v1.
|
|
230
|
+
`v1.13.0` 是核心路由用户体感与看护补强版。它把重点放回基础路由和 SmartRouter 的日常体验:用户可以用 `ctr doctor --route-preview --route-text "..."` 在不调用上游模型的情况下预演请求会走哪个模型、为什么、是否可能因为 SmartRouter 候选选择增加首包等待。
|
|
227
231
|
|
|
228
|
-
|
|
232
|
+
这个版本还收口了 SmartRouter 两模型起步模板、基础路由触发顺序说明和协作模式口径:默认仍是单模型 `route_only`,不默认并发调用多个模型。完整发布边界见 [docs/release-notes-v1.13.0.md](docs/release-notes-v1.13.0.md)。
|
|
229
233
|
|
|
230
234
|
## License
|
|
231
235
|
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
# Claude Trigger Router SmartRouter advanced template
|
|
2
|
+
# 复制到 ~/.claude-trigger-router/config.yaml 后,先替换 API Key、模型名和本地模型地址。
|
|
3
|
+
# 这个模板面向已经跑通最小 SmartRouter 的用户,覆盖更多高频智能路由场景:
|
|
4
|
+
# coding / review / architecture / long context / fast reply。
|
|
5
|
+
# 如果你第一次启用 SmartRouter,请优先使用 config/trigger.smart-router.yaml。
|
|
6
|
+
|
|
7
|
+
HOST: "127.0.0.1"
|
|
8
|
+
PORT: 5678
|
|
9
|
+
|
|
10
|
+
LOG: true
|
|
11
|
+
LOG_LEVEL: "debug"
|
|
12
|
+
|
|
13
|
+
Models:
|
|
14
|
+
- id: sonnet
|
|
15
|
+
api: "https://openrouter.ai/api/v1/chat/completions"
|
|
16
|
+
key: "sk-xxx"
|
|
17
|
+
interface: "openai"
|
|
18
|
+
model: "anthropic/claude-sonnet-4"
|
|
19
|
+
thinking: "auto"
|
|
20
|
+
metadata:
|
|
21
|
+
context_window_tokens: 200000
|
|
22
|
+
safe_input_tokens: 180000
|
|
23
|
+
|
|
24
|
+
- id: reviewer
|
|
25
|
+
api: "https://openrouter.ai/api/v1/chat/completions"
|
|
26
|
+
key: "sk-xxx"
|
|
27
|
+
interface: "openai"
|
|
28
|
+
model: "anthropic/claude-sonnet-4"
|
|
29
|
+
thinking: "auto"
|
|
30
|
+
metadata:
|
|
31
|
+
context_window_tokens: 200000
|
|
32
|
+
safe_input_tokens: 180000
|
|
33
|
+
|
|
34
|
+
- id: architect
|
|
35
|
+
api: "https://openrouter.ai/api/v1/chat/completions"
|
|
36
|
+
key: "sk-xxx"
|
|
37
|
+
interface: "openai"
|
|
38
|
+
model: "anthropic/claude-opus-4"
|
|
39
|
+
thinking: "high"
|
|
40
|
+
metadata:
|
|
41
|
+
context_window_tokens: 200000
|
|
42
|
+
safe_input_tokens: 180000
|
|
43
|
+
|
|
44
|
+
- id: long_context
|
|
45
|
+
api: "https://openrouter.ai/api/v1/chat/completions"
|
|
46
|
+
key: "sk-xxx"
|
|
47
|
+
interface: "openai"
|
|
48
|
+
model: "google/gemini-2.5-pro"
|
|
49
|
+
thinking: "auto"
|
|
50
|
+
metadata:
|
|
51
|
+
context_window_tokens: 1000000
|
|
52
|
+
safe_input_tokens: 900000
|
|
53
|
+
|
|
54
|
+
- id: fast_background
|
|
55
|
+
api: "http://localhost:11434/v1/chat/completions"
|
|
56
|
+
key: "ollama"
|
|
57
|
+
interface: "openai"
|
|
58
|
+
model: "qwen2.5-coder:latest"
|
|
59
|
+
thinking: "off"
|
|
60
|
+
metadata:
|
|
61
|
+
context_window_tokens: 32000
|
|
62
|
+
safe_input_tokens: 24000
|
|
63
|
+
|
|
64
|
+
Router:
|
|
65
|
+
default: "sonnet"
|
|
66
|
+
think: "architect"
|
|
67
|
+
longContext: "long_context"
|
|
68
|
+
longContextThreshold: 60000
|
|
69
|
+
background: "fast_background"
|
|
70
|
+
webSearch: "sonnet"
|
|
71
|
+
|
|
72
|
+
SmartRouter:
|
|
73
|
+
enabled: true
|
|
74
|
+
analysis_scope: "last_message"
|
|
75
|
+
rules:
|
|
76
|
+
- name: "long_context"
|
|
77
|
+
priority: 95
|
|
78
|
+
enabled: true
|
|
79
|
+
description: "长文档、长上下文、全文总结或需要大窗口承载的请求"
|
|
80
|
+
patterns:
|
|
81
|
+
- type: exact
|
|
82
|
+
keywords:
|
|
83
|
+
- "长上下文"
|
|
84
|
+
- "长文档"
|
|
85
|
+
- "全文总结"
|
|
86
|
+
- "large context"
|
|
87
|
+
- "long context"
|
|
88
|
+
- type: regex
|
|
89
|
+
pattern: "(长上下文|长文档|全文总结|long context|large context)"
|
|
90
|
+
model: "long_context"
|
|
91
|
+
semantic_profile:
|
|
92
|
+
prototype: "长文档 长上下文 全文 总结 大窗口 large context long document"
|
|
93
|
+
|
|
94
|
+
- name: "architecture"
|
|
95
|
+
priority: 90
|
|
96
|
+
enabled: true
|
|
97
|
+
description: "架构设计、系统设计、技术方案和模块拆分"
|
|
98
|
+
patterns:
|
|
99
|
+
- type: exact
|
|
100
|
+
keywords:
|
|
101
|
+
- "架构设计"
|
|
102
|
+
- "系统设计"
|
|
103
|
+
- "技术方案"
|
|
104
|
+
- "模块拆分"
|
|
105
|
+
- "architecture"
|
|
106
|
+
- "system design"
|
|
107
|
+
- type: regex
|
|
108
|
+
pattern: "(架构|系统设计|技术方案|模块拆分|architecture|system design)"
|
|
109
|
+
model: "architect"
|
|
110
|
+
semantic_profile:
|
|
111
|
+
prototype: "架构 系统设计 技术方案 模块边界 演进路线 architecture system design"
|
|
112
|
+
|
|
113
|
+
- name: "review"
|
|
114
|
+
priority: 80
|
|
115
|
+
enabled: true
|
|
116
|
+
description: "代码审查、风险检查、安全检查和回归风险评估"
|
|
117
|
+
patterns:
|
|
118
|
+
- type: exact
|
|
119
|
+
keywords:
|
|
120
|
+
- "代码审查"
|
|
121
|
+
- "code review"
|
|
122
|
+
- "review code"
|
|
123
|
+
- "检查代码"
|
|
124
|
+
- "安全风险"
|
|
125
|
+
- "回归风险"
|
|
126
|
+
- type: regex
|
|
127
|
+
pattern: "(代码|code).{0,8}(审查|review|检查|审核)"
|
|
128
|
+
model: "reviewer"
|
|
129
|
+
semantic_profile:
|
|
130
|
+
prototype: "代码审查 风险 安全 回归 regression review bug finding"
|
|
131
|
+
|
|
132
|
+
- name: "coding"
|
|
133
|
+
priority: 70
|
|
134
|
+
enabled: true
|
|
135
|
+
description: "实现功能、修复 bug、重构代码和补测试"
|
|
136
|
+
patterns:
|
|
137
|
+
- type: exact
|
|
138
|
+
keywords:
|
|
139
|
+
- "实现"
|
|
140
|
+
- "写代码"
|
|
141
|
+
- "修复 bug"
|
|
142
|
+
- "补测试"
|
|
143
|
+
- "implement"
|
|
144
|
+
- "refactor"
|
|
145
|
+
- "feature"
|
|
146
|
+
- type: regex
|
|
147
|
+
pattern: "(实现|编写|修复|重构|补测试|implement|refactor|feature|bug)"
|
|
148
|
+
model: "sonnet"
|
|
149
|
+
semantic_profile:
|
|
150
|
+
prototype: "实现 功能 修复 bug 重构 单元测试 编程 coding implementation"
|
|
151
|
+
|
|
152
|
+
- name: "fast_reply"
|
|
153
|
+
priority: 10
|
|
154
|
+
enabled: true
|
|
155
|
+
description: "简单问题、快速答复、短答案和低成本后台任务"
|
|
156
|
+
patterns:
|
|
157
|
+
- type: exact
|
|
158
|
+
keywords:
|
|
159
|
+
- "快速回答"
|
|
160
|
+
- "简单回答"
|
|
161
|
+
- "不用详细"
|
|
162
|
+
- "quick"
|
|
163
|
+
- "short answer"
|
|
164
|
+
- "simple"
|
|
165
|
+
- type: regex
|
|
166
|
+
pattern: "(快速回答|简单回答|不用详细|quick|short answer|simple)"
|
|
167
|
+
model: "fast_background"
|
|
168
|
+
semantic_profile:
|
|
169
|
+
prototype: "快速 简单 短答案 低成本 fast quick short answer simple"
|
|
170
|
+
|
|
171
|
+
router_model: "sonnet"
|
|
172
|
+
candidates:
|
|
173
|
+
- model: "sonnet"
|
|
174
|
+
description: "通用 coding、日常调试、多轮任务和默认 Claude Code 体验"
|
|
175
|
+
- model: "reviewer"
|
|
176
|
+
description: "代码审查、风险识别、安全检查和回归影响判断"
|
|
177
|
+
- model: "architect"
|
|
178
|
+
description: "架构设计、系统方案、复杂权衡和高质量长推理"
|
|
179
|
+
- model: "long_context"
|
|
180
|
+
description: "长文档、超长上下文、全文总结和大规格输入"
|
|
181
|
+
- model: "fast_background"
|
|
182
|
+
description: "快速短答、低成本后台任务和简单重复问题"
|
|
183
|
+
cache_ttl: 600000
|
|
184
|
+
max_tokens: 256
|
|
185
|
+
fallback: "default"
|
|
186
|
+
router_hint:
|
|
187
|
+
include_task_summary: true
|
|
188
|
+
include_top_route_candidates: true
|
|
189
|
+
|
|
190
|
+
sticky:
|
|
191
|
+
enabled: true
|
|
192
|
+
session_ttl_ms: 3600000
|
|
193
|
+
fingerprint_similarity_threshold: 0.82
|
|
194
|
+
break_on_explicit_route: true
|
|
195
|
+
# Claude Code 的请求本身会携带会话上下文。
|
|
196
|
+
# 只有明确需要跨模型交接摘要,并接受额外 summarizer 调用时,再开启 alignment。
|
|
197
|
+
alignment:
|
|
198
|
+
enabled: false
|
|
199
|
+
summarizer_model: "sonnet"
|
|
200
|
+
max_summary_tokens: 256
|
|
201
|
+
|
|
202
|
+
semantic:
|
|
203
|
+
enabled: true
|
|
204
|
+
mode: "embedding"
|
|
205
|
+
threshold: 0.2
|
|
206
|
+
prototypes:
|
|
207
|
+
coding: "实现 功能 修复 bug 重构 单元测试 编程 coding implementation"
|
|
208
|
+
review: "代码审查 风险 安全 回归 regression review bug finding"
|
|
209
|
+
architecture: "架构 系统设计 技术方案 模块边界 演进路线 architecture system design"
|
|
210
|
+
long_context: "长文档 长上下文 全文 总结 大窗口 large context long document"
|
|
211
|
+
fast_reply: "快速 简单 短答案 低成本 fast quick short answer simple"
|
|
212
|
+
|
|
213
|
+
Governance:
|
|
214
|
+
enabled: true
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
# Claude Trigger Router SmartRouter
|
|
2
|
-
# 复制到 ~/.claude-trigger-router/config.yaml 后,先替换 API Key
|
|
3
|
-
#
|
|
4
|
-
#
|
|
1
|
+
# Claude Trigger Router SmartRouter starter template
|
|
2
|
+
# 复制到 ~/.claude-trigger-router/config.yaml 后,先替换 API Key 和上游模型名。
|
|
3
|
+
# 这个模板只需要两个模型:默认模型 + 复杂任务模型。
|
|
4
|
+
# 更多候选、semantic/sticky/governance 和本地 fast model 见 config/trigger.smart-router.advanced.yaml。
|
|
5
5
|
|
|
6
6
|
HOST: "127.0.0.1"
|
|
7
7
|
PORT: 5678
|
|
@@ -20,76 +20,26 @@ Models:
|
|
|
20
20
|
context_window_tokens: 200000
|
|
21
21
|
safe_input_tokens: 180000
|
|
22
22
|
|
|
23
|
-
- id:
|
|
24
|
-
api: "https://
|
|
25
|
-
key: "sk-xxx"
|
|
26
|
-
interface: "openai"
|
|
27
|
-
model: "anthropic/claude-sonnet-4"
|
|
28
|
-
thinking: "auto"
|
|
29
|
-
metadata:
|
|
30
|
-
context_window_tokens: 200000
|
|
31
|
-
safe_input_tokens: 180000
|
|
32
|
-
|
|
33
|
-
- id: architect
|
|
34
|
-
api: "https://openrouter.ai/api/v1/chat/completions"
|
|
23
|
+
- id: reasoner
|
|
24
|
+
api: "https://api.deepseek.com/chat/completions"
|
|
35
25
|
key: "sk-xxx"
|
|
36
26
|
interface: "openai"
|
|
37
|
-
model: "
|
|
27
|
+
model: "deepseek-reasoner"
|
|
38
28
|
thinking: "high"
|
|
39
29
|
metadata:
|
|
40
|
-
context_window_tokens:
|
|
41
|
-
safe_input_tokens:
|
|
42
|
-
|
|
43
|
-
- id: long_context
|
|
44
|
-
api: "https://openrouter.ai/api/v1/chat/completions"
|
|
45
|
-
key: "sk-xxx"
|
|
46
|
-
interface: "openai"
|
|
47
|
-
model: "google/gemini-2.5-pro"
|
|
48
|
-
thinking: "auto"
|
|
49
|
-
metadata:
|
|
50
|
-
context_window_tokens: 1000000
|
|
51
|
-
safe_input_tokens: 900000
|
|
52
|
-
|
|
53
|
-
- id: fast_background
|
|
54
|
-
api: "http://localhost:11434/v1/chat/completions"
|
|
55
|
-
key: "ollama"
|
|
56
|
-
interface: "openai"
|
|
57
|
-
model: "qwen2.5-coder:latest"
|
|
58
|
-
thinking: "off"
|
|
59
|
-
metadata:
|
|
60
|
-
context_window_tokens: 32000
|
|
61
|
-
safe_input_tokens: 24000
|
|
30
|
+
context_window_tokens: 64000
|
|
31
|
+
safe_input_tokens: 56000
|
|
62
32
|
|
|
63
33
|
Router:
|
|
64
34
|
default: "sonnet"
|
|
65
|
-
think: "
|
|
66
|
-
longContext: "
|
|
35
|
+
think: "reasoner"
|
|
36
|
+
longContext: "sonnet"
|
|
67
37
|
longContextThreshold: 60000
|
|
68
|
-
background: "fast_background"
|
|
69
|
-
webSearch: "sonnet"
|
|
70
38
|
|
|
71
39
|
SmartRouter:
|
|
72
40
|
enabled: true
|
|
73
41
|
analysis_scope: "last_message"
|
|
74
42
|
rules:
|
|
75
|
-
- name: "long_context"
|
|
76
|
-
priority: 95
|
|
77
|
-
enabled: true
|
|
78
|
-
description: "长文档、长上下文、全文总结或需要大窗口承载的请求"
|
|
79
|
-
patterns:
|
|
80
|
-
- type: exact
|
|
81
|
-
keywords:
|
|
82
|
-
- "长上下文"
|
|
83
|
-
- "长文档"
|
|
84
|
-
- "全文总结"
|
|
85
|
-
- "large context"
|
|
86
|
-
- "long context"
|
|
87
|
-
- type: regex
|
|
88
|
-
pattern: "(长上下文|长文档|全文总结|long context|large context)"
|
|
89
|
-
model: "long_context"
|
|
90
|
-
semantic_profile:
|
|
91
|
-
prototype: "长文档 长上下文 全文 总结 大窗口 large context long document"
|
|
92
|
-
|
|
93
43
|
- name: "architecture"
|
|
94
44
|
priority: 90
|
|
95
45
|
enabled: true
|
|
@@ -100,12 +50,11 @@ SmartRouter:
|
|
|
100
50
|
- "架构设计"
|
|
101
51
|
- "系统设计"
|
|
102
52
|
- "技术方案"
|
|
103
|
-
- "模块拆分"
|
|
104
53
|
- "architecture"
|
|
105
54
|
- "system design"
|
|
106
55
|
- type: regex
|
|
107
|
-
pattern: "(
|
|
108
|
-
model: "
|
|
56
|
+
pattern: "(架构|系统设计|技术方案|architecture|system design)"
|
|
57
|
+
model: "reasoner"
|
|
109
58
|
semantic_profile:
|
|
110
59
|
prototype: "架构 系统设计 技术方案 模块边界 演进路线 architecture system design"
|
|
111
60
|
|
|
@@ -119,95 +68,29 @@ SmartRouter:
|
|
|
119
68
|
- "代码审查"
|
|
120
69
|
- "code review"
|
|
121
70
|
- "review code"
|
|
122
|
-
- "
|
|
123
|
-
- "安全风险"
|
|
124
|
-
- "回归风险"
|
|
71
|
+
- "风险评估"
|
|
125
72
|
- type: regex
|
|
126
73
|
pattern: "(代码|code).{0,8}(审查|review|检查|审核)"
|
|
127
|
-
model: "
|
|
74
|
+
model: "reasoner"
|
|
128
75
|
semantic_profile:
|
|
129
76
|
prototype: "代码审查 风险 安全 回归 regression review bug finding"
|
|
130
77
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
enabled: true
|
|
134
|
-
description: "实现功能、修复 bug、重构代码和补测试"
|
|
135
|
-
patterns:
|
|
136
|
-
- type: exact
|
|
137
|
-
keywords:
|
|
138
|
-
- "实现"
|
|
139
|
-
- "写代码"
|
|
140
|
-
- "修复 bug"
|
|
141
|
-
- "补测试"
|
|
142
|
-
- "implement"
|
|
143
|
-
- "refactor"
|
|
144
|
-
- "feature"
|
|
145
|
-
- type: regex
|
|
146
|
-
pattern: "(实现|编写|修复|重构|补测试|implement|refactor|feature|bug)"
|
|
147
|
-
model: "sonnet"
|
|
148
|
-
semantic_profile:
|
|
149
|
-
prototype: "实现 功能 修复 bug 重构 单元测试 编程 coding implementation"
|
|
150
|
-
|
|
151
|
-
- name: "fast_reply"
|
|
152
|
-
priority: 10
|
|
153
|
-
enabled: true
|
|
154
|
-
description: "简单问题、快速答复、短答案和低成本后台任务"
|
|
155
|
-
patterns:
|
|
156
|
-
- type: exact
|
|
157
|
-
keywords:
|
|
158
|
-
- "快速回答"
|
|
159
|
-
- "简单回答"
|
|
160
|
-
- "不用详细"
|
|
161
|
-
- "quick"
|
|
162
|
-
- "short answer"
|
|
163
|
-
- "simple"
|
|
164
|
-
- type: regex
|
|
165
|
-
pattern: "(快速回答|简单回答|不用详细|quick|short answer|simple)"
|
|
166
|
-
model: "fast_background"
|
|
167
|
-
semantic_profile:
|
|
168
|
-
prototype: "快速 简单 短答案 低成本 fast quick short answer simple"
|
|
169
|
-
|
|
78
|
+
# 规则未命中时,真实请求会先调用 router_model 选择候选模型。
|
|
79
|
+
# 如果你希望首包更快,可以先删除 router_model/candidates,只保留上面的 rules。
|
|
170
80
|
router_model: "sonnet"
|
|
171
81
|
candidates:
|
|
172
82
|
- model: "sonnet"
|
|
173
83
|
description: "通用 coding、日常调试、多轮任务和默认 Claude Code 体验"
|
|
174
|
-
- model: "
|
|
175
|
-
description: "
|
|
176
|
-
- model: "architect"
|
|
177
|
-
description: "架构设计、系统方案、复杂权衡和高质量长推理"
|
|
178
|
-
- model: "long_context"
|
|
179
|
-
description: "长文档、超长上下文、全文总结和大规格输入"
|
|
180
|
-
- model: "fast_background"
|
|
181
|
-
description: "快速短答、低成本后台任务和简单重复问题"
|
|
84
|
+
- model: "reasoner"
|
|
85
|
+
description: "架构设计、代码审查、复杂推理和严谨分析"
|
|
182
86
|
cache_ttl: 600000
|
|
183
|
-
max_tokens:
|
|
87
|
+
max_tokens: 192
|
|
184
88
|
fallback: "default"
|
|
185
89
|
router_hint:
|
|
186
90
|
include_task_summary: true
|
|
187
91
|
include_top_route_candidates: true
|
|
188
92
|
|
|
189
|
-
sticky:
|
|
190
|
-
enabled: true
|
|
191
|
-
session_ttl_ms: 3600000
|
|
192
|
-
fingerprint_similarity_threshold: 0.82
|
|
193
|
-
break_on_explicit_route: true
|
|
194
|
-
# Claude Code 的请求本身会携带会话上下文。
|
|
195
|
-
# 只有明确需要跨模型交接摘要,并接受额外 summarizer 调用时,再开启 alignment。
|
|
196
|
-
alignment:
|
|
197
|
-
enabled: false
|
|
198
|
-
summarizer_model: "sonnet"
|
|
199
|
-
max_summary_tokens: 256
|
|
200
|
-
|
|
201
93
|
semantic:
|
|
202
94
|
enabled: true
|
|
203
95
|
mode: "embedding"
|
|
204
|
-
threshold: 0.
|
|
205
|
-
prototypes:
|
|
206
|
-
coding: "实现 功能 修复 bug 重构 单元测试 编程 coding implementation"
|
|
207
|
-
review: "代码审查 风险 安全 回归 regression review bug finding"
|
|
208
|
-
architecture: "架构 系统设计 技术方案 模块边界 演进路线 architecture system design"
|
|
209
|
-
long_context: "长文档 长上下文 全文 总结 大窗口 large context long document"
|
|
210
|
-
fast_reply: "快速 简单 短答案 低成本 fast quick short answer simple"
|
|
211
|
-
|
|
212
|
-
Governance:
|
|
213
|
-
enabled: true
|
|
96
|
+
threshold: 0.25
|