@musistudio/claude-code-router 1.0.37 → 1.0.39

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,7 +41,11 @@ Create and configure your `~/.claude-code-router/config.json` file. For more det
41
41
  The `config.json` file has several key sections:
42
42
 
43
43
  - **`PROXY_URL`** (optional): You can set a proxy for API requests, for example: `"PROXY_URL": "http://127.0.0.1:7890"`.
44
- - **`LOG`** (optional): You can enable logging by setting it to `true`. The log file will be located at `$HOME/.claude-code-router.log`.
44
+ - **`LOG`** (optional): You can enable logging by setting it to `true`. When set to `false`, no log files will be created. Default is `true`.
45
+ - **`LOG_LEVEL`** (optional): Set the logging level. Available options are: `"fatal"`, `"error"`, `"warn"`, `"info"`, `"debug"`, `"trace"`. Default is `"info"`.
46
+ - **Logging Systems**: The Claude Code Router uses two separate logging systems:
47
+ - **Server-level logs**: HTTP requests, API calls, and server events are logged using pino in the `~/.claude-code-router/logs/` directory with filenames like `ccr-*.log`
48
+ - **Application-level logs**: Routing decisions and business logic events are logged in `~/.claude-code-router/claude-code-router.log`
45
49
  - **`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"`.
46
50
  - **`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"`.
47
51
  - **`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`.
@@ -315,6 +319,7 @@ Transformers allow you to modify the request and response payloads to ensure com
315
319
  - `cleancache`: Clears the `cache_control` field from requests.
316
320
  - `vertex-gemini`: Handles the Gemini API using Vertex authentication.
