@euraika-bert/claude-model-router 0.1.4 → 0.1.5
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 +3 -3
- package/bin/claude-model-router.mjs +5 -5
- package/files/configure.mjs +19 -19
- package/files/models-sync.mjs +1 -1
- package/files/update-check.mjs +2 -2
- package/install.ps1 +9 -9
- package/install.sh +11 -11
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -93,7 +93,7 @@ Wat de sync doet:
|
|
|
93
93
|
|
|
94
94
|
1. **Routeren.** Elk ID en elke alias uit de catalogus gaat naar die provider. Die routering gaat vóór de Aliyun-regel, dus Mistral-modellen als `glm-5-2` gaan naar Mistral.
|
|
95
95
|
2. **Kiezen.** Modellen met minstens 100k context die nog niet in `/model` staan, worden kandidaat. Per groep aliassen kiest de router één ID: bij voorkeur een `-latest`-alias, anders het kortste ID. Modellen met 1M context krijgen `[1m]`.
|
|
96
|
-
3. **Testen.** Elke nieuwe kandidaat krijgt eerst een echte test via de router: een tool-aanroep zonder streaming en daarna een gestreamd antwoord op het toolresultaat, zonder failover. Pas als die slaagt, komt het model in `modelPicker.options`, met de beschrijving *
|
|
96
|
+
3. **Testen.** Elke nieuwe kandidaat krijgt eerst een echte test via de router: een tool-aanroep zonder streaming en daarna een gestreamd antwoord op het toolresultaat, zonder failover. Pas als die slaagt, komt het model in `modelPicker.options`, met de beschrijving *Auto-added from the … catalog* en `autoCompactWindow` gelijk aan de context (maximaal 1M). Een mislukte test (bv. door een opgebruikt quotum) wordt bij de volgende sync herhaald; de reden staat in `/__health` onder `modelSync.probeFailures`.
|
|
97
97
|
4. **Klasse.** `behavesAs` volgt uit de naam:
|
|
98
98
|
- `astra` → Fable
|
|
99
99
|
- `luna`, `small`, `ministral` → Haiku
|
|
@@ -139,7 +139,7 @@ De installatie:
|
|
|
139
139
|
|
|
140
140
|
1. kopieert de routerbestanden naar `~/.claude/` en een reservekopie naar `~/.local/share/claude-model-router/`;
|
|
141
141
|
2. installeert het herstelcommando als `~/.local/bin/claude-model-router-setup`;
|
|
142
|
-
3. vraagt je Mistral API-key, Aliyun token-plan key en MiniMax M Plan key via een verborgen prompt als die nog niet in de Keychain staan (Enter =
|
|
142
|
+
3. vraagt je Mistral API-key, Aliyun token-plan key en MiniMax M Plan key via een verborgen prompt als die nog niet in de Keychain staan (Enter = skip);
|
|
143
143
|
4. detecteert welke providers bruikbaar zijn: de Keychain-items `claude-code-mistral`/`claude-code-aliyun`/`claude-code-minimax`, `kimi login` en `codex login`;
|
|
144
144
|
5. maakt een back-up van `~/.claude/settings.json` in `~/.claude/backups/` en zet alleen de instellingen van die providers erin; items van providers zonder login worden weggehaald;
|
|
145
145
|
6. installeert en start `com.bert.claude-kimi-router` als LaunchAgent, en toont welke providers zijn overgeslagen en hoe je ze aanzet.
|
|
@@ -306,7 +306,7 @@ Pas daarna op elk systeem `~/.claude/settings.json` aan; maak vooraf een back-up
|
|
|
306
306
|
- `ANTHROPIC_BASE_URL` en `_CLAUDE_CODE_ASSUME_FIRST_PARTY_BASE_URL`;
|
|
307
307
|
- de Kimi-waarden `ANTHROPIC_CUSTOM_MODEL_OPTION_*`;
|
|
308
308
|
- de SessionStart-hook met `update-check.mjs` onder `hooks`;
|
|
309
|
-
- de aangepaste `modelPicker`- en `modelSettings`-items, inclusief de items met
|
|
309
|
+
- de aangepaste `modelPicker`- en `modelSettings`-items, inclusief de automatisch toegevoegde items: hun beschrijving begint met *Auto-added from the … catalog* (bij oudere versies *Automatisch toegevoegd uit de …-catalogus*).
|
|
310
310
|
|
|
311
311
|
De macOS-Keychain-items en de Kimi- en Codex-logins blijven bestaan, tenzij je ze apart verwijdert.
|
|
312
312
|
|
|
@@ -32,10 +32,10 @@ if (command === 'version' || command === '--version' || command === '-v') {
|
|
|
32
32
|
} else {
|
|
33
33
|
console.log(`claude-model-router ${VERSION}
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
npx @euraika-bert/claude-model-router@latest install
|
|
37
|
-
claude-model-router upgrade
|
|
38
|
-
claude-model-router install
|
|
39
|
-
npx @euraika-bert/claude-model-router version
|
|
35
|
+
Usage:
|
|
36
|
+
npx @euraika-bert/claude-model-router@latest install install or update (macOS, Linux, Windows)
|
|
37
|
+
claude-model-router upgrade after npm install -g: fetch and install the latest version
|
|
38
|
+
claude-model-router install rerun the installer of this installed version
|
|
39
|
+
npx @euraika-bert/claude-model-router version show the installed package version`);
|
|
40
40
|
process.exit(command === 'help' || command === '--help' || command === '-h' ? 0 : 1);
|
|
41
41
|
}
|
package/files/configure.mjs
CHANGED
|
@@ -6,9 +6,9 @@ import path from 'node:path';
|
|
|
6
6
|
import { hasLogin } from './models-sync.mjs';
|
|
7
7
|
|
|
8
8
|
const PROVIDERS = {
|
|
9
|
-
mistral: ['Mistral (incl. GLM via Mistral)', 'Mistral API
|
|
10
|
-
aliyun: ['Aliyun (Qwen/DeepSeek/GLM)', 'Aliyun token-plan key
|
|
11
|
-
minimax: ['MiniMax (M Plan)', 'MiniMax M Plan API
|
|
9
|
+
mistral: ['Mistral (incl. GLM via Mistral)', 'enter a Mistral API key in the installer'],
|
|
10
|
+
aliyun: ['Aliyun (Qwen/DeepSeek/GLM)', 'enter an Aliyun token-plan key in the installer'],
|
|
11
|
+
minimax: ['MiniMax (M Plan)', 'enter a MiniMax M Plan API key in the installer'],
|
|
12
12
|
kimi: ['Kimi', 'kimi login'],
|
|
13
13
|
codex: ['ChatGPT/Codex', 'codex login'],
|
|
14
14
|
};
|
|
@@ -36,7 +36,7 @@ settings.env = {
|
|
|
36
36
|
const kimiOption = {
|
|
37
37
|
ANTHROPIC_CUSTOM_MODEL_OPTION: 'k3.1-pro[1m]',
|
|
38
38
|
ANTHROPIC_CUSTOM_MODEL_OPTION_NAME: 'Kimi K3.1 Pro',
|
|
39
|
-
ANTHROPIC_CUSTOM_MODEL_OPTION_DESCRIPTION: 'Kimi Code
|
|
39
|
+
ANTHROPIC_CUSTOM_MODEL_OPTION_DESCRIPTION: 'Kimi Code with 1M context; all Claude models stay available',
|
|
40
40
|
ANTHROPIC_CUSTOM_MODEL_OPTION_SUPPORTED_CAPABILITIES: 'effort,xhigh_effort,max_effort,thinking,adaptive_thinking,interleaved_thinking',
|
|
41
41
|
};
|
|
42
42
|
for (const key of Object.keys(kimiOption)) delete settings.env[key];
|
|
@@ -60,7 +60,7 @@ const curated = [
|
|
|
60
60
|
provider: 'mistral',
|
|
61
61
|
model: 'mistral-large-4[1m]',
|
|
62
62
|
label: 'Mistral Large 4',
|
|
63
|
-
description: 'Mistral
|
|
63
|
+
description: 'Mistral with 1M context; all Claude models stay available',
|
|
64
64
|
behavesAs: 'claude-opus-5-5',
|
|
65
65
|
modelSettings: oneMillion,
|
|
66
66
|
},
|
|
@@ -68,7 +68,7 @@ const curated = [
|
|
|
68
68
|
provider: 'mistral',
|
|
69
69
|
model: 'zai-glm-5-3[1m]',
|
|
70
70
|
label: 'GLM 5.3 (Mistral Hosted)',
|
|
71
|
-
description: 'GLM 5.3 via Mistral
|
|
71
|
+
description: 'GLM 5.3 via Mistral with 1M context',
|
|
72
72
|
behavesAs: 'claude-opus-5-5',
|
|
73
73
|
modelSettings: { effortLevel: 'max', autoCompactWindow: 1000000 },
|
|
74
74
|
},
|
|
@@ -76,7 +76,7 @@ const curated = [
|
|
|
76
76
|
provider: 'aliyun',
|
|
77
77
|
model: 'qwen3.8-max[1m]',
|
|
78
78
|
label: 'Qwen 3.8 Max (Aliyun)',
|
|
79
|
-
description: 'Qwen 3.8 Max via Alibaba Cloud Bailian
|
|
79
|
+
description: 'Qwen 3.8 Max via Alibaba Cloud Bailian with 1M context',
|
|
80
80
|
behavesAs: 'claude-opus-5-5',
|
|
81
81
|
modelSettings: oneMillion,
|
|
82
82
|
},
|
|
@@ -84,7 +84,7 @@ const curated = [
|
|
|
84
84
|
provider: 'aliyun',
|
|
85
85
|
model: 'qwen3.7-max[1m]',
|
|
86
86
|
label: 'Qwen 3.7 Max (Aliyun)',
|
|
87
|
-
description: 'Qwen 3.7 Max via Alibaba Cloud Bailian
|
|
87
|
+
description: 'Qwen 3.7 Max via Alibaba Cloud Bailian with 1M context',
|
|
88
88
|
behavesAs: 'claude-opus-5-5',
|
|
89
89
|
modelSettings: oneMillion,
|
|
90
90
|
},
|
|
@@ -92,7 +92,7 @@ const curated = [
|
|
|
92
92
|
provider: 'aliyun',
|
|
93
93
|
model: 'deepseek-v4-pro[1m]',
|
|
94
94
|
label: 'DeepSeek V4 Pro (Aliyun)',
|
|
95
|
-
description: 'DeepSeek V4 Pro via Alibaba Cloud Bailian
|
|
95
|
+
description: 'DeepSeek V4 Pro via Alibaba Cloud Bailian with 1M context',
|
|
96
96
|
behavesAs: 'claude-opus-5-5',
|
|
97
97
|
modelSettings: oneMillion,
|
|
98
98
|
},
|
|
@@ -100,14 +100,14 @@ const curated = [
|
|
|
100
100
|
provider: 'aliyun',
|
|
101
101
|
model: 'deepseek-v4.1-flash[1m]',
|
|
102
102
|
label: 'DeepSeek V4.1 Flash (Aliyun)',
|
|
103
|
-
description: 'DeepSeek V4.1 Flash (
|
|
103
|
+
description: 'DeepSeek V4.1 Flash (fast variant) via Alibaba Cloud Bailian with 1M context',
|
|
104
104
|
behavesAs: 'claude-sonnet-5-5',
|
|
105
105
|
},
|
|
106
106
|
{
|
|
107
107
|
provider: 'aliyun',
|
|
108
108
|
model: 'glm-5.3[1m]',
|
|
109
109
|
label: 'GLM 5.3 (Aliyun)',
|
|
110
|
-
description: 'GLM 5.3 via Alibaba Cloud Bailian
|
|
110
|
+
description: 'GLM 5.3 via Alibaba Cloud Bailian with 1M context (not the same as GLM 5.3 via Mistral)',
|
|
111
111
|
behavesAs: 'claude-opus-5-5',
|
|
112
112
|
modelSettings: oneMillion,
|
|
113
113
|
},
|
|
@@ -115,7 +115,7 @@ const curated = [
|
|
|
115
115
|
provider: 'codex',
|
|
116
116
|
model: 'gpt-6-astra',
|
|
117
117
|
label: 'GPT 6 Astra (ChatGPT/Codex)',
|
|
118
|
-
description: 'GPT 6 Astra (
|
|
118
|
+
description: 'GPT 6 Astra (top model) via the ChatGPT backend with the Codex OAuth login (codex login)',
|
|
119
119
|
behavesAs: 'claude-fable-5-2', // same class target as models-sync.mjs BEHAVES_AS.fable
|
|
120
120
|
modelSettings: { autoCompactWindow: 258400 },
|
|
121
121
|
},
|
|
@@ -123,7 +123,7 @@ const curated = [
|
|
|
123
123
|
provider: 'codex',
|
|
124
124
|
model: 'gpt-6.1-terra',
|
|
125
125
|
label: 'GPT 6.1 Terra (ChatGPT/Codex)',
|
|
126
|
-
description: 'GPT 6.1 Terra via
|
|
126
|
+
description: 'GPT 6.1 Terra via the ChatGPT backend with the Codex OAuth login (codex login)',
|
|
127
127
|
behavesAs: 'claude-sonnet-5-5',
|
|
128
128
|
modelSettings: { autoCompactWindow: 475000 },
|
|
129
129
|
},
|
|
@@ -131,7 +131,7 @@ const curated = [
|
|
|
131
131
|
provider: 'codex',
|
|
132
132
|
model: 'gpt-6.1-sol',
|
|
133
133
|
label: 'GPT 6.1 Sol (ChatGPT/Codex)',
|
|
134
|
-
description: 'GPT 6.1 Sol via
|
|
134
|
+
description: 'GPT 6.1 Sol via the ChatGPT backend with the Codex OAuth login',
|
|
135
135
|
behavesAs: 'claude-opus-5-5',
|
|
136
136
|
modelSettings: { autoCompactWindow: 475000 },
|
|
137
137
|
},
|
|
@@ -139,7 +139,7 @@ const curated = [
|
|
|
139
139
|
provider: 'codex',
|
|
140
140
|
model: 'gpt-5.6-luna',
|
|
141
141
|
label: 'GPT 5.6 Luna (ChatGPT/Codex)',
|
|
142
|
-
description: 'GPT 5.6 Luna (
|
|
142
|
+
description: 'GPT 5.6 Luna (light variant) via the ChatGPT backend with the Codex OAuth login',
|
|
143
143
|
behavesAs: 'claude-haiku-5-5',
|
|
144
144
|
modelSettings: { autoCompactWindow: 258400 },
|
|
145
145
|
},
|
|
@@ -147,7 +147,7 @@ const curated = [
|
|
|
147
147
|
provider: 'minimax',
|
|
148
148
|
model: 'MiniMax-M3.1-Flash[1m]',
|
|
149
149
|
label: 'MiniMax M3.1 Flash',
|
|
150
|
-
description: 'MiniMax M3.1 Flash (agentic coding) via api.minimax.io
|
|
150
|
+
description: 'MiniMax M3.1 Flash (agentic coding) via api.minimax.io with 1M context',
|
|
151
151
|
behavesAs: 'claude-opus-5-5',
|
|
152
152
|
modelSettings: oneMillion,
|
|
153
153
|
},
|
|
@@ -155,7 +155,7 @@ const curated = [
|
|
|
155
155
|
provider: 'minimax',
|
|
156
156
|
model: 'MiniMax-M3[1m]',
|
|
157
157
|
label: 'MiniMax M3',
|
|
158
|
-
description: 'MiniMax M3 via api.minimax.io
|
|
158
|
+
description: 'MiniMax M3 via api.minimax.io with 1M context',
|
|
159
159
|
behavesAs: 'claude-opus-5-5',
|
|
160
160
|
modelSettings: oneMillion,
|
|
161
161
|
},
|
|
@@ -184,7 +184,7 @@ if (available.has('kimi')) {
|
|
|
184
184
|
}
|
|
185
185
|
fs.writeFileSync(file, `${JSON.stringify(settings, null, 2)}\n`, { mode: 0o600 });
|
|
186
186
|
|
|
187
|
-
console.log(`
|
|
187
|
+
console.log(`Enabled providers: ${[...available].join(', ') || 'none'}`);
|
|
188
188
|
for (const [provider, [label, fix]] of Object.entries(PROVIDERS)) {
|
|
189
|
-
if (!available.has(provider)) console.log(` - ${label}
|
|
189
|
+
if (!available.has(provider)) console.log(` - ${label} skipped: ${fix}, then rerun the installer`);
|
|
190
190
|
}
|
package/files/models-sync.mjs
CHANGED
|
@@ -284,7 +284,7 @@ async function runSync(baseUrl) {
|
|
|
284
284
|
option: {
|
|
285
285
|
model: pickerId(c),
|
|
286
286
|
label: `${c.label || c.id} (${PROVIDER_LABEL[c.provider]})`,
|
|
287
|
-
description: `
|
|
287
|
+
description: `Auto-added from the ${PROVIDER_LABEL[c.provider]} catalog · ${Math.round(c.ctx / 1000)}k context`,
|
|
288
288
|
behavesAs: BEHAVES_AS[classOf(c.id)],
|
|
289
289
|
},
|
|
290
290
|
}));
|
package/files/update-check.mjs
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import path from 'node:path';
|
|
5
5
|
import { fileURLToPath } from 'node:url';
|
|
6
6
|
|
|
7
|
-
export const VERSION = '0.1.
|
|
7
|
+
export const VERSION = '0.1.5'; // keep equal to package.json (test/usage.test.mjs checks it)
|
|
8
8
|
const PACKAGE = '@euraika-bert/claude-model-router';
|
|
9
9
|
const DAY_MS = 24 * 60 * 60 * 1000;
|
|
10
10
|
let latestVersion = null;
|
|
@@ -41,7 +41,7 @@ if (process.argv.includes('--session-notice') && path.resolve(process.argv[1] ??
|
|
|
41
41
|
const health = await (await fetch('http://127.0.0.1:8765/__health', { signal: AbortSignal.timeout(1500) })).json();
|
|
42
42
|
if (health.updateAvailable) {
|
|
43
43
|
console.log(JSON.stringify({
|
|
44
|
-
systemMessage: `claude-model-router ${health.latestVersion} is
|
|
44
|
+
systemMessage: `claude-model-router ${health.latestVersion} is available (installed: ${health.version}). Update: npx @euraika-bert/claude-model-router@latest install`,
|
|
45
45
|
}));
|
|
46
46
|
}
|
|
47
47
|
} catch {} // router down or old router without update fields: stay silent
|
package/install.ps1
CHANGED
|
@@ -13,8 +13,8 @@ $TaskName = 'claude-model-router'
|
|
|
13
13
|
$Port = 8765
|
|
14
14
|
|
|
15
15
|
$node = (Get-Command node -ErrorAction SilentlyContinue).Source
|
|
16
|
-
if (-not $node) { throw 'Node.js 22
|
|
17
|
-
if ([int]((& $node --version).TrimStart('v').Split('.')[0]) -lt 22) { throw 'Node.js 22
|
|
16
|
+
if (-not $node) { throw 'Node.js 22 or later is required but was not found.' }
|
|
17
|
+
if ([int]((& $node --version).TrimStart('v').Split('.')[0]) -lt 22) { throw 'Node.js 22 or later is required.' }
|
|
18
18
|
|
|
19
19
|
New-Item -ItemType Directory -Force -Path (Join-Path $ClaudeDir 'logs'), $SecretDir | Out-Null
|
|
20
20
|
foreach ($file in 'kimi-router.mjs', 'kimi-oauth.mjs', 'mistral.mjs', 'secrets.mjs', 'codex.mjs', 'models-sync.mjs', 'update-check.mjs') {
|
|
@@ -28,13 +28,13 @@ function Save-Key([string]$Service, [string]$EnvVar, [string]$Prompt) {
|
|
|
28
28
|
if (Test-Path -LiteralPath $target) { return }
|
|
29
29
|
$plain = [Environment]::GetEnvironmentVariable($EnvVar)
|
|
30
30
|
if ($plain) { $secure = ConvertTo-SecureString $plain -AsPlainText -Force }
|
|
31
|
-
elseif (-not [Console]::IsInputRedirected) { $secure = Read-Host -AsSecureString "$Prompt (Enter =
|
|
31
|
+
elseif (-not [Console]::IsInputRedirected) { $secure = Read-Host -AsSecureString "$Prompt (Enter = skip)" }
|
|
32
32
|
else { return }
|
|
33
33
|
if ($secure.Length -gt 0) { $secure | ConvertFrom-SecureString | Set-Content -LiteralPath $target }
|
|
34
34
|
}
|
|
35
|
-
Save-Key 'claude-code-mistral' 'MISTRAL_API_KEY' 'Mistral API
|
|
36
|
-
Save-Key 'claude-code-aliyun' 'ALIYUN_API_KEY' 'Aliyun Bailian API
|
|
37
|
-
Save-Key 'claude-code-minimax' 'MINIMAX_API_KEY' 'MiniMax M Plan API
|
|
35
|
+
Save-Key 'claude-code-mistral' 'MISTRAL_API_KEY' 'Mistral API key'
|
|
36
|
+
Save-Key 'claude-code-aliyun' 'ALIYUN_API_KEY' 'Aliyun Bailian API key (token plan)'
|
|
37
|
+
Save-Key 'claude-code-minimax' 'MINIMAX_API_KEY' 'MiniMax M Plan API key'
|
|
38
38
|
Remove-Item Env:MISTRAL_API_KEY, Env:ALIYUN_API_KEY, Env:MINIMAX_API_KEY -ErrorAction SilentlyContinue
|
|
39
39
|
|
|
40
40
|
$env:ROUTER_NODE = $node # stable path for the SessionStart hook (nvm-windows symlinks resolve to versioned dirs)
|
|
@@ -73,7 +73,7 @@ foreach ($attempt in 1..30) {
|
|
|
73
73
|
try { $health = Invoke-RestMethod -Uri "http://127.0.0.1:$Port/__health" -UseBasicParsing -TimeoutSec 2; break }
|
|
74
74
|
catch { Start-Sleep -Milliseconds 500 }
|
|
75
75
|
}
|
|
76
|
-
if (-not $health) { throw "
|
|
76
|
+
if (-not $health) { throw "The router does not respond on port $Port; see $Log" }
|
|
77
77
|
Write-Host ''
|
|
78
|
-
Write-Host '
|
|
79
|
-
Write-Host "Router: http://127.0.0.1:$Port (
|
|
78
|
+
Write-Host 'Done. All built-in Claude models stay available in /model.'
|
|
79
|
+
Write-Host "Router: http://127.0.0.1:$Port (task '$TaskName', log $Log). Restart Claude Code."
|
package/install.sh
CHANGED
|
@@ -15,7 +15,7 @@ SYSTEMD_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/systemd/user"
|
|
|
15
15
|
UNIT="claude-model-router.service"
|
|
16
16
|
|
|
17
17
|
if [[ "$OS" != Darwin && "$OS" != Linux ]]; then
|
|
18
|
-
printf '
|
|
18
|
+
printf 'Unsupported OS: %s. Use install.ps1 on Windows.\n' "$OS" >&2
|
|
19
19
|
exit 1
|
|
20
20
|
fi
|
|
21
21
|
|
|
@@ -28,7 +28,7 @@ if [[ -d "$REPO_DIR/files" ]]; then
|
|
|
28
28
|
cp "$REPO_DIR/files/"* "$SOURCE_DIR/"
|
|
29
29
|
fi
|
|
30
30
|
if [[ ! -f "$SOURCE_DIR/kimi-router.mjs" ]]; then
|
|
31
|
-
printf '
|
|
31
|
+
printf 'Backup copy missing in %s\n' "$SOURCE_DIR" >&2
|
|
32
32
|
exit 1
|
|
33
33
|
fi
|
|
34
34
|
|
|
@@ -40,7 +40,7 @@ for candidate in "$HOME/.local/bin/node" /opt/homebrew/bin/node /usr/local/bin/n
|
|
|
40
40
|
fi
|
|
41
41
|
done
|
|
42
42
|
if [[ -z "$NODE_BIN" ]]; then
|
|
43
|
-
printf 'Node.js is
|
|
43
|
+
printf 'Node.js 22 or later is required but was not found.\n' >&2
|
|
44
44
|
exit 1
|
|
45
45
|
fi
|
|
46
46
|
|
|
@@ -110,15 +110,15 @@ store_key() { # <service> <env var> <prompt>
|
|
|
110
110
|
key_stored "$1" && return 0
|
|
111
111
|
key="${!2:-}"
|
|
112
112
|
if [[ -z "$key" && -t 0 ]]; then
|
|
113
|
-
read -r -s -p "$3 (Enter =
|
|
113
|
+
read -r -s -p "$3 (Enter = skip): " key
|
|
114
114
|
printf '\n'
|
|
115
115
|
fi
|
|
116
116
|
[[ -n "$key" ]] || return 0
|
|
117
117
|
write_key "$1" "$key"
|
|
118
118
|
}
|
|
119
|
-
store_key claude-code-mistral MISTRAL_API_KEY 'Mistral API
|
|
120
|
-
store_key claude-code-aliyun ALIYUN_API_KEY 'Aliyun Bailian API
|
|
121
|
-
store_key claude-code-minimax MINIMAX_API_KEY 'MiniMax M Plan API
|
|
119
|
+
store_key claude-code-mistral MISTRAL_API_KEY 'Mistral API key'
|
|
120
|
+
store_key claude-code-aliyun ALIYUN_API_KEY 'Aliyun Bailian API key (token plan)'
|
|
121
|
+
store_key claude-code-minimax MINIMAX_API_KEY 'MiniMax M Plan API key'
|
|
122
122
|
unset MISTRAL_API_KEY ALIYUN_API_KEY MINIMAX_API_KEY
|
|
123
123
|
|
|
124
124
|
ROUTER_NODE="$NODE_BIN" "$NODE_BIN" "$SOURCE_DIR/configure.mjs"
|
|
@@ -143,12 +143,12 @@ for _ in {1..20}; do
|
|
|
143
143
|
sleep 0.5
|
|
144
144
|
done
|
|
145
145
|
HEALTH="$(curl --fail --silent http://127.0.0.1:8765/__health)" || {
|
|
146
|
-
printf '
|
|
146
|
+
printf 'The router does not respond on port 8765; see %s\n' "$CLAUDE_DIR/logs/kimi-router.error.log" >&2
|
|
147
147
|
exit 1
|
|
148
148
|
}
|
|
149
149
|
ROUTER_VERSION="$(printf '%s' "$HEALTH" | "$NODE_BIN" -e 'let s="";process.stdin.on("data",(d)=>(s+=d)).on("end",()=>{try{console.log(JSON.parse(s).version??"?")}catch{console.log("?")}})')"
|
|
150
|
-
printf '\
|
|
151
|
-
printf 'Router %s: http://127.0.0.1:8765 (logs in %s).
|
|
150
|
+
printf '\nDone. All built-in Claude models stay available in /model.\n'
|
|
151
|
+
printf 'Router %s: http://127.0.0.1:8765 (logs in %s). Restart Claude Code.\n' "$ROUTER_VERSION" "$CLAUDE_DIR/logs"
|
|
152
152
|
if [[ "$OS" == Linux ]] && ! loginctl show-user "$USER" -p Linger 2>/dev/null | grep -q yes; then
|
|
153
|
-
printf 'Tip:
|
|
153
|
+
printf 'Tip: the router starts when you log in. To run it without a login session too (e.g. over SSH): loginctl enable-linger %s\n' "$USER"
|
|
154
154
|
fi
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@euraika-bert/claude-model-router",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"description": "Local router that adds Kimi, Mistral/GLM, Aliyun Qwen/DeepSeek, ChatGPT/Codex and MiniMax models to Claude Code without replacing the built-in Claude models (macOS, Linux, Windows).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|