update qwen3-coder example
This commit is contained in:
73
README.md
73
README.md
@@ -36,6 +36,7 @@ npm install -g @musistudio/claude-code-router
|
||||
Create and configure your `~/.claude-code-router/config.json` file. For more details, you can refer to `config.example.json`.
|
||||
|
||||
The `config.json` file has several key sections:
|
||||
|
||||
- **`PROXY_URL`** (optional): You can set a proxy for API requests, for example: `"PROXY_URL": "http://127.0.0.1:7890"`.
|
||||
- **`LOG`** (optional): You can enable logging by setting it to `true`. The log file will be located at `$HOME/.claude-code-router.log`.
|
||||
- **`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"`.
|
||||
@@ -112,9 +113,10 @@ Here is a comprehensive example:
|
||||
[
|
||||
"maxtoken",
|
||||
{
|
||||
"max_tokens": 8192
|
||||
"max_tokens": 65536
|
||||
}
|
||||
]
|
||||
],
|
||||
"enhancetool"
|
||||
]
|
||||
}
|
||||
},
|
||||
@@ -128,9 +130,10 @@ Here is a comprehensive example:
|
||||
[
|
||||
"maxtoken",
|
||||
{
|
||||
"max_tokens": 8192
|
||||
"max_tokens": 65536
|
||||
}
|
||||
]
|
||||
],
|
||||
"enhancetool"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -145,7 +148,6 @@ Here is a comprehensive example:
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
### 3. Running Claude Code with the Router
|
||||
|
||||
Start Claude Code using the router:
|
||||
@@ -155,6 +157,7 @@ ccr code
|
||||
```
|
||||
|
||||
> **Note**: After modifying the configuration file, you need to restart the service for the changes to take effect:
|
||||
>
|
||||
> ```shell
|
||||
> ccr restart
|
||||
> ```
|
||||
@@ -188,6 +191,7 @@ Transformers allow you to modify the request and response payloads to ensure com
|
||||
}
|
||||
```
|
||||
- **Model-Specific Transformer**: Apply a transformer to a specific model. In this example, the `deepseek` transformer is applied to all models, and an additional `tooluse` transformer is applied only to the `deepseek-chat` model.
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "deepseek",
|
||||
@@ -258,7 +262,6 @@ The `Router` object defines which model to use for different scenarios:
|
||||
- `longContext`: A model for handling long contexts (e.g., > 60K tokens).
|
||||
- `webSearch`: Used for handling web search tasks and this requires the model itself to support the feature. If you're using openrouter, you need to add the `:online` suffix after the model name.
|
||||
|
||||
|
||||
You can also switch models dynamically in Claude Code with the `/model` command:
|
||||
`/model provider_name,model_name`
|
||||
Example: `/model openrouter,anthropic/claude-3.5-sonnet`
|
||||
@@ -290,11 +293,11 @@ Here is an example of a `custom-router.js` based on `custom-router.example.js`:
|
||||
* @returns {Promise<string|null>} - A promise that resolves to the "provider,model_name" string, or null to use the default router.
|
||||
*/
|
||||
module.exports = async function router(req, config) {
|
||||
const userMessage = req.body.messages.find(m => m.role === 'user')?.content;
|
||||
const userMessage = req.body.messages.find((m) => m.role === "user")?.content;
|
||||
|
||||
if (userMessage && userMessage.includes('explain this code')) {
|
||||
if (userMessage && userMessage.includes("explain this code")) {
|
||||
// Use a powerful model for code explanation
|
||||
return 'openrouter,anthropic/claude-3.5-sonnet';
|
||||
return "openrouter,anthropic/claude-3.5-sonnet";
|
||||
}
|
||||
|
||||
// Fallback to the default router configuration
|
||||
@@ -302,7 +305,6 @@ module.exports = async function router(req, config) {
|
||||
};
|
||||
```
|
||||
|
||||
|
||||
## 🤖 GitHub Actions
|
||||
|
||||
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:
|
||||
@@ -387,39 +389,38 @@ A huge thank you to all our sponsors for their generous support!
|
||||
- @Simon Leischnig
|
||||
- [@duanshuaimin](https://github.com/duanshuaimin)
|
||||
- [@vrgitadmin](https://github.com/vrgitadmin)
|
||||
- @*o
|
||||
- @\*o
|
||||
- [@ceilwoo](https://github.com/ceilwoo)
|
||||
- @*说
|
||||
- @*更
|
||||
- @K*g
|
||||
- @R*R
|
||||
- @\*说
|
||||
- @\*更
|
||||
- @K\*g
|
||||
- @R\*R
|
||||
- [@bobleer](https://github.com/bobleer)
|
||||
- @*苗
|
||||
- @*划
|
||||
- @\*苗
|
||||
- @\*划
|
||||
- [@Clarence-pan](https://github.com/Clarence-pan)
|
||||
- [@carter003](https://github.com/carter003)
|
||||
- @S*r
|
||||
- @*晖
|
||||
- @*敏
|
||||
- @Z*z
|
||||
- @*然
|
||||
- @S\*r
|
||||
- @\*晖
|
||||
- @\*敏
|
||||
- @Z\*z
|
||||
- @\*然
|
||||
- [@cluic](https://github.com/cluic)
|
||||
- @*苗
|
||||
- @\*苗
|
||||
- [@PromptExpert](https://github.com/PromptExpert)
|
||||
- @*应
|
||||
- @\*应
|
||||
- [@yusnake](https://github.com/yusnake)
|
||||
- @*飞
|
||||
- @董*
|
||||
- @*汀
|
||||
- @*涯
|
||||
- @*:-)
|
||||
- @**磊
|
||||
- @*琢
|
||||
- @*成
|
||||
- @Z*o
|
||||
- @*琨
|
||||
- @\*飞
|
||||
- @董\*
|
||||
- @\*汀
|
||||
- @\*涯
|
||||
- @\*:-)
|
||||
- @\*\*磊
|
||||
- @\*琢
|
||||
- @\*成
|
||||
- @Z\*o
|
||||
- @\*琨
|
||||
- [@congzhangzh](https://github.com/congzhangzh)
|
||||
- @*_
|
||||
|
||||
- @\*\_
|
||||
|
||||
(If your name is masked, please contact me via my homepage email to update it with your GitHub username.)
|
||||
|
||||
10
README_zh.md
10
README_zh.md
@@ -109,9 +109,10 @@ npm install -g @musistudio/claude-code-router
|
||||
[
|
||||
"maxtoken",
|
||||
{
|
||||
"max_tokens": 8192
|
||||
"max_tokens": 65536
|
||||
}
|
||||
]
|
||||
],
|
||||
"enhancetool"
|
||||
]
|
||||
}
|
||||
},
|
||||
@@ -125,9 +126,10 @@ npm install -g @musistudio/claude-code-router
|
||||
[
|
||||
"maxtoken",
|
||||
{
|
||||
"max_tokens": 8192
|
||||
"max_tokens": 65536
|
||||
}
|
||||
]
|
||||
],
|
||||
"enhancetool"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,9 +76,10 @@
|
||||
[
|
||||
"maxtoken",
|
||||
{
|
||||
"max_tokens": 8192
|
||||
"max_tokens": 65536
|
||||
}
|
||||
]
|
||||
],
|
||||
"enhancetool"
|
||||
]
|
||||
}
|
||||
},
|
||||
@@ -92,9 +93,10 @@
|
||||
[
|
||||
"maxtoken",
|
||||
{
|
||||
"max_tokens": 8192
|
||||
"max_tokens": 65536
|
||||
}
|
||||
]
|
||||
],
|
||||
"enhancetool"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user