@musistudio/claude-code-router 1.0.32 → 1.0.33

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 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",
@@ -407,6 +409,7 @@ jobs:
407
409
  cat << 'EOF' > $HOME/.claude-code-router/config.json
408
410
  {
409
411
  "log": true,
412
+ "NON_INTERACTIVE_MODE": true,
410
413
  "OPENAI_API_KEY": "${{ secrets.OPENAI_API_KEY }}",
411
414
  "OPENAI_BASE_URL": "https://api.deepseek.com",
412
415
  "OPENAI_MODEL": "deepseek-chat"
@@ -428,6 +431,8 @@ jobs:
428
431
  anthropic_api_key: "any-string-is-ok"
429
432
  ```
430
433
 
434
+ > **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.
435
+
431
436
  This setup allows for interesting automations, like running tasks during off-peak hours to reduce API costs.
432
437
 
433
438
  ## 📝 Further Reading
@@ -441,6 +446,8 @@ If you find this project helpful, please consider sponsoring its development. Yo
441
446
 
442
447
  [![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/F1F31GN2GM)
443
448
 
449
+ [Paypal](https://paypal.me/musistudio1999)
450
+
444
451
  <table>
445
452
  <tr>
446
453
  <td><img src="/blog/images/alipay.jpg" width="200" alt="Alipay" /></td>
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",
@@ -402,6 +404,7 @@ jobs:
402
404
  cat << 'EOF' > $HOME/.claude-code-router/config.json
403
405
  {
404
406
  "log": true,
407
+ "NON_INTERACTIVE_MODE": true,
405
408
  "OPENAI_API_KEY": "${{ secrets.OPENAI_API_KEY }}",
406
409
  "OPENAI_BASE_URL": "https://api.deepseek.com",
407
410
  "OPENAI_MODEL": "deepseek-chat"
@@ -436,6 +439,8 @@ jobs:
436
439
 
437
440
  [![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/F1F31GN2GM)
438
441
 
442
+ [Paypal](https://paypal.me/musistudio1999)
443
+
439
444
  <table>
440
445
  <tr>
441
446
  <td><img src="/blog/images/alipay.jpg" width="200" alt="Alipay" /></td>
@@ -114,5 +114,6 @@
114
114
  },
115
115
  "APIKEY": "your-secret-key",
116
116
  "HOST": "0.0.0.0",
117
- "API_TIMEOUT_MS": 600000
117
+ "API_TIMEOUT_MS": 600000,
118
+ "NON_INTERACTIVE_MODE": false
118
119
  }