@musistudio/claude-code-router 1.0.30 → 1.0.32
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 +47 -1
- package/README_zh.md +46 -1
- package/dist/cli.js +6420 -7029
- package/dist/index.html +37 -37
- package/docker-compose.yml +3 -6
- package/dockerfile +16 -4
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -141,6 +141,16 @@ Here is a comprehensive example:
|
|
|
141
141
|
"enhancetool"
|
|
142
142
|
]
|
|
143
143
|
}
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
"name": "aihubmix",
|
|
147
|
+
"api_base_url": "https://aihubmix.com/v1/chat/completions",
|
|
148
|
+
"api_key": "sk-",
|
|
149
|
+
"models": [
|
|
150
|
+
"Z/glm-4.5",
|
|
151
|
+
"claude-opus-4-20250514",
|
|
152
|
+
"gemini-2.5-pro"
|
|
153
|
+
]
|
|
144
154
|
}
|
|
145
155
|
],
|
|
146
156
|
"Router": {
|
|
@@ -178,6 +188,8 @@ ccr ui
|
|
|
178
188
|
|
|
179
189
|
This will open a web-based interface where you can easily view and edit your `config.json` file.
|
|
180
190
|
|
|
191
|
+

|
|
192
|
+
|
|
181
193
|
> **Note**: The UI mode is currently in beta. 100% vibe coding: including project initialization, I just created a folder and a project.md document, and all code was generated by ccr + qwen3-coder + gemini(webSearch).
|
|
182
194
|
If you encounter any issues, please submit an issue on GitHub.
|
|
183
195
|
|
|
@@ -246,9 +258,27 @@ Transformers allow you to modify the request and response payloads to ensure com
|
|
|
246
258
|
|
|
247
259
|
**Available Built-in Transformers:**
|
|
248
260
|
|
|
261
|
+
- `Anthropic`:If you use only the `Anthropic` transformer, it will preserve the original request and response parameters(you can use it to connect directly to an Anthropic endpoint).
|
|
249
262
|
- `deepseek`: Adapts requests/responses for DeepSeek API.
|
|
250
263
|
- `gemini`: Adapts requests/responses for Gemini API.
|
|
251
|
-
- `openrouter`: Adapts requests/responses for OpenRouter API.
|
|
264
|
+
- `openrouter`: Adapts requests/responses for OpenRouter API. It can also accept a `provider` routing parameter to specify which underlying providers OpenRouter should use. For more details, refer to the [OpenRouter documentation](https://openrouter.ai/docs/features/provider-routing). See an example below:
|
|
265
|
+
```json
|
|
266
|
+
"transformer": {
|
|
267
|
+
"use": ["openrouter"],
|
|
268
|
+
"moonshotai/kimi-k2": {
|
|
269
|
+
"use": [
|
|
270
|
+
[
|
|
271
|
+
"openrouter",
|
|
272
|
+
{
|
|
273
|
+
"provider": {
|
|
274
|
+
"only": ["moonshotai/fp8"]
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
]
|
|
278
|
+
]
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
```
|
|
252
282
|
- `groq`: Adapts requests/responses for groq API.
|
|
253
283
|
- `maxtoken`: Sets a specific `max_tokens` value.
|
|
254
284
|
- `tooluse`: Optimizes tool usage for certain models via `tool_choice`.
|
|
@@ -330,6 +360,17 @@ module.exports = async function router(req, config) {
|
|
|
330
360
|
};
|
|
331
361
|
```
|
|
332
362
|
|
|
363
|
+
##### Subagent Routing
|
|
364
|
+
|
|
365
|
+
For routing within subagents, you must specify a particular provider and model by including `<CCR-SUBAGENT-MODEL>provider,model</CCR-SUBAGENT-MODEL>` at the **beginning** of the subagent's prompt. This allows you to direct specific subagent tasks to designated models.
|
|
366
|
+
|
|
367
|
+
**Example:**
|
|
368
|
+
|
|
369
|
+
```
|
|
370
|
+
<CCR-SUBAGENT-MODEL>openrouter,anthropic/claude-3.5-sonnet</CCR-SUBAGENT-MODEL>
|
|
371
|
+
Please help me analyze this code snippet for potential optimizations...
|
|
372
|
+
```
|
|
373
|
+
|
|
333
374
|
## 🤖 GitHub Actions
|
|
334
375
|
|
|
335
376
|
Integrate Claude Code Router into your CI/CD pipeline. After setting up [Claude Code Actions](https://docs.anthropic.com/en/docs/claude-code/github-actions), modify your `.github/workflows/claude.yaml` to use the router:
|
|
@@ -411,6 +452,8 @@ If you find this project helpful, please consider sponsoring its development. Yo
|
|
|
411
452
|
|
|
412
453
|
A huge thank you to all our sponsors for their generous support!
|
|
413
454
|
|
|
455
|
+
|
|
456
|
+
- [AIHubmix](https://aihubmix.com/)
|
|
414
457
|
- @Simon Leischnig
|
|
415
458
|
- [@duanshuaimin](https://github.com/duanshuaimin)
|
|
416
459
|
- [@vrgitadmin](https://github.com/vrgitadmin)
|
|
@@ -451,6 +494,9 @@ A huge thank you to all our sponsors for their generous support!
|
|
|
451
494
|
- @*鑫
|
|
452
495
|
- @c\*y
|
|
453
496
|
- @\*昕
|
|
497
|
+
- [@witsice](https://github.com/witsice)
|
|
498
|
+
- @b\*g
|
|
499
|
+
- @\*亿
|
|
454
500
|
|
|
455
501
|
|
|
456
502
|
(If your name is masked, please contact me via my homepage email to update it with your GitHub username.)
|
package/README_zh.md
CHANGED
|
@@ -137,6 +137,16 @@ npm install -g @musistudio/claude-code-router
|
|
|
137
137
|
"enhancetool"
|
|
138
138
|
]
|
|
139
139
|
}
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
"name": "aihubmix",
|
|
143
|
+
"api_base_url": "https://aihubmix.com/v1/chat/completions",
|
|
144
|
+
"api_key": "sk-",
|
|
145
|
+
"models": [
|
|
146
|
+
"Z/glm-4.5",
|
|
147
|
+
"claude-opus-4-20250514",
|
|
148
|
+
"gemini-2.5-pro"
|
|
149
|
+
]
|
|
140
150
|
}
|
|
141
151
|
],
|
|
142
152
|
"Router": {
|
|
@@ -174,6 +184,8 @@ ccr ui
|
|
|
174
184
|
|
|
175
185
|
这将打开一个基于 Web 的界面,您可以在其中轻松查看和编辑您的 `config.json` 文件。
|
|
176
186
|
|
|
187
|
+

|
|
188
|
+
|
|
177
189
|
> **注意**: UI 模式目前处于测试阶段。这是一个 100% vibe coding的项目,包括项目的初始化,我只是新建了一个文件夹和一个project.md文档。所有代码均由 ccr + qwen3-coder + gemini(webSearch) 实现。如有问题请提交 issue。
|
|
178
190
|
|
|
179
191
|
#### Providers
|
|
@@ -240,9 +252,27 @@ Transformers 允许您修改请求和响应负载,以确保与不同提供商
|
|
|
240
252
|
|
|
241
253
|
**可用的内置 Transformer:**
|
|
242
254
|
|
|
255
|
+
- `Anthropic`: 如果你只使用这一个转换器,则会直接透传请求和响应(你可以用它来接入其他支持Anthropic端点的服务商)。
|
|
243
256
|
- `deepseek`: 适配 DeepSeek API 的请求/响应。
|
|
244
257
|
- `gemini`: 适配 Gemini API 的请求/响应。
|
|
245
|
-
- `openrouter`: 适配 OpenRouter API
|
|
258
|
+
- `openrouter`: 适配 OpenRouter API 的请求/响应。它还可以接受一个 `provider` 路由参数,以指定 OpenRouter 应使用哪些底层提供商。有关更多详细信息,请参阅 [OpenRouter 文档](https://openrouter.ai/docs/features/provider-routing)。请参阅下面的示例:
|
|
259
|
+
```json
|
|
260
|
+
"transformer": {
|
|
261
|
+
"use": ["openrouter"],
|
|
262
|
+
"moonshotai/kimi-k2": {
|
|
263
|
+
"use": [
|
|
264
|
+
[
|
|
265
|
+
"openrouter",
|
|
266
|
+
{
|
|
267
|
+
"provider": {
|
|
268
|
+
"only": ["moonshotai/fp8"]
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
]
|
|
272
|
+
]
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
```
|
|
246
276
|
- `groq`: 适配 groq API 的请求/响应
|
|
247
277
|
- `maxtoken`: 设置特定的 `max_tokens` 值。
|
|
248
278
|
- `tooluse`: 优化某些模型的工具使用(通过`tool_choice`参数)。
|
|
@@ -324,6 +354,17 @@ module.exports = async function router(req, config) {
|
|
|
324
354
|
};
|
|
325
355
|
```
|
|
326
356
|
|
|
357
|
+
##### 子代理路由
|
|
358
|
+
|
|
359
|
+
对于子代理内的路由,您必须在子代理提示词的**开头**包含 `<CCR-SUBAGENT-MODEL>provider,model</CCR-SUBAGENT-MODEL>` 来指定特定的提供商和模型。这样可以将特定的子代理任务定向到指定的模型。
|
|
360
|
+
|
|
361
|
+
**示例:**
|
|
362
|
+
|
|
363
|
+
```
|
|
364
|
+
<CCR-SUBAGENT-MODEL>openrouter,anthropic/claude-3.5-sonnet</CCR-SUBAGENT-MODEL>
|
|
365
|
+
请帮我分析这段代码是否存在潜在的优化空间...
|
|
366
|
+
```
|
|
367
|
+
|
|
327
368
|
|
|
328
369
|
## 🤖 GitHub Actions
|
|
329
370
|
|
|
@@ -406,6 +447,7 @@ jobs:
|
|
|
406
447
|
|
|
407
448
|
非常感谢所有赞助商的慷慨支持!
|
|
408
449
|
|
|
450
|
+
- [AIHubmix](https://aihubmix.com/)
|
|
409
451
|
- @Simon Leischnig
|
|
410
452
|
- [@duanshuaimin](https://github.com/duanshuaimin)
|
|
411
453
|
- [@vrgitadmin](https://github.com/vrgitadmin)
|
|
@@ -445,6 +487,9 @@ jobs:
|
|
|
445
487
|
- @*鑫
|
|
446
488
|
- @c\*y
|
|
447
489
|
- @\*昕
|
|
490
|
+
- [@witsice](https://github.com/witsice)
|
|
491
|
+
- @b\*g
|
|
492
|
+
- @\*亿
|
|
448
493
|
|
|
449
494
|
(如果您的名字被屏蔽,请通过我的主页电子邮件与我联系,以便使用您的 GitHub 用户名进行更新。)
|
|
450
495
|
|