@musistudio/claude-code-router 1.0.9 → 1.0.11
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 +62 -48
- package/dist/cli.js +53989 -37362
- package/package.json +2 -7
- package/blog/en/project-motivation-and-how-it-works.md +0 -103
- package/blog/images/alipay.jpg +0 -0
- package/blog/images/chrome-devtools.png +0 -0
- package/blog/images/chrome-inspect.png +0 -0
- package/blog/images/search.png +0 -0
- package/blog/images/webstorm-formate-file.png +0 -0
- package/blog/images/wechat.jpg +0 -0
- package/blog/zh//351/241/271/347/233/256/345/210/235/350/241/267/345/217/212/345/216/237/347/220/206.md +0 -96
- package/config.json +0 -8
- package/plugins/notebook-tools-filter.js +0 -7
- package/plugins/toolcall-improvement.js +0 -8
package/README.md
CHANGED
|
@@ -29,13 +29,11 @@ ccr code
|
|
|
29
29
|
|
|
30
30
|
```json
|
|
31
31
|
{
|
|
32
|
-
"OPENAI_API_KEY": "sk-xxx",
|
|
33
|
-
"OPENAI_BASE_URL": "https://api.deepseek.com",
|
|
34
|
-
"OPENAI_MODEL": "deepseek-chat",
|
|
35
32
|
"Providers": [
|
|
36
33
|
{
|
|
37
34
|
"name": "openrouter",
|
|
38
|
-
|
|
35
|
+
// IMPORTANT: api_base_url must be a complete (full) URL.
|
|
36
|
+
"api_base_url": "https://openrouter.ai/api/v1/chat/completions",
|
|
39
37
|
"api_key": "sk-xxx",
|
|
40
38
|
"models": [
|
|
41
39
|
"google/gemini-2.5-pro-preview",
|
|
@@ -46,18 +44,48 @@ ccr code
|
|
|
46
44
|
},
|
|
47
45
|
{
|
|
48
46
|
"name": "deepseek",
|
|
49
|
-
|
|
47
|
+
// IMPORTANT: api_base_url must be a complete (full) URL.
|
|
48
|
+
"api_base_url": "https://api.deepseek.com/chat/completions",
|
|
50
49
|
"api_key": "sk-xxx",
|
|
51
|
-
"models": ["deepseek-reasoner"]
|
|
50
|
+
"models": ["deepseek-chat", "deepseek-reasoner"],
|
|
51
|
+
"transformer": {
|
|
52
|
+
"use": ["deepseek"],
|
|
53
|
+
"deepseek-chat": {
|
|
54
|
+
// Enhance tool usage for the deepseek-chat model using the ToolUse transformer.
|
|
55
|
+
"use": ["tooluse"]
|
|
56
|
+
}
|
|
57
|
+
}
|
|
52
58
|
},
|
|
53
59
|
{
|
|
54
60
|
"name": "ollama",
|
|
55
|
-
|
|
61
|
+
// IMPORTANT: api_base_url must be a complete (full) URL.
|
|
62
|
+
"api_base_url": "http://localhost:11434/v1/chat/completions",
|
|
56
63
|
"api_key": "ollama",
|
|
57
64
|
"models": ["qwen2.5-coder:latest"]
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"name": "gemini",
|
|
68
|
+
// IMPORTANT: api_base_url must be a complete (full) URL.
|
|
69
|
+
"api_base_url": "https://generativelanguage.googleapis.com/v1beta/models/",
|
|
70
|
+
"api_key": "sk-xxx",
|
|
71
|
+
"models": ["gemini-2.5-flash", "gemini-2.5-pro"],
|
|
72
|
+
"transformer": {
|
|
73
|
+
"use": ["gemini"]
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"name": "volcengine",
|
|
78
|
+
// IMPORTANT: api_base_url must be a complete (full) URL.
|
|
79
|
+
"api_base_url": "https://ark.cn-beijing.volces.com/api/v3/chat/completions",
|
|
80
|
+
"api_key": "sk-xxx",
|
|
81
|
+
"models": ["deepseek-v3-250324", "deepseek-r1-250528"],
|
|
82
|
+
"transformer": {
|
|
83
|
+
"use": ["deepseek"]
|
|
84
|
+
}
|
|
58
85
|
}
|
|
59
86
|
],
|
|
60
87
|
"Router": {
|
|
88
|
+
"default": "deepseek,deepseek-chat", // IMPORTANT OPENAI_MODEL has been deprecated
|
|
61
89
|
"background": "ollama,qwen2.5-coder:latest",
|
|
62
90
|
"think": "deepseek,deepseek-reasoner",
|
|
63
91
|
"longContext": "openrouter,google/gemini-2.5-pro-preview"
|
|
@@ -86,40 +114,12 @@ ccr code
|
|
|
86
114
|
|
|
87
115
|
- [x] Support change models
|
|
88
116
|
- [x] Github Actions
|
|
89
|
-
- [ ] More robust plugin support
|
|
90
117
|
- [ ] More detailed logs
|
|
91
118
|
|
|
92
|
-
## Plugins
|
|
93
|
-
You can modify or enhance Claude Code’s functionality by installing plugins. The mechanism works by using middleware to modify request parameters — this allows you to rewrite prompts or add/remove tools.
|
|
94
|
-
|
|
95
|
-
To use a plugin, place it in the ~/.claude-code-router/plugins/ directory and specify the plugin name in config.js using the `usePlugins` option.like this
|
|
96
|
-
```json
|
|
97
|
-
// ~/.claud-code-router/config.json
|
|
98
|
-
{
|
|
99
|
-
...,
|
|
100
|
-
"usePlugins": ["notebook-tools-filter", "toolcall-improvement"]
|
|
101
|
-
}
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
Currently, the following plugins are available:
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
- **notebook-tools-filter**
|
|
108
|
-
This plugin filters out tool calls related to Jupyter notebooks (.ipynb files). You can use it if your work does not involve Jupyter.
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
- **toolcall-improvement**
|
|
112
|
-
If your LLM doesn’t handle tool usage well (for example, always returning code as plain text instead of modifying files — such as with deepseek-v3), you can use this plugin.
|
|
113
|
-
This plugin simply adds the following system prompt. If you have a better prompt, you can modify it.
|
|
114
|
-
```markdown
|
|
115
|
-
## **Important Instruction:**
|
|
116
|
-
You must use tools as frequently and accurately as possible to help the user solve their problem.
|
|
117
|
-
Prioritize tool usage whenever it can enhance accuracy, efficiency, or the quality of the response.
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
|
|
121
119
|
## Github Actions
|
|
120
|
+
|
|
122
121
|
You just need to install `Claude Code Actions` in your repository according to the [official documentation](https://docs.anthropic.com/en/docs/claude-code/github-actions). For `ANTHROPIC_API_KEY`, you can use any string. Then, modify your `.github/workflows/claude.yaml` file to include claude-code-router, like this:
|
|
122
|
+
|
|
123
123
|
```yaml
|
|
124
124
|
name: Claude Code
|
|
125
125
|
|
|
@@ -151,7 +151,7 @@ jobs:
|
|
|
151
151
|
uses: actions/checkout@v4
|
|
152
152
|
with:
|
|
153
153
|
fetch-depth: 1
|
|
154
|
-
|
|
154
|
+
|
|
155
155
|
- name: Prepare Environment
|
|
156
156
|
run: |
|
|
157
157
|
curl -fsSL https://bun.sh/install | bash
|
|
@@ -165,7 +165,7 @@ jobs:
|
|
|
165
165
|
}
|
|
166
166
|
EOF
|
|
167
167
|
shell: bash
|
|
168
|
-
|
|
168
|
+
|
|
169
169
|
- name: Start Claude Code Router
|
|
170
170
|
run: |
|
|
171
171
|
nohup ~/.bun/bin/bunx @musistudio/claude-code-router@1.0.8 start &
|
|
@@ -179,6 +179,7 @@ jobs:
|
|
|
179
179
|
with:
|
|
180
180
|
anthropic_api_key: "test"
|
|
181
181
|
```
|
|
182
|
+
|
|
182
183
|
You can modify the contents of `$HOME/.claude-code-router/config.json` as needed.
|
|
183
184
|
GitHub Actions support allows you to trigger Claude Code at specific times, which opens up some interesting possibilities.
|
|
184
185
|
|
|
@@ -190,7 +191,6 @@ For example, between 00:30 and 08:30 Beijing Time, using the official DeepSeek A
|
|
|
190
191
|
|
|
191
192
|
So maybe in the future, I’ll describe detailed tasks for Claude Code ahead of time and let it run during these discounted hours to reduce costs?
|
|
192
193
|
|
|
193
|
-
|
|
194
194
|
## Some tips:
|
|
195
195
|
|
|
196
196
|
Now you can use deepseek-v3 models directly without using any plugins.
|
|
@@ -205,22 +205,36 @@ Some interesting points: Based on my testing, including a lot of context informa
|
|
|
205
205
|
|
|
206
206
|
## Some articles:
|
|
207
207
|
|
|
208
|
-
1. [Project Motivation and Principles](blog/en/project-motivation-and-how-it-works.md) ([
|
|
208
|
+
1. [Project Motivation and Principles](blog/en/project-motivation-and-how-it-works.md) ([项目初衷及原理](blog/zh/项目初衷及原理.md))
|
|
209
|
+
2. [Maybe We Can Do More with the Router](blog/en/maybe-we-can-do-more-with-the-route.md) ([或许我们能在 Router 中做更多事情](blog/zh/或许我们能在Router中做更多事情.md))
|
|
209
210
|
|
|
210
211
|
## Buy me a coffee
|
|
211
212
|
|
|
212
|
-
If you find this project helpful, you can choose to sponsor the author with a cup of coffee. Please provide your GitHub information so I can add you to the sponsor list below.
|
|
213
|
+
If you find this project helpful, you can choose to sponsor the author with a cup of coffee. Please provide your GitHub information so I can add you to the sponsor list below.
|
|
213
214
|
|
|
214
215
|
[](https://ko-fi.com/F1F31GN2GM)
|
|
215
216
|
|
|
216
|
-
|
|
217
|
-
|
|
217
|
+
<table>
|
|
218
|
+
<tr>
|
|
219
|
+
<td><img src="/blog/images/alipay.jpg" width="200" /></td>
|
|
220
|
+
<td><img src="/blog/images/wechat.jpg" width="200" /></td>
|
|
221
|
+
</tr>
|
|
222
|
+
</table>
|
|
218
223
|
|
|
219
224
|
## Sponsors
|
|
220
225
|
|
|
221
226
|
Thanks to the following sponsors:
|
|
222
227
|
|
|
223
|
-
@Simon Leischnig (If you see this, feel free to contact me and I can update it with your GitHub information)
|
|
224
|
-
[@duanshuaimin](https://github.com/duanshuaimin)
|
|
225
|
-
[@vrgitadmin](https://github.com/vrgitadmin)
|
|
226
|
-
|
|
228
|
+
@Simon Leischnig (If you see this, feel free to contact me and I can update it with your GitHub information)
|
|
229
|
+
[@duanshuaimin](https://github.com/duanshuaimin)
|
|
230
|
+
[@vrgitadmin](https://github.com/vrgitadmin)
|
|
231
|
+
@\*o (可通过主页邮箱联系我修改 github 用户名)
|
|
232
|
+
@\*\*聪 (可通过主页邮箱联系我修改 github 用户名)
|
|
233
|
+
@\*说 (可通过主页邮箱联系我修改 github 用户名)
|
|
234
|
+
@\*更 (可通过主页邮箱联系我修改 github 用户名)
|
|
235
|
+
@\*更 (可通过主页邮箱联系我修改 github 用户名)
|
|
236
|
+
@K\*g (可通过主页邮箱联系我修改 github 用户名)
|
|
237
|
+
@R\*R (可通过主页邮箱联系我修改 github 用户名)
|
|
238
|
+
@[@bobleer](https://github.com/bobleer) (可通过主页邮箱联系我修改 github 用户名)
|
|
239
|
+
@\*苗 (可通过主页邮箱联系我修改 github 用户名)
|
|
240
|
+
@\*划 (可通过主页邮箱联系我修改 github 用户名)
|