317
321
  - `qwen-cli` (experimental): Unofficial support for qwen3-coder-plus model via Qwen CLI [qwen-cli.js](https://gist.github.com/musistudio/f5a67841ced39912fd99e42200d5ca8b).
322
+ - `rovo-cli` (experimental): Unofficial support for gpt-5 via Atlassian Rovo Dev CLI [rovo-cli.js](https://gist.github.com/SaseQ/c2a20a38b11276537ec5332d1f7a5e53).
318
323
 
319
324
  **Custom Transformers:**
320
325
 
@@ -324,7 +329,7 @@ You can also create your own transformers and load them via the `transformers` f
324
329
  {
325
330
  "transformers": [
326
331
  {
327
- "path": "$HOME/.claude-code-router/plugins/gemini-cli.js",
332
+ "path": "/User/xxx/.claude-code-router/plugins/gemini-cli.js",
328
333
  "options": {
329
334
  "project": "xxx"
330
335
  }
@@ -356,7 +361,7 @@ In your `config.json`:
356
361
 
357
362
  ```json
358
363
  {
359
- "CUSTOM_ROUTER_PATH": "$HOME/.claude-code-router/custom-router.js"
364
+ "CUSTOM_ROUTER_PATH": "/User/xxx/.claude-code-router/custom-router.js"
360
365
  }
361
366
  ```
362
367
 
@@ -365,7 +370,7 @@ The custom router file must be a JavaScript module that exports an `async` funct
365
370
  Here is an example of a `custom-router.js` based on `custom-router.example.js`:
366
371
 
367
372
  ```javascript
368
- // $HOME/.claude-code-router/custom-router.js
373
+ // /User/xxx/.claude-code-router/custom-router.js
369
374
 
370
375
  /**
371
376
  * A custom router function to determine which model to use based on the request.
package/README_zh.md CHANGED
@@ -37,7 +37,11 @@ npm install -g @musistudio/claude-code-router
37
37
 
38
38
  `config.json` 文件有几个关键部分:
39
39
  - **`PROXY_URL`** (可选): 您可以为 API 请求设置代理,例如:`"PROXY_URL": "http://127.0.0.1:7890"`。
40
- - **`LOG`** (可选): 您可以通过将其设置为 `true` 来启用日志记录。日志文件将位于 `$HOME/.claude-code-router.log`。
40
+ - **`LOG`** (可选): 您可以通过将其设置为 `true` 来启用日志记录。当设置为 `false` 时,将不会创建日志文件。默认值为 `true`。
41
+ - **`LOG_LEVEL`** (可选): 设置日志级别。可用选项包括:`"fatal"`、`"error"`、`"warn"`、`"info"`、`"debug"`、`"trace"`。默认值为 `"info"`。
42
+ - **日志系统**: Claude Code Router 使用两个独立的日志系统:
43
+ - **服务器级别日志**: HTTP 请求、API 调用和服务器事件使用 pino 记录在 `~/.claude-code-router/logs/` 目录中,文件名类似于 `ccr-*.log`
44
+ - **应用程序级别日志**: 路由决策和业务逻辑事件记录在 `~/.claude-code-router/claude-code-router.log` 文件中
41
45
  - **`APIKEY`** (可选): 您可以设置一个密钥来进行身份验证。设置后,客户端请求必须在 `Authorization` 请求头 (例如, `Bearer your-secret-key`) 或 `x-api-key` 请求头中提供此密钥。例如:`"APIKEY": "your-secret-key"`。
42
46
  - **`HOST`** (可选): 您可以设置服务的主机地址。如果未设置 `APIKEY`,出于安全考虑,主机地址将强制设置为 `127.0.0.1`,以防止未经授权的访问。例如:`"HOST": "0.0.0.0"`。
43
47
  - **`NON_INTERACTIVE_MODE`** (可选): 当设置为 `true` 时,启用与非交互式环境(如 GitHub Actions、Docker 容器或其他 CI/CD 系统)的兼容性。这会设置适当的环境变量(`CI=true`、`FORCE_COLOR=0` 等)并配置 stdin 处理,以防止进程在自动化环境中挂起。例如:`"NON_INTERACTIVE_MODE": true`。
@@ -287,6 +291,7 @@ Transformers 允许您修改请求和响应负载,以确保与不同提供商
287
291
  - `cleancache`: 清除请求中的 `cache_control` 字段。
288
292
  - `vertex-gemini`: 处理使用 vertex 鉴权的 gemini api。
289
293
  - `qwen-cli` (实验性): 通过 Qwen CLI [qwen-cli.js](https://gist.github.com/musistudio/f5a67841ced39912fd99e42200d5ca8b) 对 qwen3-coder-plus 的非官方支持。
294
+ - `rovo-cli` (experimental): 通过 Atlassian Rovo Dev CLI [rovo-cli.js](https://gist.github.com/SaseQ/c2a20a38b11276537ec5332d1f7a5e53) 对 GPT-5 的非官方支持。
290
295
 
291
296
  **自定义 Transformer:**
292
297
 
@@ -296,7 +301,7 @@ Transformers 允许您修改请求和响应负载,以确保与不同提供商
296
301
  {
297
302
  "transformers": [
298
303
  {
299
- "path": "$HOME/.claude-code-router/plugins/gemini-cli.js",
304
+ "path": "/User/xxx/.claude-code-router/plugins/gemini-cli.js",
300
305
  "options": {
301
306
  "project": "xxx"
302
307
  }
@@ -328,7 +333,7 @@ Transformers 允许您修改请求和响应负载,以确保与不同提供商
328
333
 
329
334
  ```json
330
335
  {
331
- "CUSTOM_ROUTER_PATH": "$HOME/.claude-code-router/custom-router.js"
336
+ "CUSTOM_ROUTER_PATH": "/User/xxx/.claude-code-router/custom-router.js"
332
337
  }
333
338
  ```
334
339
 
@@ -337,7 +342,7 @@ Transformers 允许您修改请求和响应负载,以确保与不同提供商
337
342
  这是一个基于 `custom-router.example.js` 的 `custom-router.js` 示例:
338
343
 
339
344
  ```javascript
340
- // $HOME/.claude-code-router/custom-router.js
345
+ // /User/xxx/.claude-code-router/custom-router.js
341
346
 
342
347
  /**
343
348
  * 一个自定义路由函数,用于根据请求确定使用哪个模型。