@musistudio/claude-code-router 1.0.25 → 1.0.26
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 +33 -0
- package/README_zh.md +32 -0
- package/config.example.json +32 -0
- package/dist/cli.js +6 -6
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -101,6 +101,38 @@ Here is a comprehensive example:
|
|
|
101
101
|
"transformer": {
|
|
102
102
|
"use": ["deepseek"]
|
|
103
103
|
}
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
"name": "modelscope",
|
|
107
|
+
"api_base_url": "https://api-inference.modelscope.cn/v1/chat/completions",
|
|
108
|
+
"api_key": "",
|
|
109
|
+
"models": ["Qwen/Qwen3-Coder-480B-A35B-Instruct"],
|
|
110
|
+
"transformer": {
|
|
111
|
+
"use": [
|
|
112
|
+
[
|
|
113
|
+
"maxtoken",
|
|
114
|
+
{
|
|
115
|
+
"max_tokens": 8192
|
|
116
|
+
}
|
|
117
|
+
]
|
|
118
|
+
]
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
"name": "dashscope",
|
|
123
|
+
"api_base_url": "https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions",
|
|
124
|
+
"api_key": "",
|
|
125
|
+
"models": ["qwen3-coder-plus"],
|
|
126
|
+
"transformer": {
|
|
127
|
+
"use": [
|
|
128
|
+
[
|
|
129
|
+
"maxtoken",
|
|
130
|
+
{
|
|
131
|
+
"max_tokens": 8192
|
|
132
|
+
}
|
|
133
|
+
]
|
|
134
|
+
]
|
|
135
|
+
}
|
|
104
136
|
}
|
|
105
137
|
],
|
|
106
138
|
"Router": {
|
|
@@ -380,5 +412,6 @@ A huge thank you to all our sponsors for their generous support!
|
|
|
380
412
|
- @*琢
|
|
381
413
|
- @*成
|
|
382
414
|
- @Z*o
|
|
415
|
+
- @*琨
|
|
383
416
|
|
|
384
417
|
(If your name is masked, please contact me via my homepage email to update it with your GitHub username.)
|
package/README_zh.md
CHANGED
|
@@ -98,6 +98,38 @@ npm install -g @musistudio/claude-code-router
|
|
|
98
98
|
"transformer": {
|
|
99
99
|
"use": ["deepseek"]
|
|
100
100
|
}
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
"name": "modelscope",
|
|
104
|
+
"api_base_url": "https://api-inference.modelscope.cn/v1/chat/completions",
|
|
105
|
+
"api_key": "",
|
|
106
|
+
"models": ["Qwen/Qwen3-Coder-480B-A35B-Instruct"],
|
|
107
|
+
"transformer": {
|
|
108
|
+
"use": [
|
|
109
|
+
[
|
|
110
|
+
"maxtoken",
|
|
111
|
+
{
|
|
112
|
+
"max_tokens": 8192
|
|
113
|
+
}
|
|
114
|
+
]
|
|
115
|
+
]
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
"name": "dashscope",
|
|
120
|
+
"api_base_url": "https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions",
|
|
121
|
+
"api_key": "",
|
|
122
|
+
"models": ["qwen3-coder-plus"],
|
|
123
|
+
"transformer": {
|
|
124
|
+
"use": [
|
|
125
|
+
[
|
|
126
|
+
"maxtoken",
|
|
127
|
+
{
|
|
128
|
+
"max_tokens": 8192
|
|
129
|
+
}
|
|
130
|
+
]
|
|
131
|
+
]
|
|
132
|
+
}
|
|
101
133
|
}
|
|
102
134
|
],
|
|
103
135
|
"Router": {
|
package/config.example.json
CHANGED
|
@@ -65,6 +65,38 @@
|
|
|
65
65
|
]
|
|
66
66
|
]
|
|
67
67
|
}
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"name": "modelscope",
|
|
71
|
+
"api_base_url": "https://api-inference.modelscope.cn/v1/chat/completions",
|
|
72
|
+
"api_key": "",
|
|
73
|
+
"models": ["Qwen/Qwen3-Coder-480B-A35B-Instruct"],
|
|
74
|
+
"transformer": {
|
|
75
|
+
"use": [
|
|
76
|
+
[
|
|
77
|
+
"maxtoken",
|
|
78
|
+
{
|
|
79
|
+
"max_tokens": 8192
|
|
80
|
+
}
|
|
81
|
+
]
|
|
82
|
+
]
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"name": "dashscope",
|
|
87
|
+
"api_base_url": "https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions",
|
|
88
|
+
"api_key": "",
|
|
89
|
+
"models": ["qwen3-coder-plus"],
|
|
90
|
+
"transformer": {
|
|
91
|
+
"use": [
|
|
92
|
+
[
|
|
93
|
+
"maxtoken",
|
|
94
|
+
{
|
|
95
|
+
"max_tokens": 8192
|
|
96
|
+
}
|
|
97
|
+
]
|
|
98
|
+
]
|
|
99
|
+
}
|
|
68
100
|
}
|
|
69
101
|
],
|
|
70
102
|
"Router": {
|
package/dist/cli.js
CHANGED
|
@@ -54958,7 +54958,7 @@ var initConfig = async () => {
|
|
|
54958
54958
|
return config;
|
|
54959
54959
|
};
|
|
54960
54960
|
|
|
54961
|
-
// node_modules/.pnpm/@musistudio+llms@1.0.
|
|
54961
|
+
// node_modules/.pnpm/@musistudio+llms@1.0.12_ws@8.18.3_zod@3.25.67/node_modules/@musistudio/llms/dist/esm/server.mjs
|
|
54962
54962
|
var import_fastify = __toESM(require_fastify(), 1);
|
|
54963
54963
|
var import_cors = __toESM(require_cors(), 1);
|
|
54964
54964
|
var import_fs = require("fs");
|
|
@@ -55607,7 +55607,7 @@ var D = class {
|
|
|
55607
55607
|
endPoint = "/v1beta/models/:modelAndAction";
|
|
55608
55608
|
async transformRequestIn(e, t) {
|
|
55609
55609
|
let n = [], o = e.tools?.filter((c) => c.function.name !== "web_search")?.map((c) => (c.function.parameters && ne(c.function.parameters), { name: c.function.name, description: c.function.description, parameters: c.function.parameters }));
|
|
55610
|
-
return o?.length && n.push({ functionDeclarations: o }), e.tools?.find((c) => c.function.name === "web_search") && n.push({
|
|
55610
|
+
return o?.length && n.push({ functionDeclarations: o }), e.tools?.find((c) => c.function.name === "web_search") && n.push({ googleSearch: {} }), { body: { contents: e.messages.map((c) => {
|
|
55611
55611
|
let d;
|
|
55612
55612
|
c.role === "assistant" ? d = "model" : (["user", "system", "tool"].includes(c.role), d = "user");
|
|
55613
55613
|
let l = [];
|
|
@@ -55629,7 +55629,7 @@ var D = class {
|
|
|
55629
55629
|
}
|
|
55630
55630
|
async transformResponseOut(e) {
|
|
55631
55631
|
if (e.headers.get("Content-Type")?.includes("application/json")) {
|
|
55632
|
-
let t = await e.json(), n = t.candidates[0].content
|
|
55632
|
+
let t = await e.json(), n = t.candidates[0].content?.parts?.filter((r) => r.functionCall)?.map((r) => ({ id: r.functionCall?.id || `tool_${Math.random().toString(36).substring(2, 15)}`, type: "function", function: { name: r.functionCall?.name, arguments: JSON.stringify(r.functionCall?.args || {}) } })) || [], o = { id: t.responseId, choices: [{ finish_reason: t.candidates[0].finishReason?.toLowerCase() || null, index: 0, message: { content: t.candidates[0].content?.parts?.filter((r) => r.text)?.map((r) => r.text)?.join(`
|
|
55633
55633
|
`), role: "assistant", tool_calls: n.length > 0 ? n : void 0 } }], created: parseInt((/* @__PURE__ */ new Date()).getTime() / 1e3 + "", 10), model: t.modelVersion, object: "chat.completion", usage: { completion_tokens: t.usageMetadata.candidatesTokenCount, prompt_tokens: t.usageMetadata.promptTokenCount, total_tokens: t.usageMetadata.totalTokenCount } };
|
|
55634
55634
|
return new Response(JSON.stringify(o), { status: e.status, statusText: e.statusText, headers: e.headers });
|
|
55635
55635
|
} else if (e.headers.get("Content-Type")?.includes("stream")) {
|
|
@@ -55640,7 +55640,7 @@ var D = class {
|
|
|
55640
55640
|
if (l) {
|
|
55641
55641
|
v("gemini chunk:", l);
|
|
55642
55642
|
try {
|
|
55643
|
-
let s = JSON.parse(l), p = s.candidates[0].content
|
|
55643
|
+
let s = JSON.parse(l), p = s.candidates[0].content?.parts?.filter((k) => k.functionCall)?.map((k) => ({ id: k.functionCall?.id || `tool_${Math.random().toString(36).substring(2, 15)}`, type: "function", function: { name: k.functionCall?.name, arguments: JSON.stringify(k.functionCall?.args || {}) } })), _ = { choices: [{ delta: { role: "assistant", content: s.candidates[0].content?.parts?.filter((k) => k.text)?.map((k) => k.text)?.join(`
|
|
55644
55644
|
`), tool_calls: p.length > 0 ? p : void 0 }, finish_reason: s.candidates[0].finishReason?.toLowerCase() || null, index: s.candidates[0].index || p.length > 0 ? 1 : 0, logprobs: null }], created: parseInt((/* @__PURE__ */ new Date()).getTime() / 1e3 + "", 10), id: s.responseId || "", model: s.modelVersion || "", object: "chat.completion.chunk", system_fingerprint: "fp_a49d71b8a1", usage: { completion_tokens: s.usageMetadata.candidatesTokenCount, prompt_tokens: s.usageMetadata.promptTokenCount, total_tokens: s.usageMetadata.totalTokenCount } };
|
|
55645
55645
|
s.candidates[0]?.groundingMetadata?.groundingChunks?.length && (_.choices[0].delta.annotations = s.candidates[0].groundingMetadata.groundingChunks.map((k, g) => {
|
|
55646
55646
|
let u = s.candidates[0]?.groundingMetadata?.groundingSupports?.filter((a) => a.groundingChunkIndices.includes(g));
|
|
@@ -55654,7 +55654,7 @@ var D = class {
|
|
|
55654
55654
|
}
|
|
55655
55655
|
}
|
|
55656
55656
|
}, r = new ReadableStream({ async start(c) {
|
|
55657
|
-
let d = e.
|
|
55657
|
+
let d = e.bofdy.getReader(), l = "";
|
|
55658
55658
|
try {
|
|
55659
55659
|
for (; ; ) {
|
|
55660
55660
|
let { done: s, value: p } = await d.read();
|
|
@@ -56572,7 +56572,7 @@ async function executeCodeCommand(args = []) {
|
|
|
56572
56572
|
}
|
|
56573
56573
|
|
|
56574
56574
|
// package.json
|
|
56575
|
-
var version = "1.0.
|
|
56575
|
+
var version = "1.0.26";
|
|
56576
56576
|
|
|
56577
56577
|
// src/cli.ts
|
|
56578
56578
|
var import_child_process2 = require("child_process");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@musistudio/claude-code-router",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.26",
|
|
4
4
|
"description": "Use Claude Code without an Anthropics account and route it to another LLM provider",
|
|
5
5
|
"bin": {
|
|
6
6
|
"ccr": "./dist/cli.js"
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"author": "musistudio",
|
|
20
20
|
"license": "MIT",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@musistudio/llms": "^1.0.
|
|
22
|
+
"@musistudio/llms": "^1.0.12",
|
|
23
23
|
"dotenv": "^16.4.7",
|
|
24
24
|
"tiktoken": "^1.0.21",
|
|
25
25
|
"uuid": "^11.1.0"
|