@euraika-bert/claude-model-router 0.1.5 → 0.1.6

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 CHANGED
@@ -1,71 +1,73 @@
1
1
  # Claude Model Router
2
2
 
3
- Een lokale router voor macOS, Linux en Windows die extra modellen aan Claude Code toevoegt zonder de ingebouwde Claude-modellen te vervangen.
3
+ A local router for macOS, Linux and Windows that adds extra models to Claude Code without replacing the built-in Claude models.
4
4
 
5
- Beschikbaar via `/model`, telkens alleen voor de providers waarvoor je een key of login hebt:
5
+ Available through `/model`, each only for the providers you have a key or login for:
6
6
 
7
- - **Alle Claude-modellen**, ongewijzigd via Anthropic, inclusief nieuwe modellen zoals **Fable 5.2** zodra Anthropic ze aanbiedt.
8
- - **Kimi K3.1 Pro** met 1M context, via je bestaande Kimi Code-OAuth-login.
9
- - **Mistral Large 4** en **GLM 5.3 (Mistral Hosted)** met 1M context, via een Mistral API-key.
10
- - **Qwen 3.8/3.7 Max**, **DeepSeek V4 Pro**, **DeepSeek V4.1 Flash** en **GLM 5.3** met 1M context, via Alibaba Cloud Bailian (token plan, regio `ap-southeast-1`).
11
- - **GPT 6 Astra**, **GPT 6.1 Terra**, **GPT 6.1 Sol** en **GPT 5.6 Luna** via je ChatGPT-account (login van de Codex CLI).
12
- - **MiniMax M3.1 Flash** en **MiniMax M3** met 1M context, via een MiniMax M Plan API-key.
13
- - **Automatisch toegevoegde modellen** uit de catalogi van Mistral, Kimi en ChatGPT/Codex; zie [Automatische modelsynchronisatie](#automatische-modelsynchronisatie).
7
+ - **All Claude models**, passed through to Anthropic unchanged, including new models such as **Fable 5.2** as soon as Anthropic offers them.
8
+ - **Kimi K3.1 Pro** with 1M context, through your existing Kimi Code OAuth login.
9
+ - **Mistral Large 4** and **GLM 5.3 (Mistral Hosted)** with 1M context, through a Mistral API key.
10
+ - **Qwen 3.8/3.7 Max**, **DeepSeek V4 Pro**, **DeepSeek V4.1 Flash** and **GLM 5.3** with 1M context, through Alibaba Cloud Bailian (token plan, region `ap-southeast-1`).
11
+ - **GPT 6 Astra**, **GPT 6.1 Terra**, **GPT 6.1 Sol** and **GPT 5.6 Luna** through your ChatGPT account (the Codex CLI login).
12
+ - **MiniMax M3.1 Flash** and **MiniMax M3** with 1M context, through a MiniMax M Plan API key.
13
+ - **Auto-added models** from the Mistral, Kimi and ChatGPT/Codex catalogs; see [Automatic model sync](#automatic-model-sync).
14
14
 
15
- ## Snel starten
15
+ ## Quick start
16
16
 
17
- Vereist Node.js 22 of later en Claude Code. Installeren of updaten op macOS, Linux en Windows:
17
+ Requires Node.js 22 or later and Claude Code. Install or update on macOS, Linux and Windows:
18
18
 
19
19
  ```bash
20
20
  npx @euraika-bert/claude-model-router@latest install
21
21
  ```
22
22
 
23
- Of installeer het commando globaal met npm:
23
+ Or install the command globally with npm:
24
24
 
25
25
  ```bash
26
26
  npm install -g @euraika-bert/claude-model-router
27
27
  claude-model-router install
28
28
  ```
29
29
 
30
- **Upgraden** naar de nieuwste versie:
30
+ **Upgrading** to the latest version:
31
31
 
32
32
  ```bash
33
- npx @euraika-bert/claude-model-router@latest install # met npx
34
- claude-model-router upgrade # na npm install -g
33
+ npx @euraika-bert/claude-model-router@latest install # with npx
34
+ claude-model-router upgrade # after npm install -g
35
35
  ```
36
36
 
37
- `upgrade` haalt altijd de nieuwste versie van npm op, ook als je globale installatie zelf nog oud is. Je keys, logins en instellingen blijven behouden. Gebruik na `npm install -g` dus niet `claude-model-router install` om te upgraden: dat draait de installer van de versie die je al hebt.
37
+ `upgrade` always fetches the latest version from npm, even when your global install itself is old. Your keys, logins and settings are kept. So after `npm install -g`, don't use `claude-model-router install` to upgrade: that runs the installer of the version you already have.
38
38
 
39
- De installer vraagt je API-keys (Enter slaat een provider over), zet alleen de providers aan waarvoor je een key of login hebt en start de router als achtergrondservice. Herstart daarna Claude Code en kies een model met `/model`. Bij een nieuwe versie toont Claude Code een melding; zie [Installeren en updaten via npm](#installeren-en-updaten-via-npm-macos-linux-windows).
39
+ The installer asks for your API keys (Enter skips a provider), enables only the providers you have a key or login for, and starts the router as a background service. Then restart Claude Code and pick a model with `/model`. When a new version is out, Claude Code shows a notice; see [Install and update via npm](#install-and-update-via-npm-macos-linux-windows).
40
40
 
41
- De repository bevat **geen API-keys, OAuth-tokens of persoonlijke `settings.json`**.
41
+ The repository and the npm package contain **no API keys, OAuth tokens or personal `settings.json`**.
42
42
 
43
- ## Hoe het werkt
43
+ ## How it works
44
44
 
45
- Claude Code stuurt API-verzoeken naar `http://127.0.0.1:8765`. De router leest de model-ID en kiest de juiste route:
45
+ Claude Code sends its API requests to `http://127.0.0.1:8765`. The router reads the model ID and picks the route:
46
46
 
47
- | Model | Route | Authenticatie |
47
+ | Model | Route | Authentication |
48
48
  | --- | --- | --- |
49
- | `k3.1-pro[1m]` en de andere modellen uit de Kimi-catalogus (bv. `k3`, `k3-256k`, `k3.1-pro-highspeed`) | `api.kimi.com/coding` | Bestaande Kimi Code-OAuth-credentials, automatisch vernieuwd |
50
- | `mistral-large-4[1m]`, `zai-glm-5-3[1m]` en alle ID’s en aliassen uit de Mistral-catalogus (bv. `mistral-medium-latest`, `codestral-latest`, `glm-5-2`) | `api.mistral.ai/v1/chat/completions` | Mistral API-key uit de macOS Keychain (Windows: DPAPI-bestand) |
51
- | `qwen*`, `deepseek*`, `glm*` (bv. `qwen3.8-max[1m]`, `deepseek-v4-pro[1m]`, `glm-5.3[1m]`), behalve `zai-glm-*` en ID’s uit de Mistral-catalogus | `token-plan.ap-southeast-1.maas.aliyuncs.com/apps/anthropic` | Bailian token-plan API-key uit de macOS Keychain (Windows: DPAPI-bestand) |
52
- | `gpt-*` (bv. `gpt-6-astra`, `gpt-6.1-sol`) | `chatgpt.com/backend-api/codex/responses` | ChatGPT-OAuth-login van de Codex CLI (`~/.codex/auth.json`, `codex login`), automatisch vernieuwd |
53
- | `MiniMax-*` (bv. `MiniMax-M3.1-Flash[1m]`, `MiniMax-M3[1m]`) | `api.minimax.io/anthropic` | MiniMax M Plan API-key uit de macOS Keychain (Windows: DPAPI-bestand) |
54
- | Alle andere modellen | `api.anthropic.com` | Bestaande Claude Code-login wordt ongewijzigd doorgestuurd |
49
+ | `k3.1-pro[1m]` and the other models in the Kimi catalog (e.g. `k3`, `k3-256k`, `k3.1-pro-highspeed`) | `api.kimi.com/coding` | Existing Kimi Code OAuth credentials, refreshed automatically |
50
+ | `mistral-large-4[1m]`, `zai-glm-5-3[1m]` and every ID and alias in the Mistral catalog (e.g. `mistral-medium-latest`, `codestral-latest`, `glm-5-2`) | `api.mistral.ai/v1/chat/completions` | Mistral API key (macOS Keychain, Linux key file, Windows DPAPI file) |
51
+ | `qwen*`, `deepseek*`, `glm*` (e.g. `qwen3.8-max[1m]`, `deepseek-v4-pro[1m]`, `glm-5.3[1m]`), except `zai-glm-*` and IDs from the Mistral catalog | `token-plan.ap-southeast-1.maas.aliyuncs.com/apps/anthropic` | Bailian token-plan API key (macOS Keychain, Linux key file, Windows DPAPI file) |
52
+ | `gpt-*` (e.g. `gpt-6-astra`, `gpt-6.1-sol`) | `chatgpt.com/backend-api/codex/responses` | ChatGPT OAuth login of the Codex CLI (`~/.codex/auth.json`, `codex login`), refreshed automatically |
53
+ | `MiniMax-*` (e.g. `MiniMax-M3.1-Flash[1m]`, `MiniMax-M3[1m]`) | `api.minimax.io/anthropic` | MiniMax M Plan API key (macOS Keychain, Linux key file, Windows DPAPI file) |
54
+ | All other models | `api.anthropic.com` | Your existing Claude Code login, forwarded unchanged |
55
55
 
56
- **Claude-modellen.** Claude Code behandelt een `ANTHROPIC_BASE_URL` die niet naar `api.anthropic.com` wijst als externe gateway. Dan toont het een ingebakken, verouderde modellijst, bijvoorbeeld Fable 5.1 in plaats van Fable 5.2. De router stuurt Claude-verzoeken ongewijzigd door; daarom zet de installer `_CLAUDE_CODE_ASSUME_FIRST_PARTY_BASE_URL=1`. Claude Code haalt dan zelf de actuele modellijst bij Anthropic op, en nieuwe Claude-modellen verschijnen vanzelf in `/model`.
56
+ **Claude models.** Claude Code treats an `ANTHROPIC_BASE_URL` that does not point to `api.anthropic.com` as a third-party gateway and then shows a built-in, outdated model list, for example Fable 5.1 instead of Fable 5.2. The router forwards Claude requests unchanged, so the installer sets `_CLAUDE_CODE_ASSUME_FIRST_PARTY_BASE_URL=1`. Claude Code then fetches the current model list from Anthropic itself, and new Claude models show up in `/model` on their own.
57
57
 
58
- **Aliyun.** De route gebruikt de Anthropic-compatibele endpoint van Bailian. Verzoeken worden 1-op-1 doorgestuurd met de key als Bearer-token; de `[1m]`-suffix wordt van het model-ID gestript, net als bij Kimi. Host en pad zijn te overschrijven met `ALIYUN_ANTHROPIC_HOST` / `ALIYUN_ANTHROPIC_PATH` (handig voor een andere regio of de `/compatible-mode/v1`-endpoint). Alleen modellen die op het token plan staan werken; `GET /compatible-mode/v1/models` toont wat het plan aanbiedt, maar niet alles daarvan is ook gekocht. Test een model daarom altijd met een echte aanroep voordat je het toevoegt.
58
+ **Aliyun.** This route uses Bailian's Anthropic-compatible endpoint. Requests are forwarded 1:1 with the key as a Bearer token; the `[1m]` suffix is stripped from the model ID, as for Kimi. Host and path can be overridden with `ALIYUN_ANTHROPIC_HOST` / `ALIYUN_ANTHROPIC_PATH` (useful for another region or the `/compatible-mode/v1` endpoint). Only models on your token plan work; `GET /compatible-mode/v1/models` shows what the plan offers, but not all of it is purchased. Always test a model with a real request before adding it.
59
59
 
60
- **MiniMax.** De route gebruikt de Anthropic-compatibele endpoint van MiniMax (M Plan) en werkt net als de Aliyun-route: verzoeken worden 1-op-1 doorgestuurd met de key als Bearer-token en de `[1m]`-suffix wordt gestript (MiniMax weigert die zelf: `unknown model`). De host is te overschrijven met `MINIMAX_ANTHROPIC_HOST` (het pad staat vast op `/anthropic`). De catalogus (`/v1/models`) bevat ook uitgefaseerde M2.x-modellen en geen contextgroottes; MiniMax-modellen worden daarom niet automatisch gesynchroniseerd maar cureer je in `files/configure.mjs`, na een echte test.
60
+ **MiniMax.** This route uses MiniMax's Anthropic-compatible endpoint (M Plan) and works like the Aliyun route: requests are forwarded 1:1 with the key as a Bearer token and the `[1m]` suffix is stripped (MiniMax itself rejects it: `unknown model`). The host can be overridden with `MINIMAX_ANTHROPIC_HOST` (the path is fixed at `/anthropic`). The catalog (`/v1/models`) also lists retired M2.x models and no context sizes, so MiniMax models are not synced automatically; curate them in `files/configure.mjs` after a real test.
61
61
 
62
- **Mistral en GLM.** De router vertaalt Anthropic Messages van en naar Mistral’s OpenAI-compatibele formaat, inclusief streaming, afbeeldingen, tool-aanroepen en het effort-niveau. Mistral-modellen accepteren elk een andere set `reasoning_effort`-waarden, of helemaal geen. Bij een weigering leest de router de toegestane waarden uit de foutmelding en probeert hij het verzoek opnieuw met de dichtstbijzijnde waarde. Wat hij zo leert, onthoudt hij tot de router herstart.
62
+ **Mistral and GLM.** The router translates Anthropic Messages to and from Mistral's OpenAI-compatible format, including streaming, images, tool calls and the effort level. Each Mistral model accepts a different set of `reasoning_effort` values, or none at all. When a request is rejected, the router reads the accepted values from the error message and retries with the closest one. What it learns this way is remembered until the router restarts.
63
63
 
64
- **ChatGPT/Codex.** De router vertaalt naar de OpenAI Responses API van de Codex-backend. Die ondersteunt alleen streaming; non-streaming verzoeken worden intern gestreamd en als één bericht teruggegeven. De login (`~/.codex/auth.json`) wordt vóór verloop automatisch vernieuwd: refresh 5 minuten voor expiratie, één refresh tegelijk, atomisch weggeschreven. Welke modellen je account aanbiedt, staat in de Codex-catalogus; de router voegt ze automatisch toe. Klasse-indeling: astra = Fable, sol = Opus, terra = Sonnet, luna = Haiku. De Codex-modellen hebben 272k context (de 6.1-modellen 500k), dus niet 1M. Ze staan daarom zonder `[1m]` in `/model`, met `autoCompactWindow` op 95% van de context, zoals de Codex CLI zelf rekent.
64
+ **ChatGPT/Codex.** The router translates to the OpenAI Responses API of the Codex backend, following the request shape of the Codex CLI: the effort level you pick, the model's encrypted reasoning carried across tool calls, and a stable session for the prompt cache. The backend only supports streaming; non-streaming requests are streamed internally and returned as one message. The login (`~/.codex/auth.json`) is refreshed before it expires: 5 minutes ahead, one refresh at a time, written atomically. Which models your account offers is listed in the Codex catalog; the router adds them automatically. Class mapping: astra = Fable, sol = Opus, terra = Sonnet, luna = Haiku. The Codex models have 272k context (the 6.1 models 500k), not 1M. They are therefore listed in `/model` without `[1m]`, with `autoCompactWindow` at 95% of the context, the same way the Codex CLI counts.
65
65
 
66
- **Tools.** Dynamische `ToolSearch`-tools gaan naar alle routes. MCP-tools die Claude Code als `tool_addition`-blokken stuurt, zet de router voor Kimi, Aliyun en MiniMax om naar gewone `tools`-entries. Tools zonder `input_schema` (bv. de `advisor`-tool) krijgen een expliciet leeg schema: MiniMax weigert ze anders met `function parameters is empty (2013)`.
66
+ **Prompt caching.** Claude Code puts a billing header in the system prompt that changes on every request. Anthropic ignores it for caching, but other providers would treat it as prompt text and miss their cache on every turn, so the router removes it on all non-Anthropic routes. Cached tokens are reported to Claude Code the way Anthropic does (not counted twice).
67
67
 
68
- **Quota-failover.** Bereikt een provider zijn gebruikslimiet (HTTP 429/402, of 403 met een quotamelding zoals `AccessDenied.Unpurchased` of `Throttling`), dan probeert de router het verzoek automatisch op een model van dezelfde klasse bij een andere provider, nooit bij Anthropic:
68
+ **Tools.** Dynamic `ToolSearch` tools go to all routes. MCP tools that Claude Code sends as `tool_addition` blocks are turned into regular `tools` entries for Kimi, Aliyun and MiniMax. Tools without an `input_schema` (e.g. the `advisor` tool) get an explicit empty schema; MiniMax rejects them otherwise with `function parameters is empty (2013)`.
69
+
70
+ **Quota failover.** When a provider hits its usage limit (HTTP 429/402, or 403 with a quota message such as `AccessDenied.Unpurchased` or `Throttling`), the router retries the request on a model of the same class at another provider, never at Anthropic:
69
71
 
70
72
  - Kimi → `qwen3.8-max` → `zai-glm-5-3`
71
73
  - Aliyun → `zai-glm-5-3` → `k3.1-pro`
@@ -73,207 +75,208 @@ Claude Code stuurt API-verzoeken naar `http://127.0.0.1:8765`. De router leest d
73
75
  - ChatGPT → `qwen3.8-max` → `zai-glm-5-3`
74
76
  - MiniMax → `qwen3.8-max` → `k3.1-pro`
75
77
 
76
- Providers zonder key of login worden in de keten overgeslagen. Een provider die een quotafout gaf, wordt 5 minuten overgeslagen en daarna automatisch opnieuw geprobeerd. Faalt ook het laatste model in de keten, dan krijgt Claude Code die foutmelding. Overschakelingen staan in de log (`Quota limit on ...; switching to ...`): op macOS in `~/.claude/logs/kimi-router.error.log`, op Windows in `%USERPROFILE%\.claude\logs\kimi-router.log`.
78
+ Providers without a key or login are skipped in the chain. A provider that returned a quota error is skipped for 5 minutes and then tried again automatically. If the last model in the chain fails too, Claude Code gets that error. Switches are logged (`Quota limit on ...; switching to ...`): on macOS and Linux in `~/.claude/logs/kimi-router.error.log`, on Windows in `%USERPROFILE%\.claude\logs\kimi-router.log`.
77
79
 
78
- **Provider zonder login.** Kies je een model van een provider zonder key of login, dan antwoordt de router met HTTP 503 en een melding als `run 'kimi login'`. Hij blijft draaien, dus andere sessies hebben er geen last van.
80
+ **Provider without a login.** If you pick a model of a provider without a key or login, the router answers with HTTP 503 and a hint such as `run 'kimi login'`. It keeps running, so other sessions are not affected.
79
81
 
80
- ## Automatische modelsynchronisatie
82
+ ## Automatic model sync
81
83
 
82
- Bij het starten van de router en daarna elke 12 uur haalt de router de modelcatalogus op van elke provider waarvoor je een key of login hebt:
84
+ When the router starts, and every 12 hours after that, it fetches the model catalog of every provider you have a key or login for:
83
85
 
84
- | Provider | Catalogus | Welke modellen |
86
+ | Provider | Catalog | Which models |
85
87
  | --- | --- | --- |
86
- | Mistral | `api.mistral.ai/v1/models` | Chatmodellen met tool-support die niet zijn uitgefaseerd |
87
- | Kimi | `api.kimi.com/coding/v1/models` | Alle modellen |
88
- | ChatGPT/Codex | `chatgpt.com/backend-api/codex/models` | Modellen die de Codex CLI toont, voor jouw versie van de Codex CLI |
88
+ | Mistral | `api.mistral.ai/v1/models` | Chat models with tool support that are not deprecated |
89
+ | Kimi | `api.kimi.com/coding/v1/models` | All models |
90
+ | ChatGPT/Codex | `chatgpt.com/backend-api/codex/models` | The models the Codex CLI shows, for your Codex CLI version |
89
91
 
90
- Aliyun doet niet mee: die catalogus bevat ook modellen die je plan weigert. Aliyun-modellen voeg je zelf toe in `files/configure.mjs`, na een echte test.
92
+ Aliyun is not synced: its catalog also lists models your plan rejects. Add Aliyun models yourself in `files/configure.mjs`, after a real test.
91
93
 
92
- Wat de sync doet:
94
+ What the sync does:
93
95
 
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
- 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 *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
- 4. **Klasse.** `behavesAs` volgt uit de naam:
96
+ 1. **Routing.** Every ID and alias in a catalog goes to that provider. This routing comes before the Aliyun rule, so Mistral models like `glm-5-2` go to Mistral.
97
+ 2. **Selection.** Models with at least 100k context that are not yet in `/model` become candidates. For each group of aliases the router picks one ID: preferably a `-latest` alias, otherwise the shortest ID. Models with 1M context get `[1m]`.
98
+ 3. **Testing.** Every new candidate first gets a real test through the router: a non-streaming tool call, then a streamed answer to the tool result, without failover. Only if that passes does the model go into `modelPicker.options`, with the description *Auto-added from the … catalog* and `autoCompactWindow` equal to the context (at most 1M). A failed test (e.g. because of an exhausted quota) is retried on the next sync; the reason is in `/__health` under `modelSync.probeFailures`.
99
+ 4. **Class.** `behavesAs` follows from the name:
98
100
  - `astra` → Fable
99
101
  - `luna`, `small`, `ministral` → Haiku
100
102
  - `sol`, `large`, `pro`, `max` → Opus
101
103
  - `terra`, `medium`, `flash`, `highspeed`, `codestral`, `leanstral` → Sonnet
102
- - overige GLM- en Kimi-modellen → Opus
103
- - de rest → Sonnet
104
- 5. **Beheren.** De router past alleen items aan die hij zelf heeft toegevoegd; de lijst staat in `~/.claude/router-models.json`. Verdwijnt een model uit de catalogus, of verdwijnt de login, dan haalt hij het item weg. Vóór elke wijziging maakt hij een back-up naar `~/.claude/backups/settings.json.router-sync-*`. Als er niets verandert, schrijft hij niets.
104
+ - other GLM and Kimi models → Opus
105
+ - everything else → Sonnet
106
+ 5. **Management.** The router only changes entries it added itself; the list is in `~/.claude/router-models.json`. When a model leaves the catalog, or the login goes away, it removes the entry. Before every change it writes a backup to `~/.claude/backups/settings.json.router-sync-*`. If nothing changes, it writes nothing.
105
107
 
106
- ## Vereisten
108
+ ## Requirements
107
109
 
108
- - macOS (`launchd` en Keychain), Linux met systemd (user service) of Windows 10/11 (Taakplanner en Windows PowerShell 5.1, standaard aanwezig).
109
- - Claude Code 2.1.242 of later. Dat nieuwe Claude-modellen vanzelf verschijnen, is geverifieerd met Claude Code 2.1.322.
110
- - Node.js 22 of later.
111
- - Alle providers hieronder zijn **optioneel**. De installer zet alleen de providers aan waarvoor een key of login aanwezig is; de rest komt niet in `/model` en doet niet mee aan failover of synchronisatie.
112
- - **Kimi:** Kimi Code CLI en een actieve login via `kimi login`.
113
- - **Mistral en GLM:** een geldige Mistral API-key met toegang tot deze modellen.
114
- - **Qwen, DeepSeek en GLM via Aliyun:** een Bailian token-plan API-key voor regio `ap-southeast-1`.
115
- - **ChatGPT (GPT-modellen):** de Codex CLI met een actieve login via `codex login` (ChatGPT-account).
116
- - **MiniMax (M Plan):** een MiniMax M Plan API-key van [platform.minimax.io](https://platform.minimax.io/console/plan).
110
+ - macOS (`launchd` and Keychain), Linux with systemd (user service), or Windows 10/11 (Task Scheduler and Windows PowerShell 5.1, present by default).
111
+ - Claude Code 2.1.242 or later. That new Claude models appear on their own is verified with Claude Code 2.1.322.
112
+ - Node.js 22 or later.
113
+ - All providers below are **optional**. The installer only enables the providers that have a key or login; the others don't appear in `/model` and take no part in failover or sync.
114
+ - **Kimi:** the Kimi Code CLI and an active login via `kimi login`.
115
+ - **Mistral and GLM:** a valid Mistral API key with access to these models.
116
+ - **Qwen, DeepSeek and GLM via Aliyun:** a Bailian token-plan API key for region `ap-southeast-1`.
117
+ - **ChatGPT (GPT models):** the Codex CLI with an active login via `codex login` (ChatGPT account).
118
+ - **MiniMax (M Plan):** a MiniMax M Plan API key from [platform.minimax.io](https://platform.minimax.io/console/plan).
117
119
 
118
- ## Installeren en updaten via npm (macOS, Linux, Windows)
120
+ ## Install and update via npm (macOS, Linux, Windows)
119
121
 
120
122
  ```bash
121
123
  npx @euraika-bert/claude-model-router@latest install
122
124
  ```
123
125
 
124
- Met `npm install -g @euraika-bert/claude-model-router` en daarna `claude-model-router install` werkt het ook; updaten doe je dan met `claude-model-router upgrade` (haalt de nieuwste versie op, ook als de globale installatie nog oud is).
126
+ With `npm install -g @euraika-bert/claude-model-router` followed by `claude-model-router install` it works too; you then update with `claude-model-router upgrade` (fetches the latest version, even when the global install itself is old).
125
127
 
126
- Dit start de installer van je platform (`install.sh` op macOS en Linux, `install.ps1` op Windows) uit het npm-pakket. Hetzelfde commando werkt ook om te **updaten**. Je instellingen, keys en logins blijven behouden.
128
+ This runs your platform's installer (`install.sh` on macOS and Linux, `install.ps1` on Windows) from the npm package. The same command also **updates**. Your settings, keys and logins are kept.
127
129
 
128
- **Updatemelding:** de router vraagt één keer per dag de laatste versie op bij `registry.npmjs.org` en stuurt daarbij niets over jou of je setup mee. Is er een nieuwere versie, dan toont Claude Code bij het starten van een sessie een melding met het updatecommando; dat komt van een SessionStart-hook die de installer in `settings.json` zet. Er wordt nooit automatisch geüpdatet. Uitzetten: zet `CLAUDE_MODEL_ROUTER_NO_UPDATE_CHECK=1` in de omgeving van de router. De versie zie je in `/__health` (`version`, `latestVersion`, `updateAvailable`) of met `npx @euraika-bert/claude-model-router version`.
130
+ **Update notice:** once a day the router asks `registry.npmjs.org` for the latest version and sends nothing about you or your setup. When a newer version exists, Claude Code shows a notice with the update command at the start of a session; it comes from a SessionStart hook the installer adds to `settings.json`. It never updates automatically. To turn the check off, set `CLAUDE_MODEL_ROUTER_NO_UPDATE_CHECK=1` in the router's environment. The version is shown in `/__health` (`version`, `latestVersion`, `updateAvailable`) and by `npx @euraika-bert/claude-model-router version`.
129
131
 
130
- ## Installeren op macOS
132
+ ## Installing on macOS
131
133
 
132
- Via npm (zie hierboven), of vanuit een kopie van deze repository:
134
+ Via npm (see above), or from a copy of this repository:
133
135
 
134
136
  ```bash
135
137
  ./install.sh
136
138
  ```
137
139
 
138
- De installatie:
140
+ The installer:
139
141
 
140
- 1. kopieert de routerbestanden naar `~/.claude/` en een reservekopie naar `~/.local/share/claude-model-router/`;
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 = skip);
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
- 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
- 6. installeert en start `com.bert.claude-kimi-router` als LaunchAgent, en toont welke providers zijn overgeslagen en hoe je ze aanzet.
142
+ 1. copies the router files to `~/.claude/` and a backup copy to `~/.local/share/claude-model-router/`;
143
+ 2. installs the recovery command as `~/.local/bin/claude-model-router-setup`;
144
+ 3. asks for your Mistral API key, Aliyun token-plan key and MiniMax M Plan key with a hidden prompt if they are not in the Keychain yet (Enter = skip);
145
+ 4. detects which providers are usable: the Keychain items `claude-code-mistral`/`claude-code-aliyun`/`claude-code-minimax`, `kimi login` and `codex login`;
146
+ 5. backs up `~/.claude/settings.json` to `~/.claude/backups/` and writes only the settings of those providers; entries of providers without a login are removed;
147
+ 6. installs and starts `com.bert.claude-kimi-router` as a LaunchAgent, and shows which providers were skipped and how to enable them.
146
148
 
147
- Herstart daarna Claude Code en open `/model`. Een provider later toevoegen: regel de key of login en voer daarna `claude-model-router-setup` opnieuw uit.
149
+ Then restart Claude Code and open `/model`. To add a provider later: set up the key or login, then run `claude-model-router-setup` again.
148
150
 
149
- Niet-interactief installeren kan met:
151
+ Non-interactive install:
150
152
 
151
153
  ```bash
152
154
  MISTRAL_API_KEY='...' ALIYUN_API_KEY='...' MINIMAX_API_KEY='...' ./install.sh
153
155
  ```
154
156
 
155
- Deze variabelen kunnen in je shellgeschiedenis terechtkomen; de verborgen interactieve prompt heeft daarom de voorkeur.
157
+ These variables can end up in your shell history, so the hidden interactive prompt is preferred.
156
158
 
157
- ## Installeren op Windows
159
+ ## Installing on Windows
158
160
 
159
- > **Status:** de Windows-installatie is nog niet op een echte Windows-machine getest. Ze is wel van begin tot eind gedraaid in een Linux-container met PowerShell 7.7, waarbij Taakplanner en de poortcheck zijn nagebootst; zie [Bekende beperkingen](#bekende-beperkingen).
161
+ > **Status:** the Windows install has not been tested on a real Windows machine yet. It did run end to end in a Linux container with PowerShell 7.7, with Task Scheduler and the port check stubbed; see [Known limitations](#known-limitations).
160
162
 
161
- Open PowerShell in de clone; beheerdersrechten zijn niet nodig. Voer uit:
163
+ Via npm (see above), or from a copy of this repository in PowerShell; no administrator rights needed:
162
164
 
163
165
  ```powershell
164
166
  powershell -NoProfile -ExecutionPolicy Bypass -File .\install.ps1
165
167
  ```
166
168
 
167
- De Windows-installatie doet hetzelfde als `install.sh`, met deze verschillen:
169
+ The Windows install does the same as `install.sh`, with these differences:
168
170
 
169
- - **Keys:** de Mistral-, Aliyun- en MiniMax-key worden met DPAPI versleuteld bewaard in `%LOCALAPPDATA%\claude-model-router\` (`claude-code-mistral.dpapi`, `claude-code-aliyun.dpapi`, `claude-code-minimax.dpapi`). Alleen jouw Windows-account kan ze ontsleutelen.
170
- - **Router:** draait als geplande taak `claude-model-router` die start bij het aanmelden. Een verborgen PowerShell-lus (`%USERPROFILE%\.claude\kimi-router-run.ps1`) herstart de router binnen 2 seconden na een crash. Bij het aanmelden kan heel kort een venster verschijnen.
171
- - **Log:** stdout en stderr komen in één bestand: `%USERPROFILE%\.claude\logs\kimi-router.log`.
172
- - **Herinstallatie:** een nieuwe installatie stopt de draaiende router; de lus start hem meteen opnieuw met de nieuwe bestanden.
173
- - **Herstellen:** er is geen herstelcommando zoals `claude-model-router-setup`; voer `install.ps1` opnieuw uit vanuit de clone.
171
+ - **Keys:** the Mistral, Aliyun and MiniMax keys are stored DPAPI-encrypted in `%LOCALAPPDATA%\claude-model-router\` (`claude-code-mistral.dpapi`, `claude-code-aliyun.dpapi`, `claude-code-minimax.dpapi`). Only your Windows account can decrypt them.
172
+ - **Router:** runs as the scheduled task `claude-model-router`, started at logon. A hidden PowerShell loop (`%USERPROFILE%\.claude\kimi-router-run.ps1`) restarts the router within 2 seconds after a crash. A window may flash briefly at logon.
173
+ - **Log:** stdout and stderr go to one file: `%USERPROFILE%\.claude\logs\kimi-router.log`.
174
+ - **Reinstall:** a new install stops the running router; the loop restarts it right away with the new files.
175
+ - **Recovery:** there is no recovery command like `claude-model-router-setup`; run the npm command or `install.ps1` again.
174
176
 
175
- Kimi en ChatGPT/Codex werken zodra `kimi login` en `codex login` hun login in `%USERPROFILE%\.kimi-code` en `%USERPROFILE%\.codex` zetten. Dat zijn de standaardlocaties; `KIMI_CODE_HOME` en `CODEX_HOME` worden gerespecteerd.
177
+ Kimi and ChatGPT/Codex work as soon as `kimi login` and `codex login` put their login in `%USERPROFILE%\.kimi-code` and `%USERPROFILE%\.codex`. Those are the default locations; `KIMI_CODE_HOME` and `CODEX_HOME` are respected.
176
178
 
177
- Niet-interactief installeren:
179
+ Non-interactive install:
178
180
 
179
181
  ```powershell
180
182
  $env:MISTRAL_API_KEY = '...'; $env:ALIYUN_API_KEY = '...'; $env:MINIMAX_API_KEY = '...'
181
183
  powershell -NoProfile -ExecutionPolicy Bypass -File .\install.ps1
182
184
  ```
183
185
 
184
- ## Installeren op Linux
186
+ ## Installing on Linux
185
187
 
186
- > **Status:** getest op Ubuntu 22.04 met echte systemd (Node 24): installatie, de service (`active`/`enabled`), key-bestanden met rechten `600`, `/__health`, automatische herstart na een crash (~11 s), `systemctl --user restart` en de verwijderstappen hieronder. Daarnaast echte verzoeken via de router voor Mistral (7 modellen), ChatGPT/Codex (6) en MiniMax (2): non-streaming, streaming en een tool-roundtrip, plus echte Claude Code-sessies (2.1.303) met Read- en Bash-tool. Kimi en Aliyun zijn niet getest (quota op). Ook getest in een Debian-container met Node 22.
188
+ > **Status:** tested on Ubuntu 22.04 with real systemd (Node 24): installation, the service (`active`/`enabled`), key files with mode `600`, `/__health`, automatic restart after a crash (~11 s), `systemctl --user restart` and the uninstall steps below. Also real requests through the router for Mistral (7 models), ChatGPT/Codex (6) and MiniMax (2): non-streaming, streaming and a tool round trip, plus real Claude Code sessions (2.1.303) with the Read and Bash tools. Kimi and Aliyun were not tested (quota exhausted). Also tested in a Debian container with Node 22.
187
189
 
188
- Gebruik dezelfde `./install.sh` als op macOS. Op Linux zijn er deze verschillen:
190
+ Use the npm command or the same `./install.sh` as on macOS. On Linux these things differ:
189
191
 
190
- - **Keys:** elke key staat als apart bestand met rechten `600` in `~/.config/claude-model-router/` (`claude-code-mistral`, `claude-code-aliyun`, `claude-code-minimax`; respecteert `XDG_CONFIG_HOME`). Linux heeft geen keychain waar een achtergrondservice altijd bij kan; de Codex- en Kimi-logins bewaren hun tokens op dezelfde manier.
191
- - **Service:** een systemd user service `claude-model-router.service` in `~/.config/systemd/user/`. Die start bij je login. Wil je de router ook zonder login (bv. via SSH): `loginctl enable-linger $USER`.
192
- - **Logs:** dezelfde bestanden als op macOS, in `~/.claude/logs/`.
193
- - **Herstarten:** `systemctl --user restart claude-model-router`.
192
+ - **Keys:** each key is a separate file with mode `600` in `~/.config/claude-model-router/` (`claude-code-mistral`, `claude-code-aliyun`, `claude-code-minimax`; respects `XDG_CONFIG_HOME`). Linux has no keychain a background service can always reach; the Codex and Kimi logins store their tokens the same way.
193
+ - **Service:** a systemd user service `claude-model-router.service` in `~/.config/systemd/user/`. It starts when you log in. To run the router without a login session too (e.g. over SSH): `loginctl enable-linger $USER`.
194
+ - **Logs:** the same files as on macOS, in `~/.claude/logs/`.
195
+ - **Restart:** `systemctl --user restart claude-model-router`.
194
196
 
195
- ## Opnieuw installeren of herstellen
197
+ ## Reinstall or recover
196
198
 
197
- Op elk platform werkt `npx @euraika-bert/claude-model-router@latest install`. Op macOS en Linux kan het ook offline met de reservekopie, na een verwijderde of beschadigde configuratie:
199
+ On every platform, `npx @euraika-bert/claude-model-router@latest install` works. On macOS and Linux it also works offline from the backup copy, after a deleted or broken configuration:
198
200
 
199
201
  ```bash
200
202
  claude-model-router-setup
201
203
  ```
202
204
 
203
- Op Windows: voer `install.ps1` opnieuw uit. Alle installers zijn idempotent: je kunt ze meerdere keren uitvoeren. Overige instellingen blijven behouden en dubbele modelkeuzes worden vermeden.
205
+ On Windows: run the npm command or `install.ps1` again. All installers are idempotent: you can run them as often as you like. Other settings are kept and duplicate model entries are avoided.
204
206
 
205
- Als de Kimi-credentials ontbreken, voer dan `kimi login` uit en daarna opnieuw de installer. Als op macOS of Linux ook de reservekopie ontbreekt, installeer dan opnieuw via `npx`.
207
+ If the Kimi credentials are missing, run `kimi login` and then the installer again. If on macOS or Linux the backup copy is gone too, reinstall via `npx`.
206
208
 
207
- ## Controleren
209
+ ## Checking
208
210
 
209
- Controleer de router, de logins en de modelsynchronisatie:
211
+ Check the router, the logins and the model sync:
210
212
 
211
213
  ```bash
212
214
  curl --fail --silent http://127.0.0.1:8765/__health
213
215
  ```
214
216
 
215
- Op Windows: `Invoke-RestMethod http://127.0.0.1:8765/__health`.
217
+ On Windows: `Invoke-RestMethod http://127.0.0.1:8765/__health`.
216
218
 
217
- De geïnstalleerde versie zie je ook met `npx @euraika-bert/claude-model-router version`.
219
+ `npx @euraika-bert/claude-model-router version` also shows the installed version.
218
220
 
219
- Het antwoord bevat onder meer:
221
+ The response includes:
220
222
 
221
- - `version`, `latestVersion` en `updateAvailable` (de geïnstalleerde en de laatste versie op npm);
222
- - `kimiLoginAvailable`, `mistralLoginAvailable`, `aliyunLoginAvailable`, `codexLoginAvailable` en `minimaxLoginAvailable`;
223
- - `modelSync`, met daarin `syncedAt`, per provider het aantal modellen en eventuele fouten, `pickerManaged` (de automatisch toegevoegde items) en `probeFailures`.
223
+ - `version`, `latestVersion` and `updateAvailable` (the installed version and the latest on npm);
224
+ - `kimiLoginAvailable`, `mistralLoginAvailable`, `aliyunLoginAvailable`, `codexLoginAvailable` and `minimaxLoginAvailable`;
225
+ - `modelSync`, with `syncedAt`, the number of models and any errors per provider, `pickerManaged` (the auto-added entries) and `probeFailures`.
224
226
 
225
- Controleer daarna in Claude Code:
227
+ Then check in Claude Code:
226
228
 
227
- 1. `/model` toont de nieuwste Claude-modellen (bv. Fable 5.2), de modellen van je providers en de automatisch toegevoegde modellen.
228
- 2. Een korte prompt werkt met elk gewenst model.
229
- 3. Een eenvoudige Bash-opdracht werkt ook met een gekozen model.
229
+ 1. `/model` shows the latest Claude models (e.g. Fable 5.2), your providers' models and the auto-added models.
230
+ 2. A short prompt works with every model you want to use.
231
+ 3. A simple Bash command works with a selected model too.
230
232
 
231
- De parser voor de Mistral-effortwaarden heeft een eigen controle: `node test/mistral-effort.test.mjs`. Het tokengebruik (cached tokens), de Codex-requestvorm en de versiecontrole controleer je met `node test/usage.test.mjs`.
233
+ The parser for Mistral effort values has its own check: `node test/mistral-effort.test.mjs`. Token usage (cached tokens), the Codex request shape and the version check are covered by `node test/usage.test.mjs`.
232
234
 
233
- ## Authenticatie en geheimen
235
+ ## Authentication and secrets
234
236
 
235
- - **Kimi:** gedeelde credentials uit `~/.kimi-code/credentials/kimi-code.json` of, bij nieuwere versies van `kimi login`, het nieuwste `kimi-code-env-<hash>.json`. De router vernieuwt tokens via Kimi’s OAuth-flow en schrijft ze atomisch terug.
236
- - **Mistral en GLM:**
237
- - macOS: Keychain-item `claude-code-mistral`;
238
- - Linux: `~/.config/claude-model-router/claude-code-mistral` (rechten `600`);
237
+ - **Kimi:** shared credentials from `~/.kimi-code/credentials/kimi-code.json` or, with newer versions of `kimi login`, the newest `kimi-code-env-<hash>.json`. The router refreshes tokens through Kimi's OAuth flow and writes them back atomically.
238
+ - **Mistral and GLM:**
239
+ - macOS: Keychain item `claude-code-mistral`;
240
+ - Linux: `~/.config/claude-model-router/claude-code-mistral` (mode `600`);
239
241
  - Windows: `%LOCALAPPDATA%\claude-model-router\claude-code-mistral.dpapi`;
240
- - of de `MISTRAL_API_KEY`-omgevingsvariabele in het router-proces.
242
+ - or the `MISTRAL_API_KEY` environment variable of the router process.
241
243
  - **Qwen (Aliyun):**
242
- - macOS: Keychain-item `claude-code-aliyun`;
243
- - Linux: `~/.config/claude-model-router/claude-code-aliyun` (rechten `600`);
244
+ - macOS: Keychain item `claude-code-aliyun`;
245
+ - Linux: `~/.config/claude-model-router/claude-code-aliyun` (mode `600`);
244
246
  - Windows: `claude-code-aliyun.dpapi`;
245
- - of de `ALIYUN_API_KEY`-omgevingsvariabele in het router-proces.
247
+ - or the `ALIYUN_API_KEY` environment variable of the router process.
246
248
  - **MiniMax (M Plan):**
247
- - macOS: Keychain-item `claude-code-minimax`;
248
- - Linux: `~/.config/claude-model-router/claude-code-minimax` (rechten `600`);
249
+ - macOS: Keychain item `claude-code-minimax`;
250
+ - Linux: `~/.config/claude-model-router/claude-code-minimax` (mode `600`);
249
251
  - Windows: `claude-code-minimax.dpapi`;
250
- - of de `MINIMAX_API_KEY`-omgevingsvariabele in het router-proces.
251
- - **ChatGPT/Codex:** de OAuth-login van de Codex CLI in `~/.codex/auth.json`. De router vernieuwt het token via `auth.openai.com` en schrijft het atomisch terug.
252
- - **Claude:** de router bewaart geen Anthropic-token; inkomende authenticatie wordt alleen doorgestuurd naar `api.anthropic.com`.
253
- - De router houdt keys 5 minuten in het geheugen. Op Windows ontsleutelt hij ze via Windows PowerShell, wat het eerste verzoek na die 5 minuten iets vertraagt (niet gemeten).
254
- - Logs bevatten geen API-keys of requestberichten.
255
-
256
- ## Bekende beperkingen
257
-
258
- - De router draait lokaal; Claude Code-cloudsessies gebruiken deze configuratie niet.
259
- - Claude Code Remote Control vereist een directe verbinding met `api.anthropic.com` en is niet beschikbaar via deze lokale route.
260
- - `_CLAUDE_CODE_ASSUME_FIRST_PARTY_BASE_URL` is een niet-gedocumenteerde interne instelling van Claude Code. Negeert een update die, dan toont `/model` weer verouderde Claude-modellen. Kies het model dan via zijn ID, bv. `/model claude-fable-5-2`. `ANTHROPIC_DEFAULT_FABLE_MODEL` helpt niet: daarmee bleef de picker Fable 5.1 tonen.
261
- - Verwijder je een automatisch toegevoegd model met de hand uit `/model`, dan zet de volgende sync het terug. Er is (nog) geen uitsluitlijst.
262
- - De sync en Claude Code schrijven allebei naar `settings.json`. Schrijven ze precies tegelijk, dan kan één van de twee wijzigingen verloren gaan. Het venster is klein en de sync maakt altijd eerst een back-up.
263
- - Ministral 3B/8B/14B werken via de router, maar zijn zwak als agent: na een foutmelding van een tool geven ze vaak op.
264
- - Codex-modellen boven 272k context (de catalogus noemt maximaal 872k) zijn niet getest.
265
- - De weergegeven kosten in Claude Code kunnen bij aangepaste modellen afwijken van de werkelijke providerfacturatie.
266
- - **Verificatiestatus (13 november 2026):**
267
- - De MiniMax-route is op 13 november 2026 volledig getest: non-streaming, streaming (eindigt op `message_stop`) en een tool-use-round trip voor zowel `MiniMax-M3.1-Flash[1m]` als `MiniMax-M3[1m]` via de router (met `x-router-probe: 1`), én daarna met echte Claude Code-sessies op beide modellen, inclusief een Bash-toolronde. Eerste poging faalde in echte sessies met `function parameters is empty (2013)`: Claude Code stuurt tools zonder `input_schema` (bv. `advisor`) en MiniMax weigert die na conversie; de router geeft zulke tools nu een expliciet leeg schema.
268
- - De Kimi- en Aliyun-routes zijn na de eerdere wijzigingen niet opnieuw met echte verzoeken getest, omdat beide quota op waren; de Aliyun-quota resetten op 5 december 2026, 16:00 UTC.
269
- - De nieuwe Kimi-catalogusmodellen worden automatisch toegevoegd zodra hun test slaagt.
270
- - Linux is getest op Ubuntu 22.04 met echte systemd (17 november 2026, in een geïsoleerde `HOME`): installatie en service, plus echte verzoeken en Claude Code-sessies voor Mistral, ChatGPT/Codex en MiniMax. Niet getest: Kimi en Aliyun (quota op) en een machine zonder `enable-linger`.
271
- - **End-to-end op macOS (17 november 2026):** alle 23 modellen met beschikbaar quotum uit `/model` (Codex 9, Mistral 12, MiniMax 2) slagen voor non-streaming, streaming en een tool-roundtrip via de router (`x-router-probe: 1`), plus echte Claude Code-sessies op Claude Haiku, Mistral Medium, GLM 5.3, DeepSeek, MiniMax M3.1-Flash en GPT 6.1 Terra/Sol.
272
- - Windows is alleen in een container getest. Nog onbewezen op echte Windows: de DPAPI-versleuteling, Windows PowerShell 5.1, het registreren van de geplande taak, het verborgen venster, Claude Code op Windows, en de loginlocaties van `kimi login` en `codex login`.
273
-
274
- ## Verwijderen
275
-
276
- Op macOS: stop de service en verwijder de routerbestanden:
252
+ - or the `MINIMAX_API_KEY` environment variable of the router process.
253
+ - **ChatGPT/Codex:** the Codex CLI's OAuth login in `~/.codex/auth.json`. The router refreshes the token via `auth.openai.com` and writes it back atomically.
254
+ - **Claude:** the router stores no Anthropic token; incoming authentication is only forwarded to `api.anthropic.com`.
255
+ - The router keeps keys in memory for 5 minutes. On Windows it decrypts them through Windows PowerShell, which slows the first request after those 5 minutes slightly (not measured).
256
+ - Logs contain no API keys or request messages.
257
+
258
+ ## Known limitations
259
+
260
+ - The router runs locally; Claude Code cloud sessions don't use this configuration.
261
+ - Claude Code Remote Control needs a direct connection to `api.anthropic.com` and is not available through this local route.
262
+ - `_CLAUDE_CODE_ASSUME_FIRST_PARTY_BASE_URL` is an undocumented internal Claude Code setting. If an update ignores it, `/model` shows outdated Claude models again. Then pick the model by its ID, e.g. `/model claude-fable-5-2`. `ANTHROPIC_DEFAULT_FABLE_MODEL` does not help: with it the picker kept showing Fable 5.1.
263
+ - If you remove an auto-added model from `/model` by hand, the next sync puts it back. There is no exclude list (yet).
264
+ - The sync and Claude Code both write to `settings.json`. If they write at exactly the same moment, one of the two changes can be lost. The window is small and the sync always makes a backup first.
265
+ - Right after a fresh install, models from a synced catalog (e.g. `mistral-medium-latest`) can go to the wrong provider until the first catalog sync has finished.
266
+ - When Claude Code loads a new MCP tool mid-session, Kimi, Aliyun and MiniMax reprocess the prompt once without cache.
267
+ - Ministral 3B/8B/14B work through the router, but are weak as agents: after a tool error they often give up.
268
+ - Codex models above 272k context (the catalog lists up to 872k) are not tested.
269
+ - The costs Claude Code shows for custom models can differ from what the provider actually bills.
270
+ - **Verification status:**
271
+ - **macOS, end to end (17 November 2026):** all 23 models with available quota in `/model` (Codex 9, Mistral 12, MiniMax 2) pass non-streaming, streaming and a tool round trip through the router (`x-router-probe: 1`), plus real Claude Code sessions on Claude Haiku, Mistral Medium, GLM 5.3, DeepSeek, MiniMax M3.1-Flash and GPT 6.1 Terra/Sol.
272
+ - **Linux (17 November 2026):** tested on Ubuntu 22.04 with real systemd, in an isolated `HOME`: install and service, plus real requests and Claude Code sessions for Mistral, ChatGPT/Codex and MiniMax. Not tested: Kimi and Aliyun (quota exhausted) and a machine without `enable-linger`.
273
+ - **MiniMax (13 November 2026):** fully tested for `MiniMax-M3.1-Flash[1m]` and `MiniMax-M3[1m]`. The first attempt failed in real sessions with `function parameters is empty (2013)`: Claude Code sends tools without `input_schema` (e.g. `advisor`) and MiniMax rejects them after conversion; the router now gives such tools an explicit empty schema.
274
+ - **Kimi and Aliyun:** not retested with real requests after the recent changes, because both quotas were exhausted; the Aliyun quota resets on 5 December 2026, 16:00 UTC. New Kimi catalog models are added automatically once their test passes.
275
+ - **Windows:** only tested in a container. Not yet proven on real Windows: DPAPI encryption, Windows PowerShell 5.1, registering the scheduled task, the hidden window, Claude Code on Windows, the login locations of `kimi login` and `codex login`, and the npm `upgrade` command.
276
+
277
+ ## Uninstalling
278
+
279
+ On macOS: stop the service and remove the router files:
277
280
 
278
281
  ```bash
279
282
  launchctl bootout "gui/$(id -u)/com.bert.claude-kimi-router"
@@ -282,52 +285,54 @@ rm ~/.claude/kimi-router.mjs ~/.claude/kimi-oauth.mjs ~/.claude/mistral.mjs ~/.c
282
285
  rm -r ~/.local/share/claude-model-router ~/.local/bin/claude-model-router-setup
283
286
  ```
284
287
 
285
- Op Linux:
288
+ On Linux:
286
289
 
287
290
  ```bash
288
291
  systemctl --user disable --now claude-model-router
289
292
  rm ~/.config/systemd/user/claude-model-router.service
290
293
  rm ~/.claude/kimi-router.mjs ~/.claude/kimi-oauth.mjs ~/.claude/mistral.mjs ~/.claude/secrets.mjs ~/.claude/codex.mjs ~/.claude/models-sync.mjs ~/.claude/update-check.mjs ~/.claude/router-models.json
291
- rm -r ~/.config/claude-model-router # de keys
294
+ rm -r ~/.config/claude-model-router # the keys
292
295
  rm -r ~/.local/share/claude-model-router ~/.local/bin/claude-model-router-setup
293
296
  ```
294
297
 
295
- Op Windows (PowerShell):
298
+ On Windows (PowerShell):
296
299
 
297
300
  ```powershell
298
301
  Unregister-ScheduledTask -TaskName claude-model-router -Confirm:$false
299
302
  Get-NetTCPConnection -LocalAddress 127.0.0.1 -LocalPort 8765 -State Listen -ErrorAction SilentlyContinue | ForEach-Object { Stop-Process -Id $_.OwningProcess -Force }
300
303
  Remove-Item "$env:USERPROFILE\.claude\kimi-router.mjs", "$env:USERPROFILE\.claude\kimi-oauth.mjs", "$env:USERPROFILE\.claude\mistral.mjs", "$env:USERPROFILE\.claude\secrets.mjs", "$env:USERPROFILE\.claude\codex.mjs", "$env:USERPROFILE\.claude\models-sync.mjs", "$env:USERPROFILE\.claude\update-check.mjs", "$env:USERPROFILE\.claude\kimi-router-run.ps1", "$env:USERPROFILE\.claude\router-models.json"
301
- Remove-Item -Recurse "$env:LOCALAPPDATA\claude-model-router" # de versleutelde keys
304
+ Remove-Item -Recurse "$env:LOCALAPPDATA\claude-model-router" # the encrypted keys
302
305
  ```
303
306
 
304
- Pas daarna op elk systeem `~/.claude/settings.json` aan; maak vooraf een back-up. Verwijder:
307
+ If you installed the command globally, also run `npm uninstall -g @euraika-bert/claude-model-router`.
308
+
309
+ Then edit `~/.claude/settings.json` on every system; make a backup first. Remove:
305
310
 
306
- - `ANTHROPIC_BASE_URL` en `_CLAUDE_CODE_ASSUME_FIRST_PARTY_BASE_URL`;
307
- - de Kimi-waarden `ANTHROPIC_CUSTOM_MODEL_OPTION_*`;
308
- - de SessionStart-hook met `update-check.mjs` onder `hooks`;
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*).
311
+ - `ANTHROPIC_BASE_URL` and `_CLAUDE_CODE_ASSUME_FIRST_PARTY_BASE_URL`;
312
+ - the Kimi values `ANTHROPIC_CUSTOM_MODEL_OPTION_*`;
313
+ - the SessionStart hook with `update-check.mjs` under `hooks`;
314
+ - the custom `modelPicker` and `modelSettings` entries, including the auto-added ones: their description starts with *Auto-added from the … catalog* (in older versions *Automatisch toegevoegd uit de …-catalogus*).
310
315
 
311
- De macOS-Keychain-items en de Kimi- en Codex-logins blijven bestaan, tenzij je ze apart verwijdert.
316
+ The macOS Keychain items and the Kimi and Codex logins stay in place unless you remove them separately.
312
317
 
313
- ## Repository-indeling
318
+ ## Repository layout
314
319
 
315
- - `package.json` en `bin/claude-model-router.mjs` — het npm-pakket en het `npx`-commando, dat de installer van je platform start.
316
- - `.gitlab-ci.yml` en `scripts/` — CI: tests en een scan op geheimen bij elke push; bij een versietag (`npm version patch`, daarna `git push --follow-tags`) publiceert de CI automatisch naar npm.
317
- - `install.sh` — installatie en herstel op macOS en Linux.
318
- - `install.ps1` — installatie op Windows.
319
- - `files/configure.mjs` — schrijft de routerinstellingen in `settings.json` voor de providers met een key of login; beide installers gebruiken dit script.
320
- - `files/kimi-router.mjs` — de localhost-router: modelselectie, Kimi-, Aliyun- en MiniMax-doorsturing, quota-failover en `/__health`.
321
- - `files/kimi-oauth.mjs` — Kimi OAuth-tokenrefresh met gedeelde credentials.
322
- - `files/mistral.mjs` — vertaling tussen Anthropic en Mistral, inclusief de terugval voor `reasoning_effort`.
323
- - `files/codex.mjs` — ChatGPT/Codex-route: OAuth-refresh uit `~/.codex/auth.json` en vertaling tussen Anthropic Messages en de OpenAI Responses API.
324
- - `files/secrets.mjs` — leest de Mistral-, Aliyun- en MiniMax-key uit de macOS Keychain, een DPAPI-bestand (Windows) of een bestand met rechten `600` (Linux).
325
- - `files/models-sync.mjs` — automatische synchronisatie van de Mistral-, Kimi- en Codex-catalogi, plus de logincontrole per provider.
326
- - `files/update-check.mjs` — versienummer en dagelijkse updatecheck (via `/__health`); met `--session-notice` de melding voor de SessionStart-hook.
327
- - `files/com.bert.claude-kimi-router.plist` — LaunchAgent-configuratie (macOS).
328
- - `test/mistral-effort.test.mjs` — controle voor de parser van Mistral-effortwaarden.
329
- - `test/usage.test.mjs` — controle dat cached tokens uit `input_tokens` gehaald worden (Mistral/Codex), plus de Codex-effortmapping en `environmentContext`.
320
+ - `package.json` and `bin/claude-model-router.mjs` — the npm package and the `npx` command, which runs your platform's installer.
321
+ - `.gitlab-ci.yml` and `scripts/` — CI: tests and a secret scan on every push; on a version tag (`npm version patch`, then `git push --follow-tags`) CI publishes to npm automatically.
322
+ - `install.sh` — install and recovery on macOS and Linux.
323
+ - `install.ps1` — install on Windows.
324
+ - `files/configure.mjs` — writes the router settings into `settings.json` for the providers with a key or login; used by both installers.
325
+ - `files/kimi-router.mjs` — the localhost router: model routing, Kimi, Aliyun and MiniMax forwarding, quota failover and `/__health`.
326
+ - `files/kimi-oauth.mjs` — Kimi OAuth token refresh with shared credentials.
327
+ - `files/mistral.mjs` — translation between Anthropic and Mistral, including the `reasoning_effort` fallback.
328
+ - `files/codex.mjs` — ChatGPT/Codex route: OAuth refresh from `~/.codex/auth.json` and translation between Anthropic Messages and the OpenAI Responses API.
329
+ - `files/secrets.mjs` — reads the Mistral, Aliyun and MiniMax keys from the macOS Keychain, a DPAPI file (Windows) or a mode-`600` file (Linux).
330
+ - `files/models-sync.mjs` — automatic sync of the Mistral, Kimi and Codex catalogs, plus the login check per provider.
331
+ - `files/update-check.mjs` — version number and daily update check (via `/__health`); with `--session-notice`, the notice for the SessionStart hook.
332
+ - `files/com.bert.claude-kimi-router.plist` — LaunchAgent configuration (macOS).
333
+ - `test/mistral-effort.test.mjs` — check for the Mistral effort-value parser.
334
+ - `test/usage.test.mjs` — checks that cached tokens are taken out of `input_tokens` (Mistral/Codex), the Codex effort mapping, `environmentContext` and the version check.
330
335
 
331
- ## Licentie
336
+ ## License
332
337
 
333
- MIT, © 2026 Euraika BV. Zie [LICENSE](LICENSE).
338
+ MIT, © 2026 Euraika BV. See [LICENSE](LICENSE).
@@ -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.5'; // keep equal to package.json (test/usage.test.mjs checks it)
7
+ export const VERSION = '0.1.6'; // 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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@euraika-bert/claude-model-router",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
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": {