@dedenlabs/claude-code-router-cli 2.0.6-beta.1 → 2.0.7
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 +20 -4
- package/dist/cli.js +32 -9
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
# Claude Code Router CLI v2.0.
|
|
1
|
+
# Claude Code Router CLI v2.0.7
|
|
2
2
|
|
|
3
3
|
<div align="center">
|
|
4
4
|
|
|
5
|
-
[](https://github.com/dedenlabs/claude-code-router-cli)
|
|
6
6
|
[](LICENSE)
|
|
7
7
|
[](https://nodejs.org/)
|
|
8
8
|
[](https://www.typescriptlang.org/)
|
|
@@ -114,10 +114,10 @@ ccr start -b
|
|
|
114
114
|
|
|
115
115
|
**修改配置文件:**
|
|
116
116
|
|
|
117
|
-
|
|
117
|
+
启动服务后会创建默认配置,您可以通过两种方式编辑路由规则和替换密钥:
|
|
118
118
|
|
|
119
119
|
1. **手动编辑**:修改 `~/.claude-code-router/config.json` 配置文件
|
|
120
|
-
2. **可视化界面**:访问 http://localhost:3456/ui/
|
|
120
|
+
2. **可视化界面**:访问 http://localhost:3456/ui/
|
|
121
121
|
|
|
122
122
|
推荐使用模型替换规则,只需修改路由映射,所有IDE工具无需改动:
|
|
123
123
|
|
|
@@ -695,6 +695,22 @@ export class MyTransformer extends BaseTransformer {
|
|
|
695
695
|
|
|
696
696
|
## 📈 版本历史
|
|
697
697
|
|
|
698
|
+
### v2.0.6 (2025-12-23)
|
|
699
|
+
|
|
700
|
+
**🎯 正式版本发布**
|
|
701
|
+
|
|
702
|
+
**✅ 路由规则优化**
|
|
703
|
+
- 修复规则路由provider模型自动补全功能
|
|
704
|
+
- 优化统一路由引擎的字段兼容性处理
|
|
705
|
+
- 增强路由决策的准确性和稳定性
|
|
706
|
+
- 完善调试日志和错误处理机制
|
|
707
|
+
|
|
708
|
+
**📚 文档完善**
|
|
709
|
+
- 修复README文档中的版本徽章显示错误
|
|
710
|
+
- 完善统一路由引擎使用指南
|
|
711
|
+
- 添加更多配置示例和使用场景
|
|
712
|
+
- 优化文档结构和用户体验
|
|
713
|
+
|
|
698
714
|
### v2.0.5 (2025-12-21)
|
|
699
715
|
|
|
700
716
|
**🔧 UI修复版本**
|
package/dist/cli.js
CHANGED
|
@@ -67706,7 +67706,7 @@ var require_package3 = __commonJS({
|
|
|
67706
67706
|
"package.json"(exports2, module2) {
|
|
67707
67707
|
module2.exports = {
|
|
67708
67708
|
name: "@dedenlabs/claude-code-router-cli",
|
|
67709
|
-
version: "2.0.6
|
|
67709
|
+
version: "2.0.6",
|
|
67710
67710
|
description: "\u57FA\u4E8E@musistudio/claude-code-router\u7684\u589E\u5F3A\u7248CLI\u8DEF\u7531\u5DE5\u5177 - \u652F\u6301\u7EDF\u4E00\u8DEF\u7531\u5F15\u64CE\u3001\u5916\u90E8\u89C4\u5219\u52A0\u8F7D\u3001\u667A\u80FD\u65E5\u5FD7\u7CFB\u7EDF\u3001\u81EA\u52A8\u914D\u7F6E\u8FC1\u79FB\u548CGLM\u601D\u8003\u6A21\u5F0F",
|
|
67711
67711
|
bin: {
|
|
67712
67712
|
ccr: "dist/cli.js"
|
|
@@ -85096,9 +85096,31 @@ ${allLines[totalLines - 1] || ""}`
|
|
|
85096
85096
|
switch (customFunction) {
|
|
85097
85097
|
case "modelContainsComma":
|
|
85098
85098
|
return context.req?.body?.model?.includes(",") || false;
|
|
85099
|
+
case "directProviderMapping":
|
|
85099
85100
|
case "directModelMapping":
|
|
85100
85101
|
const model = context.req?.body?.model;
|
|
85101
|
-
|
|
85102
|
+
if (!model || model.includes(",")) {
|
|
85103
|
+
return false;
|
|
85104
|
+
}
|
|
85105
|
+
const providers = context.req?.config?.Providers || [];
|
|
85106
|
+
const modelStr = String(model).toLowerCase();
|
|
85107
|
+
for (const provider of providers) {
|
|
85108
|
+
if (provider.models && Array.isArray(provider.models)) {
|
|
85109
|
+
if (provider.models.some((m) => String(m).toLowerCase() === modelStr)) {
|
|
85110
|
+
return true;
|
|
85111
|
+
}
|
|
85112
|
+
}
|
|
85113
|
+
if (String(provider.model || "").toLowerCase() === modelStr) {
|
|
85114
|
+
return true;
|
|
85115
|
+
}
|
|
85116
|
+
}
|
|
85117
|
+
const matchedProvider = providers.find(
|
|
85118
|
+
(p) => String(p.name).toLowerCase() === modelStr
|
|
85119
|
+
);
|
|
85120
|
+
if (matchedProvider) {
|
|
85121
|
+
return true;
|
|
85122
|
+
}
|
|
85123
|
+
return false;
|
|
85102
85124
|
default:
|
|
85103
85125
|
this.logger.warn(`\u672A\u77E5\u7684\u81EA\u5B9A\u4E49\u6761\u4EF6\u51FD\u6570: ${customFunction}`);
|
|
85104
85126
|
return false;
|
|
@@ -85209,10 +85231,10 @@ ${allLines[totalLines - 1] || ""}`
|
|
|
85209
85231
|
this.logger.debug("${subagent} \u53D8\u91CF\u66FF\u6362\u5931\u8D25\uFF0C\u4FDD\u6301\u539F\u6837");
|
|
85210
85232
|
return processedRoute;
|
|
85211
85233
|
}
|
|
85212
|
-
this.logger.
|
|
85213
|
-
`\u53D8\u91CF\u66FF\u6362\u672A\u5B8C\u6210\uFF0C\u4ECD\u5305\u542B\u672A\u66FF\u6362\u7684\u53D8\u91CF: ${processedRoute}\uFF0C\
|
|
85234
|
+
this.logger.debug(
|
|
85235
|
+
`\u53D8\u91CF\u66FF\u6362\u672A\u5B8C\u6210\uFF0C\u4ECD\u5305\u542B\u672A\u66FF\u6362\u7684\u53D8\u91CF: ${processedRoute}\uFF0C\u4FDD\u6301\u539F\u6837\u8FD4\u56DE`
|
|
85214
85236
|
);
|
|
85215
|
-
return
|
|
85237
|
+
return processedRoute;
|
|
85216
85238
|
}
|
|
85217
85239
|
return processedRoute;
|
|
85218
85240
|
}
|
|
@@ -85494,12 +85516,13 @@ function migrateLegacyConfig(legacy) {
|
|
|
85494
85516
|
enabled: true,
|
|
85495
85517
|
condition: {
|
|
85496
85518
|
type: "custom",
|
|
85497
|
-
customFunction: "
|
|
85519
|
+
customFunction: "directProviderMapping"
|
|
85520
|
+
// 新名称,兼容旧版本使用 directModelMapping
|
|
85498
85521
|
},
|
|
85499
85522
|
action: {
|
|
85500
85523
|
route: "${mappedModel}",
|
|
85501
85524
|
transformers: [],
|
|
85502
|
-
description: "\
|
|
85525
|
+
description: "Provider\u6620\u5C04\uFF1A\u9A8C\u8BC1\u5E76\u6620\u5C04provider\u540D\u79F0\u5230\u5176\u9ED8\u8BA4\u6A21\u578B"
|
|
85503
85526
|
}
|
|
85504
85527
|
});
|
|
85505
85528
|
rules.push({
|
|
@@ -87261,7 +87284,7 @@ try {
|
|
|
87261
87284
|
};
|
|
87262
87285
|
}
|
|
87263
87286
|
} catch (error) {
|
|
87264
|
-
packageInfo = { name: "Claude Code Router CLI", version: "2.0.
|
|
87287
|
+
packageInfo = { name: "Claude Code Router CLI", version: "2.0.6" };
|
|
87265
87288
|
}
|
|
87266
87289
|
function formatPackageName(packageName) {
|
|
87267
87290
|
const cleanName = packageName.replace(/^@[^/]+\//, "");
|
|
@@ -87606,7 +87629,7 @@ async function run(options = {}) {
|
|
|
87606
87629
|
const primaryIP = getPrimaryIP(HOST);
|
|
87607
87630
|
const url = HOST === "0.0.0.0" ? `http://${primaryIP}:${servicePort}` : `http://127.0.0.1:${servicePort}`;
|
|
87608
87631
|
const formattedName = packageInfo ? formatPackageName(packageInfo.name) : "Claude Code Router CLI";
|
|
87609
|
-
const version2 = packageInfo?.version || "2.0.
|
|
87632
|
+
const version2 = packageInfo?.version || "2.0.6";
|
|
87610
87633
|
console.log(`
|
|
87611
87634
|
\u{1F680} ${formattedName} v${version2} is running on ${url}`);
|
|
87612
87635
|
if (HOST === "0.0.0.0" && accessibleIPs.length > 0) {
|