@alexeiled/claude-router 1.19.2 → 1.20.1
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/.claude-plugin/plugin.json +1 -1
- package/CHANGELOG.md +27 -0
- package/docs/configuration.md +1 -0
- package/docs/providers.md +28 -2
- package/docs/router-band.svg +1 -1
- package/docs/router-pane-usage-whatif.svg +2 -2
- package/docs/router-pane-usage.svg +2 -2
- package/docs/user-guide.md +7 -3
- package/lib/band.mjs +20 -6
- package/lib/display.mjs +21 -9
- package/lib/panel.mjs +4 -5
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "router",
|
|
3
3
|
"displayName": "Router",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.20.1",
|
|
5
5
|
"description": "Native model and effort routing within your provider. Anthropic, DeepSeek, z.ai, MiniMax, MiMo and Kimi defaults, custom provider profiles, classifier advice and one model per subagent.",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Alexei Ledenev",
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,32 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.20.1 (2026-11-03)
|
|
4
|
+
|
|
5
|
+
### Changed
|
|
6
|
+
|
|
7
|
+
- One cost measure everywhere: every dollar is the reply's tokens at API list prices, on a Claude plan too. Profiles that mix plan and credits models, such as model-proxy with Opus and DeepSeek, get back one sum, its cheaper, stronger and cache-rebuild parts, the ledger, `vs yours`, What if and findings. This replaces the 1.20.0 per-billing split and its `observed credits … · plan … · your models mix plan and credits` line.
|
|
8
|
+
- The band's session row, `/router` and the comparison-unavailable line say what the replies cost: `routing −$1.84 (−22%) vs Opus 5.5 · xhigh = −$2.31 cheaper models +$0.47 cache rebuilds · $6.40 at API prices · 64 replies`. `observed $…` and `est. at list prices` are gone.
|
|
9
|
+
- The Usage footer and pane help say what an API price is and what it means on a plan.
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
|
|
13
|
+
- Name provider models in readouts: `DeepSeek Flash`, `GLM 5.3`, `MiniMax M3.1 Flash`, `MiMo V2.6 Pro`, `Kimi K3.1 Pro` instead of raw ids such as `Deepseek-flash[1m]`.
|
|
14
|
+
|
|
15
|
+
### Upgrade
|
|
16
|
+
|
|
17
|
+
Restart Claude Code after updating. No router-file or record changes are needed.
|
|
18
|
+
|
|
19
|
+
## 1.20.0 (2026-11-03)
|
|
20
|
+
|
|
21
|
+
### Changed
|
|
22
|
+
|
|
23
|
+
- Keep plan and credits apart when a profile mixes them, such as model-proxy with Opus and DeepSeek. The band, `/router`, the Now tab and Usage give each billing its own difference against your model, `routing credits +$4.10 · plan −$50.00 vs Opus 5.5 · medium`, instead of one sum that added plan quota to paid credits. The ledger becomes a per-billing table; cross-billing parts, `vs yours` cells and findings are left out. Single-billing profiles read as before.
|
|
24
|
+
- Document how the model-proxy launch model sets both the fallback and the comparison, and which tier each launch model starts at.
|
|
25
|
+
|
|
26
|
+
### Upgrade
|
|
27
|
+
|
|
28
|
+
Restart Claude Code after updating. No router-file or record changes are needed: existing records split by the billing of the models they name.
|
|
29
|
+
|
|
3
30
|
## 1.19.2 (2026-11-01)
|
|
4
31
|
|
|
5
32
|
### Added
|
package/docs/configuration.md
CHANGED
|
@@ -58,6 +58,7 @@ New provider sources: [MiniMax pricing](https://platform.minimax.io/docs/pricing
|
|
|
58
58
|
[MiMo pricing](https://mimo.mi.com/docs/en-US/pricing), and [Kimi pricing](https://platform.kimi.ai/docs/pricing/chat).
|
|
59
59
|
All non-Anthropic built-in presets use `billing: "credits"`.
|
|
60
60
|
For an included-plan model, set `billing: "plan"` to disable the cold-input cash cap.
|
|
61
|
+
`billing` does not change a readout: Usage prices plan and credits models alike, at API prices; see [every dollar is an API price](user-guide.md#every-dollar-is-an-api-price).
|
|
61
62
|
A provider name or URL does not establish its billing product.
|
|
62
63
|
|
|
63
64
|
### Provider cache behavior
|
package/docs/providers.md
CHANGED
|
@@ -214,7 +214,8 @@ Claude Code sends every request to one local `claude-proxy` endpoint. The proxy
|
|
|
214
214
|
|
|
215
215
|
1. Install and configure [claude-proxy](https://github.com/alexei-led/claude-proxy/blob/main/docs/integration.md).
|
|
216
216
|
2. Save the following complete profile as `model-proxy-router.json` in the selected Claude Code configuration directory.
|
|
217
|
-
3. Start the proxy manually, then use its `connect` command from v0.1.
|
|
217
|
+
3. Start the proxy manually, then use its `connect` command from v0.1.4 or newer.
|
|
218
|
+
Older proxies forward Claude Code's built-in Artifact tool schema unchanged, and DeepSeek rejects its `pattern` regex with `400 Invalid schema for function 'Artifact'`.
|
|
218
219
|
|
|
219
220
|
```json
|
|
220
221
|
{
|
|
@@ -287,14 +288,39 @@ The default classifier is Jev and needs its existing plugin credential. Select a
|
|
|
287
288
|
claude-proxy --config /path/to/proxy.json
|
|
288
289
|
|
|
289
290
|
# Terminal 2: preserve that account's existing CLAUDE_CONFIG_DIR
|
|
290
|
-
|
|
291
|
+
CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1 CLAUDE_CODE_ATTRIBUTION_HEADER=0 ENABLE_TOOL_SEARCH=false \
|
|
292
|
+
claude-proxy connect --config /path/to/proxy.json -- claude --model 'deepseek-flash[1m]'
|
|
291
293
|
```
|
|
292
294
|
|
|
295
|
+
Any turn may reach DeepSeek, so set the same Claude Code flags a direct DeepSeek session needs:
|
|
296
|
+
|
|
297
|
+
| Variable | Why |
|
|
298
|
+
| --- | --- |
|
|
299
|
+
| `CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1` | Drops beta request fields that third-party endpoints reject. Opus turns lose those betas too. |
|
|
300
|
+
| `CLAUDE_CODE_ATTRIBUTION_HEADER=0` | Omits the per-version attribution block, so the system prompt stays cacheable upstream. |
|
|
301
|
+
| `ENABLE_TOOL_SEARCH=false` | Tool search sends `tool_definition` blocks; DeepSeek answers `422 unknown variant`. |
|
|
302
|
+
|
|
293
303
|
`connect` supplies `CLAUDE_ROUTER_PROVIDER=model-proxy`, the local URL and the separate local access header only to the child process.
|
|
294
304
|
It does not change saved OAuth, configure provider keys, start the proxy, or install this Mod.
|
|
295
305
|
Without the helper, the proxy guide documents equivalent process-local environment setup.
|
|
296
306
|
Endpoint and credential fields do not belong in this router JSON.
|
|
297
307
|
|
|
308
|
+
### Choose the launch model
|
|
309
|
+
|
|
310
|
+
The `--model` you launch with is your model, as in any profile. It serves the turns routing does not choose, and Usage compares the routed replies against it.
|
|
311
|
+
Launch on the model you would otherwise use:
|
|
312
|
+
|
|
313
|
+
| Launch model | Routing starts | Usage compares with |
|
|
314
|
+
| --- | --- | --- |
|
|
315
|
+
| `deepseek-flash[1m]` | at `low`, on DeepSeek | DeepSeek: Opus turns show as stronger models, at their API price |
|
|
316
|
+
| `claude-opus-5-5` | at `high`, on Opus, until the classifier supports a cheaper tier | Opus: DeepSeek turns show as cheaper models |
|
|
317
|
+
|
|
318
|
+
A launch model must be a model that some route runs. On any other model, a fresh session starts with routing off.
|
|
319
|
+
To start on another Claude model, such as Sonnet, add it to `models`, put it on a route, and map it in the proxy configuration.
|
|
320
|
+
|
|
321
|
+
Opus is billed by the plan and DeepSeek in credits, but Usage prices both at API prices, so one sum compares them: `routing −$41.20 (−10%) vs Opus 5.5 · high`.
|
|
322
|
+
See [every dollar is an API price](user-guide.md#every-dollar-is-an-api-price).
|
|
323
|
+
|
|
298
324
|
Open `/router` and check the selected file, classifier health and routing state before use.
|
|
299
325
|
The catalog must contain the bare native IDs; `[1m]` is client metadata, not a proxy alias.
|
|
300
326
|
Every selected provider receives the unchanged history. Approve each destination; do not mix company context into an unapproved provider.
|
package/docs/router-band.svg
CHANGED
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
<text x="94.2" y="140" fill="#6fcf97" font-weight="700" xml:space="preserve">routing −$1.84 (−22%)</text>
|
|
51
51
|
<text x="258.0" y="140" fill="#d0d0d0" xml:space="preserve"> vs Opus 5.5 · xhigh</text>
|
|
52
52
|
<text x="414.0" y="140" fill="#7c7c7c" xml:space="preserve"> = −$2.31 + $0.47</text>
|
|
53
|
-
<text x="562.2" y="140" fill="#7c7c7c" xml:space="preserve"> · 64 replies</text>
|
|
53
|
+
<text x="562.2" y="140" fill="#7c7c7c" xml:space="preserve"> · $6.40 at API prices · 64 replies</text>
|
|
54
54
|
<text x="24.0" y="159" fill="#7c7c7c" xml:space="preserve">pin next turn </text>
|
|
55
55
|
<rect x="133.2" y="145" width="70.2" height="18" rx="4" fill="#2e3340"/>
|
|
56
56
|
<text x="133.2" y="159" fill="#d0d0d0" xml:space="preserve">[ micro ]</text>
|
|
@@ -180,8 +180,8 @@
|
|
|
180
180
|
<text x="390.6" y="908" fill="#7c7c7c" xml:space="preserve"> its agent file sets it</text>
|
|
181
181
|
<text x="24.0" y="946" fill="#7c7c7c" xml:space="preserve"> ■ moved by the router · □ Claude Code’s pick · color: the model</text>
|
|
182
182
|
<text x="24.0" y="965" fill="#7c7c7c" xml:space="preserve"> vs CC: the same tokens on Claude Code’s pick, at list prices</text>
|
|
183
|
-
<text x="24.0" y="1003" fill="#7c7c7c" xml:space="preserve">
|
|
184
|
-
<text x="24.0" y="1022" fill="#7c7c7c" xml:space="preserve"> on a Claude plan it
|
|
183
|
+
<text x="24.0" y="1003" fill="#7c7c7c" xml:space="preserve"> every $ at API prices, plan and credits alike · not a bill;</text>
|
|
184
|
+
<text x="24.0" y="1022" fill="#7c7c7c" xml:space="preserve"> on a Claude plan it shows quota use · answer quality not measured</text>
|
|
185
185
|
<rect x="24.0" y="1046" width="140.4" height="18" rx="4" fill="#2e3340"/>
|
|
186
186
|
<text x="24.0" y="1060" fill="#7c7c7c" xml:space="preserve">[ Delete history ]</text>
|
|
187
187
|
<rect x="24.0" y="1065" width="70.2" height="18" rx="4" fill="#2e3340"/>
|
|
@@ -179,8 +179,8 @@
|
|
|
179
179
|
<text x="390.6" y="908" fill="#7c7c7c" xml:space="preserve"> its agent file sets it</text>
|
|
180
180
|
<text x="24.0" y="946" fill="#7c7c7c" xml:space="preserve"> ■ moved by the router · □ Claude Code’s pick · color: the model</text>
|
|
181
181
|
<text x="24.0" y="965" fill="#7c7c7c" xml:space="preserve"> vs CC: the same tokens on Claude Code’s pick, at list prices</text>
|
|
182
|
-
<text x="24.0" y="1003" fill="#7c7c7c" xml:space="preserve">
|
|
183
|
-
<text x="24.0" y="1022" fill="#7c7c7c" xml:space="preserve"> on a Claude plan it
|
|
182
|
+
<text x="24.0" y="1003" fill="#7c7c7c" xml:space="preserve"> every $ at API prices, plan and credits alike · not a bill;</text>
|
|
183
|
+
<text x="24.0" y="1022" fill="#7c7c7c" xml:space="preserve"> on a Claude plan it shows quota use · answer quality not measured</text>
|
|
184
184
|
<rect x="24.0" y="1046" width="140.4" height="18" rx="4" fill="#2e3340"/>
|
|
185
185
|
<text x="24.0" y="1060" fill="#7c7c7c" xml:space="preserve">[ Delete history ]</text>
|
|
186
186
|
<rect x="24.0" y="1065" width="70.2" height="18" rx="4" fill="#2e3340"/>
|
package/docs/user-guide.md
CHANGED
|
@@ -61,7 +61,7 @@ Read the first line of the picture from left to right:
|
|
|
61
61
|
| `✕ Routing unavailable` | Nothing routes: a missing/invalid provider file, an old Claude Code, or leftover v0.8 settings. **Fix** opens the pane. |
|
|
62
62
|
| `○ Router · ■ Haiku 5.5 · moved down by the router` | You are viewing a subagent's transcript. The model it runs on, and who picked it; see below. |
|
|
63
63
|
|
|
64
|
-
The band shows one routing control at a time. While routing is on, hover over the band for a second row: pin a tier for the next turn, **Turn off** routing, or show two rows. While routing is off, **Turn on** sits on the first line next to `Routing off` and stays at any width: a narrow band drops the explanation and the model first. On a narrow band the hover row drops `routing on`, then **2 rows**, then `pin next turn`, then the pins; it keeps **Turn off**, and **1 row** when the band shows two. The hover row needs a pointer: from the keyboard, run `/router off`, or open the pane and press `f`. The two-row band adds this session against your model,
|
|
64
|
+
The band shows one routing control at a time. While routing is on, hover over the band for a second row: pin a tier for the next turn, **Turn off** routing, or show two rows. While routing is off, **Turn on** sits on the first line next to `Routing off` and stays at any width: a narrow band drops the explanation and the model first. On a narrow band the hover row drops `routing on`, then **2 rows**, then `pin next turn`, then the pins; it keeps **Turn off**, and **1 row** when the band shows two. The hover row needs a pointer: from the keyboard, run `/router off`, or open the pane and press `f`. The two-row band adds this session against your model, the parts that add up to it, and what the replies cost: `session routing −$1.84 (−22%) vs Opus 5.5 · xhigh = −$2.31 cheaper models +$0.47 cache rebuilds · $6.40 at API prices · 64 replies`, or `session routing +$2.48 (×5.0) vs Haiku 5.5 · high = +$2.31 stronger models +$0.17 cache rebuilds · $3.10 at API prices · 41 replies` when routing cost more. Read it as: the routed replies cost $6.40 at API prices, $1.84 less than the same tokens on Opus 5.5 · xhigh would have cost; cheaper models saved $2.31 and the cache rebuilds after switches took back $0.47. Minus is less than your model, plus is more. **Cache rebuilds** is what the model switches cost: the next model must write the prompt cache again. The row is the first line of the pane's SESSION block, with the same words and the same number, and both count the replies of the turn still running. After a `/model` change the row names the models the replies ran against, as the Usage tab does. Before the tenth routed reply it leaves out the parts and adds `early sample`, as the pane does, because one switch can decide a short run: `session routing −$0.05 (−19%) vs Opus 5.5 · xhigh · $0.21 at API prices · 3 replies · early sample`. When the row is short, the parts lose their words (`= −$2.31 + $0.47`), then the parts drop, then the reply count, then the cost. Every dollar is an [API price](#every-dollar-is-an-api-price). Router remembers that choice across sessions. When Router changes the model between turns, a toast reads `Model changed: old → new · reason`. A pin does not raise one, and neither does a change of effort alone.
|
|
65
65
|
|
|
66
66
|
The band steps aside while a survey needs the space.
|
|
67
67
|
|
|
@@ -108,7 +108,7 @@ The Usage tab keeps observed routed spend and, when the cache history permits it
|
|
|
108
108
|
|
|
109
109
|
The top row picks the period: **Session**, **Today**, **7d** (today and the six days before), **30d**, **Month** (since the first of this month) and **All**. Press `p` for the next one. The pane remembers the choice across sessions. Session holds this session's replies, and the line under the row names your model, or every model when `/model` changed during the session. The other periods add up the replies of every session on those calendar days. Each session counts against its own model, and the line reads `all projects · Oct 7 – Oct 13 · each session vs its own model`.
|
|
110
110
|
|
|
111
|
-
When comparisons are unavailable, the band, Now tab and Usage tab say
|
|
111
|
+
When comparisons are unavailable, the band, Now tab and Usage tab say `$… at API prices · N replies · comparison unavailable`.
|
|
112
112
|
Counts, tokens, activity/model/tier breakdowns and cost trends still include these replies. A mixed period labels the
|
|
113
113
|
comparable subset separately; its savings cover only those replies. `vs yours` is `—` for a row with incomplete
|
|
114
114
|
comparison coverage, and **What if** stays unavailable rather than inventing a baseline. This is common with automatic
|
|
@@ -124,6 +124,10 @@ When the whole period is comparable, the answer comes first, in the band's words
|
|
|
124
124
|
| + Cache rebuilds | What rewriting the prompt cache after a model switch cost, and its share of the saving. |
|
|
125
125
|
| = Routed | What the routed replies cost, with a bar against your model: `54% of your model`, or `×2.1`. |
|
|
126
126
|
|
|
127
|
+
#### Every dollar is an API price
|
|
128
|
+
|
|
129
|
+
Every dollar in the band, `/router`, the Now tab and Usage is the same measure: the reply's tokens at the list prices in `router.json`, as if paid per token. It is not a bill. On a Claude plan it shows how much quota you use, in the same dollars as a model billed in credits. A profile that mixes the two, such as the [model-proxy profile](providers.md#mix-anthropic-and-deepseek-with-model-proxy) with Opus and DeepSeek, gets one sum and one comparison: `routing −$41.20 (−10%) vs Opus 5.5 · high` means the routed replies cost $41.20 less at API prices than the same tokens on Opus. `billing` in `router.json` sets only the credits cap on cold cache writes; it does not change a readout.
|
|
130
|
+
|
|
127
131
|
A line of counts follows: replies, turns, input tokens, the share of the input read from the cache, and output tokens. With routing off or unavailable and no routed reply this session, the tab says the replies use your model and are not counted.
|
|
128
132
|
|
|
129
133
|
**BY** splits the period's cost by **Activity**, **Model** or **Tier**. Press `g` for the next grouping. Each row gives the replies, the routed cost and `vs yours`, the difference against your model. The last column is the route most of the row's replies used, or, by model, the row's share of the cost. Select **▸** to open a row. An activity lists its routes, and a model or a tier lists its activities. A line under them gives the row's cheaper, stronger and switch parts and its tokens. A narrow pane drops the last column first.
|
|
@@ -232,7 +236,7 @@ These thresholds are starting values. They are not tuned on data yet.
|
|
|
232
236
|
|
|
233
237
|
On the **Classifier** tab, **ACROSS SESSIONS · since the last reset** shows the counts kept across sessions, once there are any: the turns labelled from their tools, **Agreement** over them, **Code/ops/explore**, the same agreement over the turns the classifier answered `code`, `ops` or `explore` (omitted when there are none), the two most frequent mismatches as `predicted → observed count` (`code → read 3`), **Activity moves**, the moves to another route inside a tier, taken and refused for any reason, **Escalations**, such as `after a cheaper activity move: 1 in 12 moves`, the tool-error escalations that followed a move to a cheaper route in `on` while the turns stayed on it in `on` (turning routing off, a turn with routing off, or a turn in `off` ends the watch, a pin in between does not, and an escalation the credits cap held counts). Each of these lines appears only when it has data. The active classifier's p95 wait across sessions shows on its **Deadline** line instead (not recorded with activity routing `off`). This agreement compares the classifier's raw answer, so it can differ from the session's. The pane reads these counts when the session starts and when it opens, and adds this session's turns as they finish; another session's new latency and escalation readings show the next time the pane opens. **Delete history** on the Usage tab deletes these counts with the usage and subagent records, for this session and across sessions.
|
|
234
238
|
|
|
235
|
-
`/router` without a UI surface adds an `Activity: ops (81%)` line, the resolved route, and `Agreement across sessions: 19 of 22 turns (86%) · code/ops/explore 9 of 10 (90%)`. It also prints the session in the band's words, such as `Session: routing −$1.84 (−22%) vs Opus 5.5 · xhigh = −$2.31 cheaper models +$0.47 cache rebuilds,
|
|
239
|
+
`/router` without a UI surface adds an `Activity: ops (81%)` line, the resolved route, and `Agreement across sessions: 19 of 22 turns (86%) · code/ops/explore 9 of 10 (90%)`. It also prints the session in the band's words, such as `Session: routing −$1.84 (−22%) vs Opus 5.5 · xhigh = −$2.31 cheaper models +$0.47 cache rebuilds, $6.40 at API prices, 64 replies`.
|
|
236
240
|
|
|
237
241
|
## Change routing
|
|
238
242
|
|
package/lib/band.mjs
CHANGED
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
savingsColor,
|
|
20
20
|
sessionUsage,
|
|
21
21
|
shortReason,
|
|
22
|
+
spentText,
|
|
22
23
|
TIER_COLOR,
|
|
23
24
|
unavailableReason,
|
|
24
25
|
usageMetrics,
|
|
@@ -214,9 +215,9 @@ export function bandSegments(config, view, usage, actions) {
|
|
|
214
215
|
}
|
|
215
216
|
|
|
216
217
|
// The second row of the detailed band: this session against your model, as the pane's SESSION block starts, and the
|
|
217
|
-
// parts that add up to it: "routing +$0.18 (+4%) vs Opus 5.5 · high = −$0.42 cheaper
|
|
218
|
-
// rebuilds · 34 replies". When the band is narrow the parts lose their
|
|
219
|
-
// parts.
|
|
218
|
+
// parts that add up to it, then what the replies cost: "routing +$0.18 (+4%) vs Opus 5.5 · high = −$0.42 cheaper
|
|
219
|
+
// models +$0.60 cache rebuilds · $4.62 at API prices · 34 replies". When the band is narrow the parts lose their
|
|
220
|
+
// words, then the parts go, then the reply count, then the cost.
|
|
220
221
|
export function sessionRow(config, view, columns, now = Date.now()) {
|
|
221
222
|
const label = part('session ', { dimColor: true });
|
|
222
223
|
const summary = sessionUsage(view, now);
|
|
@@ -230,6 +231,7 @@ export function sessionRow(config, view, columns, now = Date.now()) {
|
|
|
230
231
|
return [label, part(`${modelName(view.nativeModel)} has no list price`, { dimColor: true })];
|
|
231
232
|
if (!r.replies) return [part('no replies yet', { dimColor: true })];
|
|
232
233
|
const count = `${r.replies} repl${r.replies === 1 ? 'y' : 'ies'}`;
|
|
234
|
+
const spent = spentText(r.routedUsd);
|
|
233
235
|
const answer = [
|
|
234
236
|
label,
|
|
235
237
|
part(routingAnswer(r), { color: savingsColor(r.differenceUsd), bold: true }),
|
|
@@ -242,8 +244,14 @@ export function sessionRow(config, view, columns, now = Date.now()) {
|
|
|
242
244
|
columns,
|
|
243
245
|
).flatMap((s) => s.parts);
|
|
244
246
|
// Below EARLY_REPLIES one switch decides the sum, so the parts wait, as on the pane.
|
|
245
|
-
if (r.early)
|
|
246
|
-
|
|
247
|
+
if (r.early)
|
|
248
|
+
return fit([
|
|
249
|
+
[...answer, part(`${SEPARATOR}${spent} · ${count} · early sample`, { dimColor: true })],
|
|
250
|
+
[...answer, part(`${SEPARATOR}${spent}`, { dimColor: true })],
|
|
251
|
+
answer,
|
|
252
|
+
]);
|
|
253
|
+
const replies = part(`${SEPARATOR}${spent} · ${count}`, { dimColor: true });
|
|
254
|
+
const cost = part(`${SEPARATOR}${spent}`, { dimColor: true });
|
|
247
255
|
const parts = costParts(r);
|
|
248
256
|
const named = parts.flatMap(([amount, words, value], i) => [
|
|
249
257
|
part(i ? ' ' : ' = ', { dimColor: true }),
|
|
@@ -256,7 +264,13 @@ export function sessionRow(config, view, columns, now = Date.now()) {
|
|
|
256
264
|
}),
|
|
257
265
|
]
|
|
258
266
|
: [];
|
|
259
|
-
return fit([
|
|
267
|
+
return fit([
|
|
268
|
+
[...answer, ...named, replies],
|
|
269
|
+
[...answer, ...bare, replies],
|
|
270
|
+
[...answer, replies],
|
|
271
|
+
[...answer, cost],
|
|
272
|
+
answer,
|
|
273
|
+
]);
|
|
260
274
|
}
|
|
261
275
|
|
|
262
276
|
// The row revealed under the pointer: pins and the mode control while routing is on, and the one- or two-row choice.
|
package/lib/display.mjs
CHANGED
|
@@ -70,11 +70,20 @@ export const NOT_A_TIER_REASON = 'not a routing tier';
|
|
|
70
70
|
|
|
71
71
|
export function modelName(id) {
|
|
72
72
|
if (!id) return 'no response yet';
|
|
73
|
+
if (id.startsWith('claude-'))
|
|
74
|
+
return id
|
|
75
|
+
.replace(/^claude-/, '')
|
|
76
|
+
.replace(/-([0-9])-([0-9])(-\d{8})?$/, ' $1.$2')
|
|
77
|
+
.replace(/^./, (c) => c.toUpperCase());
|
|
78
|
+
// A provider id, `deepseek-flash[1m]` → "DeepSeek Flash": the `[1m]` context suffix is client metadata, not a name.
|
|
73
79
|
return id
|
|
74
|
-
.replace(
|
|
75
|
-
.
|
|
76
|
-
.replace(/^./, (c) => c.toUpperCase())
|
|
80
|
+
.replace(/\[[^\]]*\]$/, '')
|
|
81
|
+
.split('-')
|
|
82
|
+
.map((word) => BRANDS[word.toLowerCase()] ?? word.replace(/^./, (c) => c.toUpperCase()))
|
|
83
|
+
.join(' ');
|
|
77
84
|
}
|
|
85
|
+
// Provider names whose casing a capital first letter gets wrong.
|
|
86
|
+
const BRANDS = { deepseek: 'DeepSeek', glm: 'GLM', minimax: 'MiniMax', mimo: 'MiMo' };
|
|
78
87
|
|
|
79
88
|
// "Opus 5.5 · high"; a model with no effort reading shows its name alone.
|
|
80
89
|
export const routeLabel = (model, effort) =>
|
|
@@ -345,9 +354,12 @@ export const liveUsage = (view, record) => withReplies(readUsage(record), view.u
|
|
|
345
354
|
// This session's routed replies, the running turns' included.
|
|
346
355
|
export const sessionUsage = (view, now) => summarize(liveUsage(view, view.usageSession), periodRange('session', now));
|
|
347
356
|
|
|
348
|
-
//
|
|
357
|
+
// Every dollar amount is a reply's tokens at the router.json list prices, as if paid per token: on a Claude plan it
|
|
358
|
+
// shows quota use in the same dollars as credits, so plan and credit models add up and compare.
|
|
359
|
+
export const spentText = (value) => `${usd(value)} at API prices`;
|
|
360
|
+
// What the replies cost is known even when a counterfactual cache history cannot be priced.
|
|
349
361
|
export const observedUsageText = (observed) =>
|
|
350
|
-
|
|
362
|
+
`${spentText(observed.routedUsd)} · ${replyCount(observed.replies)} · comparison unavailable`;
|
|
351
363
|
|
|
352
364
|
// The models a session's replies were priced against, when they are not the one `/model` selects now: after a
|
|
353
365
|
// `/model` change the record keeps each reply against the model selected when it ran. Null when they are.
|
|
@@ -383,22 +395,22 @@ export function savingsLine(config, view, now) {
|
|
|
383
395
|
const summary = sessionUsage(view, now);
|
|
384
396
|
const session = readout(summary);
|
|
385
397
|
if (summary.observed.uncomparedReplies)
|
|
386
|
-
return `Session: ${observedUsageText(summary.observed)}${session.replies ? `; ${replyCount(session.replies)} comparable only: ${routingAnswer(session)}` : ''}
|
|
398
|
+
return `Session: ${observedUsageText(summary.observed)}${session.replies ? `; ${replyCount(session.replies)} comparable only: ${routingAnswer(session)}` : ''}`;
|
|
387
399
|
const label = `vs ${comparedModel(config, view, summary)}`;
|
|
388
400
|
if (!session.replies) {
|
|
389
401
|
const kept = allTime(view.usageStore, view.savingsStore);
|
|
390
402
|
const across = readout(kept.totals);
|
|
391
403
|
if (kept.observed.uncomparedReplies)
|
|
392
|
-
return `Session ${label}: no routed replies yet; across sessions ${observedUsageText(kept.observed)}
|
|
404
|
+
return `Session ${label}: no routed replies yet; across sessions ${observedUsageText(kept.observed)}`;
|
|
393
405
|
const saved = across.early
|
|
394
406
|
? ''
|
|
395
407
|
: `; ${routingAnswer(across)} since ${sinceDate(kept.since)}, each session against its own model`;
|
|
396
408
|
return `Session ${label}: no routed replies yet${saved}`;
|
|
397
409
|
}
|
|
398
410
|
if (session.early)
|
|
399
|
-
return `Session: ${routingAnswer(session)} ${label}, ${replyCount(session.replies)}, early sample
|
|
411
|
+
return `Session: ${routingAnswer(session)} ${label}, ${spentText(session.routedUsd)}, ${replyCount(session.replies)}, early sample`;
|
|
400
412
|
const parts = costParts(session).map(([amount, words]) => `${amount} ${words}`);
|
|
401
|
-
return `Session: ${routingAnswer(session)} ${label}${parts.length ? ` = ${parts.join(' ')}` : ''}, ${
|
|
413
|
+
return `Session: ${routingAnswer(session)} ${label}${parts.length ? ` = ${parts.join(' ')}` : ''}, ${spentText(session.routedUsd)}, ${replyCount(session.replies)}`;
|
|
402
414
|
}
|
|
403
415
|
|
|
404
416
|
export const GATEWAY_SETTINGS = 'v0.8 gateway settings remain · see /router';
|
package/lib/panel.mjs
CHANGED
|
@@ -1290,10 +1290,9 @@ function storeUsage(ui, store, metrics) {
|
|
|
1290
1290
|
// The footer as [text, joiner] pieces, packed to the pane: two lines at full width, more in a narrow pane, never a
|
|
1291
1291
|
// line that ends in a joiner.
|
|
1292
1292
|
const SAVINGS_FOOTER = [
|
|
1293
|
-
['API
|
|
1294
|
-
['same tokens and output length', ' · '],
|
|
1293
|
+
['every $ at API prices, plan and credits alike', ' · '],
|
|
1295
1294
|
['not a bill;', ' '],
|
|
1296
|
-
['on a Claude plan it
|
|
1295
|
+
['on a Claude plan it shows quota use', ' · '],
|
|
1297
1296
|
['answer quality not measured', ''],
|
|
1298
1297
|
];
|
|
1299
1298
|
const FULL_WIDTH = 68;
|
|
@@ -2121,8 +2120,8 @@ function helpLines(ui) {
|
|
|
2121
2120
|
return [
|
|
2122
2121
|
ui.text(' '),
|
|
2123
2122
|
ui.head('ABOUT THESE NUMBERS'),
|
|
2124
|
-
ui.dim('Cost, context and cache are Claude readings. $
|
|
2125
|
-
ui.dim('
|
|
2123
|
+
ui.dim('Cost, context and cache are Claude readings. Every $ is API prices:'),
|
|
2124
|
+
ui.dim('tokens × router.json list prices, as if paid per token, on a plan too.'),
|
|
2126
2125
|
ui.dim('Routing vs your model holds tokens and output length the same'),
|
|
2127
2126
|
ui.dim('and does not measure answer quality. Cache benefit is before writes.'),
|
|
2128
2127
|
ui.dim('The context bar uses the routed model’s window, 20% in reserve.'),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alexeiled/claude-router",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.20.1",
|
|
4
4
|
"description": "Native Claude Code model and effort routing with Anthropic, DeepSeek, z.ai, MiniMax, MiMo and Kimi defaults, custom provider profiles, and classifier advice.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Alexei Ledenev",
|