@caeliq/claude-code-router 2.0.1 → 2.0.2

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.
Files changed (3) hide show
  1. package/README.md +13 -4
  2. package/dist/cli.js +473 -472
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -61,7 +61,7 @@ Create and configure your `~/.claude-code-router/config.json` file. For more det
61
61
 
62
62
  The `config.json` file has several key sections:
63
63
 
64
- - **`PROXY_URL`** (optional): You can set a proxy for API requests, for example: `"PROXY_URL": "http://127.0.0.1:7890"`.
64
+ - **`PROXY_URL`** (optional): You can set a proxy for API requests, for example: `"PROXY_URL": "http://127.0.0.1:7890"`. Loopback targets (`localhost`, `127.0.0.1`, `::1`) always bypass the proxy. Hosts listed in the `NO_PROXY` / `no_proxy` environment variables also bypass it (comma-separated hosts, `.domain` / `*.domain`, CIDR, optional `:port`).
65
65
  - **`LOG`** (optional): You can enable logging by setting it to `true`. When set to `false`, no log files will be created. Default is `true`.
66
66
  - **`LOG_LEVEL`** (optional): Set the logging level. Available options are: `"fatal"`, `"error"`, `"warn"`, `"info"`, `"debug"`, `"trace"`. Default is `"debug"`.
67
67
  - **Logging Systems**: The Claude Code Router uses two separate logging systems:
@@ -866,7 +866,7 @@ Two transformers are required in the chain:
866
866
  - `claude-auth` — converts the request from Unified (OpenAI) format to Anthropic format, injects `Authorization: Bearer <token>` (loading/refreshing the token from `~/.claude-code-router/claude_auth.json`), and converts the Anthropic SSE response back to Unified format.
867
867
  - `Anthropic` — registers the `POST /v1/messages` route. It has no body conversion in the provider chain, so it acts as a no-op endpoint stub.
868
868
 
869
- > **Note**: The `api_key` field is a placeholder — actual authentication is handled via OAuth tokens stored in `~/.claude-code-router/claude_auth.json`. Run `ccr claude-auth` to authenticate before using this provider.
869
+ > **Note**: The `api_key` field is a placeholder — actual authentication is handled via OAuth tokens stored in `~/.claude-code-router/claude_auth.json`. Run `ccr claude-auth` to authenticate before using this provider. The transformer automatically sends Anthropic's `oauth-2025-04-20` beta so subscription OAuth Bearer tokens are accepted.
870
870
 
871
871
  **DeepSeek via OpenCode (Mandatory Reasoning Replay):**
872
872
 
@@ -966,7 +966,12 @@ module.exports = async function router(req, config) {
966
966
 
967
967
  ##### Subagent Routing
968
968
 
969
- 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.
969
+ Claude Code subagent requests can be routed with:
970
+
971
+ 1. An explicit `<CCR-SUBAGENT-MODEL>provider,model</CCR-SUBAGENT-MODEL>` tag in system or message text (the tag is stripped before the upstream request). `provider/model` is also accepted.
972
+ 2. Or the `CLAUDE_CODE_SUBAGENT_MODEL=provider,model` environment variable when Claude Code marks the turn as a subagent.
973
+
974
+ Tag takes priority over the environment variable. If neither is set, normal Router rules apply.
970
975
 
971
976
  **Example:**
972
977
 
@@ -975,6 +980,10 @@ For routing within subagents, you must specify a particular provider and model b
975
980
  Please help me analyze this code snippet for potential optimizations...
976
981
  ```
977
982
 
983
+ ```bash
984
+ export CLAUDE_CODE_SUBAGENT_MODEL="openrouter,anthropic/claude-3.5-sonnet"
985
+ ```
986
+
978
987
  ## Status Line (Beta)
979
988
  To better monitor the status of claude-code-router at runtime, version v1.0.40 includes a built-in statusline tool, which you can enable in the UI.
980
989
  ![statusline-config.png](/blog/images/statusline-config.png)
@@ -1048,4 +1057,4 @@ This setup allows for interesting automations, like running tasks during off-pea
1048
1057
 
1049
1058
  - [Codex API](https://developers.openai.com/codex/sdk) — Developer docs for the ChatGPT backend API used by the `codex` transformer (OAuth PKCE, Responses API, streaming, tool calls)
1050
1059
  - [Chrome Prompt API](https://developer.chrome.com/docs/ai/prompt-api) — On-device Gemini Nano API used by the `chrome-on-device` transformer and bridge
1051
- - [Provider Integration Lessons](tasks/lessons.md) — Hard-won knowledge for LLM provider integrations (DeepSeek, Mistral, Gemini, Codex, Gemini Nano)
1060
+ - [Provider Integration Lessons](tasks/lessons.md) — Hard-won knowledge for LLM provider integrations (DeepSeek, Mistral, Gemini, Codex, Gemini Nano)