@musistudio/claude-code-router 1.0.31 → 1.0.32

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
@@ -261,7 +261,24 @@ Transformers allow you to modify the request and response payloads to ensure com
261
261
  - `Anthropic`:If you use only the `Anthropic` transformer, it will preserve the original request and response parameters(you can use it to connect directly to an Anthropic endpoint).
262
262
  - `deepseek`: Adapts requests/responses for DeepSeek API.
263
263
  - `gemini`: Adapts requests/responses for Gemini API.
264
- - `openrouter`: Adapts requests/responses for OpenRouter API.
264
+ - `openrouter`: Adapts requests/responses for OpenRouter API. It can also accept a `provider` routing parameter to specify which underlying providers OpenRouter should use. For more details, refer to the [OpenRouter documentation](https://openrouter.ai/docs/features/provider-routing). See an example below:
265
+ ```json
266
+ "transformer": {
267
+ "use": ["openrouter"],
268
+ "moonshotai/kimi-k2": {
269
+ "use": [
270
+ [
271
+ "openrouter",
272
+ {
273
+ "provider": {
274
+ "only": ["moonshotai/fp8"]
275
+ }
276
+ }
277
+ ]
278
+ ]
279
+ }
280
+ }
281
+ ```
265
282
  - `groq`: Adapts requests/responses for groq API.
266
283
  - `maxtoken`: Sets a specific `max_tokens` value.
267
284
  - `tooluse`: Optimizes tool usage for certain models via `tool_choice`.
@@ -343,6 +360,17 @@ module.exports = async function router(req, config) {
343
360
  };
344
361
  ```
345
362
 
363
+ ##### Subagent Routing
364
+
365
+ 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.
366
+
367
+ **Example:**
368
+
369
+ ```
370
+ <CCR-SUBAGENT-MODEL>openrouter,anthropic/claude-3.5-sonnet</CCR-SUBAGENT-MODEL>
371
+ Please help me analyze this code snippet for potential optimizations...
372
+ ```
373
+
346
374
  ## 🤖 GitHub Actions
347
375
 
348
376
  Integrate Claude Code Router into your CI/CD pipeline. After setting up [Claude Code Actions](https://docs.anthropic.com/en/docs/claude-code/github-actions), modify your `.github/workflows/claude.yaml` to use the router:
package/README_zh.md CHANGED
@@ -255,7 +255,24 @@ Transformers 允许您修改请求和响应负载,以确保与不同提供商
255
255
  - `Anthropic`: 如果你只使用这一个转换器,则会直接透传请求和响应(你可以用它来接入其他支持Anthropic端点的服务商)。
256
256
  - `deepseek`: 适配 DeepSeek API 的请求/响应。
257
257
  - `gemini`: 适配 Gemini API 的请求/响应。
258
- - `openrouter`: 适配 OpenRouter API 的请求/响应。
258
+ - `openrouter`: 适配 OpenRouter API 的请求/响应。它还可以接受一个 `provider` 路由参数,以指定 OpenRouter 应使用哪些底层提供商。有关更多详细信息,请参阅 [OpenRouter 文档](https://openrouter.ai/docs/features/provider-routing)。请参阅下面的示例:
259
+ ```json
260
+ "transformer": {
261
+ "use": ["openrouter"],
262
+ "moonshotai/kimi-k2": {
263
+ "use": [
264
+ [
265
+ "openrouter",
266
+ {
267
+ "provider": {
268
+ "only": ["moonshotai/fp8"]
269
+ }
270
+ }
271
+ ]
272
+ ]
273
+ }
274
+ }
275
+ ```
259
276
  - `groq`: 适配 groq API 的请求/响应
260
277
  - `maxtoken`: 设置特定的 `max_tokens` 值。
261
278
  - `tooluse`: 优化某些模型的工具使用(通过`tool_choice`参数)。
@@ -337,6 +354,17 @@ module.exports = async function router(req, config) {
337
354
  };
338
355
  ```
339
356
 
357
+ ##### 子代理路由
358
+
359
+ 对于子代理内的路由,您必须在子代理提示词的**开头**包含 `<CCR-SUBAGENT-MODEL>provider,model</CCR-SUBAGENT-MODEL>` 来指定特定的提供商和模型。这样可以将特定的子代理任务定向到指定的模型。
360
+
361
+ **示例:**
362
+
363
+ ```
364
+ <CCR-SUBAGENT-MODEL>openrouter,anthropic/claude-3.5-sonnet</CCR-SUBAGENT-MODEL>
365
+ 请帮我分析这段代码是否存在潜在的优化空间...
366
+ ```
367
+
340
368
 
341
369
  ## 🤖 GitHub Actions
342
370