release v1.0.23 to support websearch
This commit is contained in:
@@ -107,7 +107,8 @@ Here is a comprehensive example:
|
|||||||
"default": "deepseek,deepseek-chat",
|
"default": "deepseek,deepseek-chat",
|
||||||
"background": "ollama,qwen2.5-coder:latest",
|
"background": "ollama,qwen2.5-coder:latest",
|
||||||
"think": "deepseek,deepseek-reasoner",
|
"think": "deepseek,deepseek-reasoner",
|
||||||
"longContext": "openrouter,google/gemini-2.5-pro-preview"
|
"longContext": "openrouter,google/gemini-2.5-pro-preview",
|
||||||
|
"webSearch": "gemini,gemini-2.5-flash"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
@@ -218,6 +219,8 @@ The `Router` object defines which model to use for different scenarios:
|
|||||||
- `background`: A model for background tasks. This can be a smaller, local model to save costs.
|
- `background`: A model for background tasks. This can be a smaller, local model to save costs.
|
||||||
- `think`: A model for reasoning-heavy tasks, like Plan Mode.
|
- `think`: A model for reasoning-heavy tasks, like Plan Mode.
|
||||||
- `longContext`: A model for handling long contexts (e.g., > 60K tokens).
|
- `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:
|
You can also switch models dynamically in Claude Code with the `/model` command:
|
||||||
`/model provider_name,model_name`
|
`/model provider_name,model_name`
|
||||||
|
|||||||
@@ -104,7 +104,8 @@ npm install -g @musistudio/claude-code-router
|
|||||||
"default": "deepseek,deepseek-chat",
|
"default": "deepseek,deepseek-chat",
|
||||||
"background": "ollama,qwen2.5-coder:latest",
|
"background": "ollama,qwen2.5-coder:latest",
|
||||||
"think": "deepseek,deepseek-reasoner",
|
"think": "deepseek,deepseek-reasoner",
|
||||||
"longContext": "openrouter,google/gemini-2.5-pro-preview"
|
"longContext": "openrouter,google/gemini-2.5-pro-preview",
|
||||||
|
"webSearch": "gemini,gemini-2.5-flash"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
@@ -215,6 +216,7 @@ Transformers 允许您修改请求和响应负载,以确保与不同提供商
|
|||||||
- `background`: 用于后台任务的模型。这可以是一个较小的本地模型以节省成本。
|
- `background`: 用于后台任务的模型。这可以是一个较小的本地模型以节省成本。
|
||||||
- `think`: 用于推理密集型任务(如计划模式)的模型。
|
- `think`: 用于推理密集型任务(如计划模式)的模型。
|
||||||
- `longContext`: 用于处理长上下文(例如,> 60K 令牌)的模型。
|
- `longContext`: 用于处理长上下文(例如,> 60K 令牌)的模型。
|
||||||
|
- `webSearch`: 用于处理网络搜索任务,需要模型本身支持。如果使用`openrouter`需要在模型后面加上`:online`后缀。
|
||||||
|
|
||||||
您还可以使用 `/model` 命令在 Claude Code 中动态切换模型:
|
您还可以使用 `/model` 命令在 Claude Code 中动态切换模型:
|
||||||
`/model provider_name,model_name`
|
`/model provider_name,model_name`
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@musistudio/claude-code-router",
|
"name": "@musistudio/claude-code-router",
|
||||||
"version": "1.0.22",
|
"version": "1.0.23",
|
||||||
"description": "Use Claude Code without an Anthropics account and route it to another LLM provider",
|
"description": "Use Claude Code without an Anthropics account and route it to another LLM provider",
|
||||||
"bin": {
|
"bin": {
|
||||||
"ccr": "./dist/cli.js"
|
"ccr": "./dist/cli.js"
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
"author": "musistudio",
|
"author": "musistudio",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@musistudio/llms": "^1.0.9",
|
"@musistudio/llms": "^1.0.10",
|
||||||
"dotenv": "^16.4.7",
|
"dotenv": "^16.4.7",
|
||||||
"tiktoken": "^1.0.21",
|
"tiktoken": "^1.0.21",
|
||||||
"uuid": "^11.1.0"
|
"uuid": "^11.1.0"
|
||||||
|
|||||||
19
pnpm-lock.yaml
generated
19
pnpm-lock.yaml
generated
@@ -9,8 +9,8 @@ importers:
|
|||||||
.:
|
.:
|
||||||
dependencies:
|
dependencies:
|
||||||
'@musistudio/llms':
|
'@musistudio/llms':
|
||||||
specifier: ^1.0.9
|
specifier: ^1.0.10
|
||||||
version: 1.0.9(ws@8.18.3)(zod@3.25.67)
|
version: 1.0.10(ws@8.18.3)(zod@3.25.67)
|
||||||
dotenv:
|
dotenv:
|
||||||
specifier: ^16.4.7
|
specifier: ^16.4.7
|
||||||
version: 16.6.1
|
version: 16.6.1
|
||||||
@@ -220,13 +220,8 @@ packages:
|
|||||||
'@modelcontextprotocol/sdk':
|
'@modelcontextprotocol/sdk':
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
<<<<<<< HEAD
|
'@musistudio/llms@1.0.10':
|
||||||
'@musistudio/llms@1.0.9':
|
resolution: {integrity: sha512-s3FUykkR/IykIHb5a/5GXfwB3MSf3DjGbJlmK9injoKhSVhA9SgbP8nG2cj3AlC1Ve5bFyLS5OR4R7wxWB4oqQ==}
|
||||||
resolution: {integrity: sha512-Z4H2yMcp3riDMQKAHTxqknanXgVSah/5HwDT5YtmsXaoznQpdzXLHlF4LBMMKNF6amq0R+MPfaPsjK8Lyddmxg==}
|
|
||||||
=======
|
|
||||||
'@musistudio/llms@1.0.8':
|
|
||||||
resolution: {integrity: sha512-C2GFoiw/DEo2faAQerRVOyWEupTJpoV+3z3rE9XEN31ySOcsaVPnKyWPmKKg9EDMBw70gQg5FZFg3jZxSCnWlA==}
|
|
||||||
>>>>>>> 2fc79dcf377ade7c4fc8883c94a6779fce830a5a
|
|
||||||
|
|
||||||
'@nodelib/fs.scandir@2.1.5':
|
'@nodelib/fs.scandir@2.1.5':
|
||||||
resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==}
|
resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==}
|
||||||
@@ -820,11 +815,7 @@ snapshots:
|
|||||||
- supports-color
|
- supports-color
|
||||||
- utf-8-validate
|
- utf-8-validate
|
||||||
|
|
||||||
<<<<<<< HEAD
|
'@musistudio/llms@1.0.10(ws@8.18.3)(zod@3.25.67)':
|
||||||
'@musistudio/llms@1.0.9(ws@8.18.3)(zod@3.25.67)':
|
|
||||||
=======
|
|
||||||
'@musistudio/llms@1.0.8(ws@8.18.3)(zod@3.25.67)':
|
|
||||||
>>>>>>> 2fc79dcf377ade7c4fc8883c94a6779fce830a5a
|
|
||||||
dependencies:
|
dependencies:
|
||||||
'@anthropic-ai/sdk': 0.54.0
|
'@anthropic-ai/sdk': 0.54.0
|
||||||
'@fastify/cors': 11.0.1
|
'@fastify/cors': 11.0.1
|
||||||
|
|||||||
@@ -14,7 +14,10 @@ const getUseModel = (req: any, tokenCount: number, config: any) => {
|
|||||||
return config.Router.longContext;
|
return config.Router.longContext;
|
||||||
}
|
}
|
||||||
// If the model is claude-3-5-haiku, use the background model
|
// If the model is claude-3-5-haiku, use the background model
|
||||||
if (req.body.model?.startsWith("claude-3-5-haiku") && config.Router.background) {
|
if (
|
||||||
|
req.body.model?.startsWith("claude-3-5-haiku") &&
|
||||||
|
config.Router.background
|
||||||
|
) {
|
||||||
log("Using background model for ", req.body.model);
|
log("Using background model for ", req.body.model);
|
||||||
return config.Router.background;
|
return config.Router.background;
|
||||||
}
|
}
|
||||||
@@ -23,6 +26,9 @@ const getUseModel = (req: any, tokenCount: number, config: any) => {
|
|||||||
log("Using think model for ", req.body.thinking);
|
log("Using think model for ", req.body.thinking);
|
||||||
return config.Router.think;
|
return config.Router.think;
|
||||||
}
|
}
|
||||||
|
if (Array.isArray(req.body.tools) && req.body.tools.some(tool => tool.type?.startsWith('web_search')) && config.Router.webSearch) {
|
||||||
|
return config.Router.webSearch;
|
||||||
|
}
|
||||||
return config.Router!.default;
|
return config.Router!.default;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user