@musistudio/claude-code-router 1.0.32 → 1.0.34
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 +15 -1
- package/README_zh.md +13 -0
- package/config.example.json +2 -1
- package/dist/cli.js +6376 -5500
- package/dist/index.html +53 -43
- package/dist/lib/worker.js +2 -0
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -41,6 +41,7 @@ The `config.json` file has several key sections:
|
|
|
41
41
|
- **`LOG`** (optional): You can enable logging by setting it to `true`. The log file will be located at `$HOME/.claude-code-router.log`.
|
|
42
42
|
- **`APIKEY`** (optional): You can set a secret key to authenticate requests. When set, clients must provide this key in the `Authorization` header (e.g., `Bearer your-secret-key`) or the `x-api-key` header. Example: `"APIKEY": "your-secret-key"`.
|
|
43
43
|
- **`HOST`** (optional): You can set the host address for the server. If `APIKEY` is not set, the host will be forced to `127.0.0.1` for security reasons to prevent unauthorized access. Example: `"HOST": "0.0.0.0"`.
|
|
44
|
+
- **`NON_INTERACTIVE_MODE`** (optional): When set to `true`, enables compatibility with non-interactive environments like GitHub Actions, Docker containers, or other CI/CD systems. This sets appropriate environment variables (`CI=true`, `FORCE_COLOR=0`, etc.) and configures stdin handling to prevent the process from hanging in automated environments. Example: `"NON_INTERACTIVE_MODE": true`.
|
|
44
45
|
|
|
45
46
|
- **`Providers`**: Used to configure different model providers.
|
|
46
47
|
- **`Router`**: Used to set up routing rules. `default` specifies the default model, which will be used for all requests if no other route is configured.
|
|
@@ -54,6 +55,7 @@ Here is a comprehensive example:
|
|
|
54
55
|
"PROXY_URL": "http://127.0.0.1:7890",
|
|
55
56
|
"LOG": true,
|
|
56
57
|
"API_TIMEOUT_MS": 600000,
|
|
58
|
+
"NON_INTERACTIVE_MODE": false,
|
|
57
59
|
"Providers": [
|
|
58
60
|
{
|
|
59
61
|
"name": "openrouter",
|
|
@@ -288,6 +290,7 @@ Transformers allow you to modify the request and response payloads to ensure com
|
|
|
288
290
|
- `enhancetool`: Adds a layer of error tolerance to the tool call parameters returned by the LLM (this will cause the tool call information to no longer be streamed).
|
|
289
291
|
- `cleancache`: Clears the `cache_control` field from requests.
|
|
290
292
|
- `vertex-gemini`: Handles the Gemini API using Vertex authentication.
|
|
293
|
+
- `qwen-cli` (experimental): Unofficial support for qwen3-coder-plus model via Qwen CLI [qwen-cli.js](https://gist.github.com/musistudio/f5a67841ced39912fd99e42200d5ca8b).
|
|
291
294
|
|
|
292
295
|
**Custom Transformers:**
|
|
293
296
|
|
|
@@ -407,6 +410,7 @@ jobs:
|
|
|
407
410
|
cat << 'EOF' > $HOME/.claude-code-router/config.json
|
|
408
411
|
{
|
|
409
412
|
"log": true,
|
|
413
|
+
"NON_INTERACTIVE_MODE": true,
|
|
410
414
|
"OPENAI_API_KEY": "${{ secrets.OPENAI_API_KEY }}",
|
|
411
415
|
"OPENAI_BASE_URL": "https://api.deepseek.com",
|
|
412
416
|
"OPENAI_MODEL": "deepseek-chat"
|
|
@@ -428,6 +432,8 @@ jobs:
|
|
|
428
432
|
anthropic_api_key: "any-string-is-ok"
|
|
429
433
|
```
|
|
430
434
|
|
|
435
|
+
> **Note**: When running in GitHub Actions or other automation environments, make sure to set `"NON_INTERACTIVE_MODE": true` in your configuration to prevent the process from hanging due to stdin handling issues.
|
|
436
|
+
|
|
431
437
|
This setup allows for interesting automations, like running tasks during off-peak hours to reduce API costs.
|
|
432
438
|
|
|
433
439
|
## 📝 Further Reading
|
|
@@ -441,6 +447,8 @@ If you find this project helpful, please consider sponsoring its development. Yo
|
|
|
441
447
|
|
|
442
448
|
[](https://ko-fi.com/F1F31GN2GM)
|
|
443
449
|
|
|
450
|
+
[Paypal](https://paypal.me/musistudio1999)
|
|
451
|
+
|
|
444
452
|
<table>
|
|
445
453
|
<tr>
|
|
446
454
|
<td><img src="/blog/images/alipay.jpg" width="200" alt="Alipay" /></td>
|
|
@@ -497,6 +505,12 @@ A huge thank you to all our sponsors for their generous support!
|
|
|
497
505
|
- [@witsice](https://github.com/witsice)
|
|
498
506
|
- @b\*g
|
|
499
507
|
- @\*亿
|
|
500
|
-
|
|
508
|
+
- @\*辉
|
|
509
|
+
- @JACK
|
|
510
|
+
- @\*光
|
|
511
|
+
- @W\*l
|
|
512
|
+
- [@kesku](https://github.com/kesku)
|
|
513
|
+
- @水\*丫
|
|
514
|
+
- @二吉吉
|
|
501
515
|
|
|
502
516
|
(If your name is masked, please contact me via my homepage email to update it with your GitHub username.)
|
package/README_zh.md
CHANGED
|
@@ -38,6 +38,7 @@ npm install -g @musistudio/claude-code-router
|
|
|
38
38
|
- **`LOG`** (可选): 您可以通过将其设置为 `true` 来启用日志记录。日志文件将位于 `$HOME/.claude-code-router.log`。
|
|
39
39
|
- **`APIKEY`** (可选): 您可以设置一个密钥来进行身份验证。设置后,客户端请求必须在 `Authorization` 请求头 (例如, `Bearer your-secret-key`) 或 `x-api-key` 请求头中提供此密钥。例如:`"APIKEY": "your-secret-key"`。
|
|
40
40
|
- **`HOST`** (可选): 您可以设置服务的主机地址。如果未设置 `APIKEY`,出于安全考虑,主机地址将强制设置为 `127.0.0.1`,以防止未经授权的访问。例如:`"HOST": "0.0.0.0"`。
|
|
41
|
+
- **`NON_INTERACTIVE_MODE`** (可选): 当设置为 `true` 时,启用与非交互式环境(如 GitHub Actions、Docker 容器或其他 CI/CD 系统)的兼容性。这会设置适当的环境变量(`CI=true`、`FORCE_COLOR=0` 等)并配置 stdin 处理,以防止进程在自动化环境中挂起。例如:`"NON_INTERACTIVE_MODE": true`。
|
|
41
42
|
- **`Providers`**: 用于配置不同的模型提供商。
|
|
42
43
|
- **`Router`**: 用于设置路由规则。`default` 指定默认模型,如果未配置其他路由,则该模型将用于所有请求。
|
|
43
44
|
- **`API_TIMEOUT_MS`**: API 请求超时时间,单位为毫秒。
|
|
@@ -50,6 +51,7 @@ npm install -g @musistudio/claude-code-router
|
|
|
50
51
|
"PROXY_URL": "http://127.0.0.1:7890",
|
|
51
52
|
"LOG": true,
|
|
52
53
|
"API_TIMEOUT_MS": 600000,
|
|
54
|
+
"NON_INTERACTIVE_MODE": false,
|
|
53
55
|
"Providers": [
|
|
54
56
|
{
|
|
55
57
|
"name": "openrouter",
|
|
@@ -282,6 +284,7 @@ Transformers 允许您修改请求和响应负载,以确保与不同提供商
|
|
|
282
284
|
- `enhancetool`: 对 LLM 返回的工具调用参数增加一层容错处理(这会导致不再流式返回工具调用信息)。
|
|
283
285
|
- `cleancache`: 清除请求中的 `cache_control` 字段。
|
|
284
286
|
- `vertex-gemini`: 处理使用 vertex 鉴权的 gemini api。
|
|
287
|
+
- `qwen-cli` (实验性): 通过 Qwen CLI [qwen-cli.js](https://gist.github.com/musistudio/f5a67841ced39912fd99e42200d5ca8b) 对 qwen3-coder-plus 的非官方支持。
|
|
285
288
|
|
|
286
289
|
**自定义 Transformer:**
|
|
287
290
|
|
|
@@ -402,6 +405,7 @@ jobs:
|
|
|
402
405
|
cat << 'EOF' > $HOME/.claude-code-router/config.json
|
|
403
406
|
{
|
|
404
407
|
"log": true,
|
|
408
|
+
"NON_INTERACTIVE_MODE": true,
|
|
405
409
|
"OPENAI_API_KEY": "${{ secrets.OPENAI_API_KEY }}",
|
|
406
410
|
"OPENAI_BASE_URL": "https://api.deepseek.com",
|
|
407
411
|
"OPENAI_MODEL": "deepseek-chat"
|
|
@@ -436,6 +440,8 @@ jobs:
|
|
|
436
440
|
|
|
437
441
|
[](https://ko-fi.com/F1F31GN2GM)
|
|
438
442
|
|
|
443
|
+
[Paypal](https://paypal.me/musistudio1999)
|
|
444
|
+
|
|
439
445
|
<table>
|
|
440
446
|
<tr>
|
|
441
447
|
<td><img src="/blog/images/alipay.jpg" width="200" alt="Alipay" /></td>
|
|
@@ -490,6 +496,13 @@ jobs:
|
|
|
490
496
|
- [@witsice](https://github.com/witsice)
|
|
491
497
|
- @b\*g
|
|
492
498
|
- @\*亿
|
|
499
|
+
- @\*辉
|
|
500
|
+
- @JACK
|
|
501
|
+
- @\*光
|
|
502
|
+
- @W\*l
|
|
503
|
+
- [@kesku](https://github.com/kesku)
|
|
504
|
+
- @水\*丫
|
|
505
|
+
- @二吉吉
|
|
493
506
|
|
|
494
507
|
(如果您的名字被屏蔽,请通过我的主页电子邮件与我联系,以便使用您的 GitHub 用户名进行更新。)
|
|
495
508
|
|