@alexeiled/claude-router 1.20.0 → 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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "router",
3
3
  "displayName": "Router",
4
- "version": "1.20.0",
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,21 @@
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
+
3
19
  ## 1.20.0 (2026-11-03)
4
20
 
5
21
  ### Changed
@@ -58,7 +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
- When a profile mixes plan and credits models, Usage gives each billing its own difference instead of one sum; see [plan and credits apart](user-guide.md#plan-and-credits-apart).
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).
62
62
  A provider name or URL does not establish its billing product.
63
63
 
64
64
  ### Provider cache behavior
package/docs/providers.md CHANGED
@@ -312,14 +312,14 @@ Launch on the model you would otherwise use:
312
312
 
313
313
  | Launch model | Routing starts | Usage compares with |
314
314
  | --- | --- | --- |
315
- | `deepseek-flash[1m]` | at `low`, on DeepSeek | DeepSeek: Opus turns show as plan quota spent and credits saved |
316
- | `claude-opus-5-5` | at `high`, on Opus, until the classifier supports a cheaper tier | Opus: DeepSeek turns show as credits spent and plan quota saved |
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
317
 
318
318
  A launch model must be a model that some route runs. On any other model, a fresh session starts with routing off.
319
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
320
 
321
- Opus is billed by the plan and DeepSeek in credits, so Usage keeps the two apart: `routing credits +$4.10 · plan −$50.00 vs Opus 5.5 · medium`.
322
- See [plan and credits apart](user-guide.md#plan-and-credits-apart).
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
323
 
324
324
  Open `/router` and check the selected file, classifier health and routing state before use.
325
325
  The catalog must contain the bare native IDs; `[1m]` is client metadata, not a proxy alias.
@@ -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"> API list prices · same tokens and output length · not a bill;</text>
184
- <text x="24.0" y="1022" fill="#7c7c7c" xml:space="preserve"> on a Claude plan it stands for quota · answer quality not measured</text>
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"> API list prices · same tokens and output length · not a bill;</text>
183
- <text x="24.0" y="1022" fill="#7c7c7c" xml:space="preserve"> on a Claude plan it stands for quota · answer quality not measured</text>
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"/>
@@ -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, and the parts that add up to it: `session routing −$1.84 (−22%) vs Opus 5.5 · xhigh = −$2.31 cheaper models +$0.47 cache rebuilds · 64 replies`, or `session routing +$2.48 (×5.0) vs Haiku 5.5 · high = +$2.31 stronger models +$0.17 cache rebuilds · 41 replies` when routing cost more. 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 · 3 replies · early sample`. When the row is short, the parts lose their words (`= −$2.31 + $0.47`), then the reply count drops, then the parts. 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.
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 `observed $… · N replies · comparison unavailable`.
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,11 +124,9 @@ 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
- #### Plan and credits apart
127
+ #### Every dollar is an API price
128
128
 
129
- A profile can mix models billed by a Claude plan (`billing: "plan"`) with models billed in credits (`billing: "credits"`), such as the [model-proxy profile](providers.md#mix-anthropic-and-deepseek-with-model-proxy). Plan dollars stand for quota; credits are paid. When the replies ran on, or are compared with, models of both billings, every readout gives each billing its own difference instead of one sum: `routing credits +$4.10 · plan −$50.00 vs Opus 5.5 · medium`. Here routing spent $4.10 of credits on DeepSeek and saved $50.00 of Opus quota at list prices. The ledger becomes a table of routed cost, your model's cost and the difference per billing. The cheaper, stronger and cache-rebuild parts are left out, because each would subtract quota from cash. In **BY**, a row whose models are not billed as your model is names its billing (`credits`, `plan` or `both`) in place of `vs yours`. **What if** names it the same way, and **WORTH A LOOK** keeps only the share of the cost.
130
-
131
- A model's billing comes from the selected profile, or from a built-in profile when the selected file does not list that model. If your models themselves span both billings in the period, for example after `/model` moved between Opus and DeepSeek, there is no single model to compare with. The readout then shows what each billing cost: `observed credits $4.10 · plan $20.00 · your models mix plan and credits`. A model that no profile prices, and **All** with totals from before dated records, keep the single sum.
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.
132
130
 
133
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.
134
132
 
@@ -238,7 +236,7 @@ These thresholds are starting values. They are not tuned on data yet.
238
236
 
239
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.
240
238
 
241
- `/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, 64 replies, est. at list prices`.
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`.
242
240
 
243
241
  ## Change routing
244
242
 
package/lib/band.mjs CHANGED
@@ -1,8 +1,6 @@
1
1
  import { activeClassifier, TIERS } from './config.mjs';
2
2
  import {
3
3
  activityVerb,
4
- answerSegments,
5
- billingSplit,
6
4
  classifierLabel,
7
5
  classifierStatus,
8
6
  classifierWarns,
@@ -16,11 +14,12 @@ import {
16
14
  percentPair,
17
15
  reasonActivity,
18
16
  routeLabel,
17
+ routingAnswer,
19
18
  routingModeText,
20
19
  savingsColor,
21
20
  sessionUsage,
22
21
  shortReason,
23
- splitCompared,
22
+ spentText,
24
23
  TIER_COLOR,
25
24
  unavailableReason,
26
25
  usageMetrics,
@@ -216,28 +215,28 @@ export function bandSegments(config, view, usage, actions) {
216
215
  }
217
216
 
218
217
  // The second row of the detailed band: this session against your model, as the pane's SESSION block starts, and the
219
- // parts that add up to it: "routing +$0.18 (+4%) vs Opus 5.5 · high = −$0.42 cheaper models +$0.60 cache
220
- // rebuilds · 34 replies". When the band is narrow the parts lose their words, then the reply count goes, then the
221
- // 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.
222
221
  export function sessionRow(config, view, columns, now = Date.now()) {
223
222
  const label = part('session ', { dimColor: true });
224
223
  const summary = sessionUsage(view, now);
225
224
  const r = readout(summary);
226
- const split = billingSplit(config, summary);
227
225
  if (summary.observed.uncomparedReplies)
228
226
  return fitSegments(
229
- [segment(0, label, part(observedUsageText(summary.observed, split), { dimColor: true }))],
227
+ [segment(0, label, part(observedUsageText(summary.observed), { dimColor: true }))],
230
228
  columns,
231
229
  ).flatMap((s) => s.parts);
232
230
  if (!modelSpec(config, view.nativeModel))
233
231
  return [label, part(`${modelName(view.nativeModel)} has no list price`, { dimColor: true })];
234
232
  if (!r.replies) return [part('no replies yet', { dimColor: true })];
235
233
  const count = `${r.replies} repl${r.replies === 1 ? 'y' : 'ies'}`;
234
+ const spent = spentText(r.routedUsd);
236
235
  const answer = [
237
236
  label,
238
- ...answerSegments(r, split).map(({ text, value }) => part(text, { color: savingsColor(value), bold: true })),
239
- split && !splitCompared(split) ? null : part(` vs ${comparedModel(config, view, summary)}`),
240
- ].filter(Boolean);
237
+ part(routingAnswer(r), { color: savingsColor(r.differenceUsd), bold: true }),
238
+ part(` vs ${comparedModel(config, view, summary)}`),
239
+ ];
241
240
  const width = (row) => row.reduce((n, p) => n + p.text.length, 0);
242
241
  const fit = (rows) =>
243
242
  fitSegments(
@@ -245,10 +244,14 @@ export function sessionRow(config, view, columns, now = Date.now()) {
245
244
  columns,
246
245
  ).flatMap((s) => s.parts);
247
246
  // Below EARLY_REPLIES one switch decides the sum, so the parts wait, as on the pane.
248
- if (r.early) return fit([[...answer, part(`${SEPARATOR}${count} · early sample`, { dimColor: true })], answer]);
249
- const replies = part(`${SEPARATOR}${count}`, { dimColor: true });
250
- // Per billing the parts would subtract quota from cash: a split shows its two differences alone.
251
- if (split) return fit([[...answer, replies], answer]);
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 });
252
255
  const parts = costParts(r);
253
256
  const named = parts.flatMap(([amount, words, value], i) => [
254
257
  part(i ? ' ' : ' = ', { dimColor: true }),
@@ -261,7 +264,13 @@ export function sessionRow(config, view, columns, now = Date.now()) {
261
264
  }),
262
265
  ]
263
266
  : [];
264
- return fit([[...answer, ...named, replies], [...answer, ...bare, replies], [...answer, ...bare], answer]);
267
+ return fit([
268
+ [...answer, ...named, replies],
269
+ [...answer, ...bare, replies],
270
+ [...answer, replies],
271
+ [...answer, cost],
272
+ answer,
273
+ ]);
265
274
  }
266
275
 
267
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
@@ -3,7 +3,6 @@ import { readMetrics, readStore, storeSummary, UNPRICED_CAUSES } from './activit
3
3
  import {
4
4
  activeClassifier,
5
5
  CLASSIFIER_OPTIONS,
6
- DEFAULTS,
7
6
  endpointSettings,
8
7
  resolveRoute,
9
8
  routeSpec,
@@ -13,10 +12,9 @@ import {
13
12
  import { ratesAt } from './cost.mjs';
14
13
  import { applyMode, modeLabel, modeRoute } from './modes.mjs';
15
14
  import { PROBE_RESULTS } from './probe-results.mjs';
16
- import { PROVIDER_DEFAULTS } from './providers.mjs';
17
15
  import { cellForModel } from './route.mjs';
18
16
  import { modelSpec, readout } from './savings.mjs';
19
- import { allTime, breakdown, periodRange, readUsage, summarize, withReplies } from './usage.mjs';
17
+ import { allTime, periodRange, readUsage, summarize, withReplies } from './usage.mjs';
20
18
 
21
19
  // Cost order, cheapest first, so the colors read as a scale. Hex values: every surface draws them.
22
20
  export const TIER_COLOR = { micro: '#5fd7af', low: '#5f9fe0', medium: '#d7af5f', high: '#e0708a' };
@@ -72,11 +70,20 @@ export const NOT_A_TIER_REASON = 'not a routing tier';
72
70
 
73
71
  export function modelName(id) {
74
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.
75
79
  return id
76
- .replace(/^claude-/, '')
77
- .replace(/-([0-9])-([0-9])(-\d{8})?$/, ' $1.$2')
78
- .replace(/^./, (c) => c.toUpperCase());
80
+ .replace(/\[[^\]]*\]$/, '')
81
+ .split('-')
82
+ .map((word) => BRANDS[word.toLowerCase()] ?? word.replace(/^./, (c) => c.toUpperCase()))
83
+ .join(' ');
79
84
  }
85
+ // Provider names whose casing a capital first letter gets wrong.
86
+ const BRANDS = { deepseek: 'DeepSeek', glm: 'GLM', minimax: 'MiniMax', mimo: 'MiMo' };
80
87
 
81
88
  // "Opus 5.5 · high"; a model with no effort reading shows its name alone.
82
89
  export const routeLabel = (model, effort) =>
@@ -347,87 +354,12 @@ export const liveUsage = (view, record) => withReplies(readUsage(record), view.u
347
354
  // This session's routed replies, the running turns' included.
348
355
  export const sessionUsage = (view, now) => summarize(liveUsage(view, view.usageSession), periodRange('session', now));
349
356
 
350
- // Observed spend is valid even when a counterfactual cache history cannot be priced. With a billing split, each
351
- // billing's spend: plan and credits are not added.
352
- export const observedUsageText = (observed, split = null) =>
353
- `observed ${split ? billingCosts(split, 'observedUsd') : usd(observed.routedUsd)} · ${observed.replies} repl${observed.replies === 1 ? 'y' : 'ies'} · comparison unavailable`;
354
-
355
- // Plan and credits are different money: on a Claude plan the list-price dollars stand for quota, credits are paid.
356
- export const BILLINGS = ['credits', 'plan'];
357
- // The billing of the model an API id runs on: the selected profile's entry, else a built-in profile's, so a period
358
- // that holds another profile's sessions still reads. Null for a model no profile prices.
359
- const BUILT_IN_PROFILES = [DEFAULTS, ...Object.values(PROVIDER_DEFAULTS)];
360
- export function billingOf(config, id) {
361
- for (const profile of [config, ...BUILT_IN_PROFILES]) {
362
- const spec = modelSpec(profile, id);
363
- if (spec) return spec.billing;
364
- }
365
- return null;
366
- }
367
- const wholeCents = (value) => Math.round(value * 100) / 100;
368
-
369
- // A summary told per billing when its replies ran on, or are compared with, both plan and credits models: one sum
370
- // would add quota to cash. `yours` is your model's billing; per billing, in whole cents: `observedUsd` what every
371
- // reply cost, `routedUsd` what the compared replies cost, and `yoursUsd` your model's cost for them, all of it in your
372
- // model's billing. `yours` and `yoursUsd` are null when your models themselves span both billings: a record keeps
373
- // which model was yours, not each reply's cost on it. Null when one billing covers every model, or some model has no
374
- // known billing: the one-sum readout stands then.
375
- export function billingSplit(config, summary) {
376
- const seen = new Set();
377
- const costs = (cells) => {
378
- const out = { credits: 0, plan: 0 };
379
- for (const { name, sums } of breakdown(cells, 'model')) {
380
- const billing = billingOf(config, name);
381
- if (!billing) return null;
382
- seen.add(billing);
383
- out[billing] += sums[1];
384
- }
385
- return out;
386
- };
387
- const observed = costs(summary.observed.cells);
388
- const routed = costs(summary.cells);
389
- const yours = new Set(Object.keys(summary.yours).map((id) => billingOf(config, id)));
390
- if (!observed || !routed || yours.has(null)) return null;
391
- for (const billing of yours) seen.add(billing);
392
- if (seen.size < 2) return null;
393
- const mine = yours.size === 1 ? [...yours][0] : null;
394
- const side = (billing) => ({
395
- observedUsd: wholeCents(observed[billing]),
396
- routedUsd: wholeCents(routed[billing]),
397
- yoursUsd: mine === null ? null : billing === mine ? wholeCents(summary.yoursUsd) : 0,
398
- });
399
- return { yours: mine, credits: side('credits'), plan: side('plan') };
400
- }
401
- // The split of every reply kept across sessions (allTime). Limit: the undated totals from before the usage records
402
- // name no models, so while they hold replies the one sum stands.
403
- export const keptSplit = (config, kept) => (kept.legacy.replies ? null : billingSplit(config, kept.summary));
404
-
405
- // "credits $4.10 · plan $20.00": each billing's `key` sum.
406
- const billingCosts = (split, key) => BILLINGS.map((billing) => `${billing} ${usd(split[billing][key])}`).join(' · ');
407
- // Routing against your model in one billing, in whole cents: minus is less than your model.
408
- export const billingDifference = (side) => wholeCents(side.routedUsd - side.yoursUsd);
409
- // Every compared reply of the split is priced against models of one billing.
410
- export const splitCompared = (split) => split.yours !== null;
411
-
412
- // The answer as text parts, each with the signed amount that colors it (null: plain): one sum, "routing −$1.84
413
- // (−22%)"; per billing, "routing credits +$4.10 · plan −$61.20"; or, when your models span both billings, what each
414
- // billing cost, "observed credits $4.10 · plan $20.00 · your models mix plan and credits".
415
- export function answerSegments(r, split) {
416
- if (!split) return [{ text: routingAnswer(r), value: r.differenceUsd }];
417
- if (!splitCompared(split))
418
- return [{ text: `observed ${billingCosts(split, 'routedUsd')} · your models mix plan and credits`, value: null }];
419
- return [
420
- { text: 'routing ', value: null },
421
- ...BILLINGS.flatMap((billing, i) => {
422
- const value = billingDifference(split[billing]);
423
- return [...(i ? [{ text: ' · ', value: null }] : []), { text: `${billing} ${signedUsd(value)}`, value }];
424
- }),
425
- ];
426
- }
427
- export const answerText = (r, split) =>
428
- answerSegments(r, split)
429
- .map((segment) => segment.text)
430
- .join('');
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.
361
+ export const observedUsageText = (observed) =>
362
+ `${spentText(observed.routedUsd)} · ${replyCount(observed.replies)} · comparison unavailable`;
431
363
 
432
364
  // The models a session's replies were priced against, when they are not the one `/model` selects now: after a
433
365
  // `/model` change the record keeps each reply against the model selected when it ran. Null when they are.
@@ -462,26 +394,23 @@ export const switchesLost = (r) => r.switchUsd > 0 && r.switchUsd > -r.cheaperUs
462
394
  export function savingsLine(config, view, now) {
463
395
  const summary = sessionUsage(view, now);
464
396
  const session = readout(summary);
465
- const split = billingSplit(config, summary);
466
397
  if (summary.observed.uncomparedReplies)
467
- return `Session: ${observedUsageText(summary.observed, split)}${session.replies ? `; ${replyCount(session.replies)} comparable only: ${answerText(session, split)}` : ''}, est. at list prices`;
398
+ return `Session: ${observedUsageText(summary.observed)}${session.replies ? `; ${replyCount(session.replies)} comparable only: ${routingAnswer(session)}` : ''}`;
468
399
  const label = `vs ${comparedModel(config, view, summary)}`;
469
400
  if (!session.replies) {
470
401
  const kept = allTime(view.usageStore, view.savingsStore);
471
402
  const across = readout(kept.totals);
472
- const keptBy = keptSplit(config, kept);
473
403
  if (kept.observed.uncomparedReplies)
474
- return `Session ${label}: no routed replies yet; across sessions ${observedUsageText(kept.observed, keptBy)}, est. at list prices`;
404
+ return `Session ${label}: no routed replies yet; across sessions ${observedUsageText(kept.observed)}`;
475
405
  const saved = across.early
476
406
  ? ''
477
- : `; ${answerText(across, keptBy)} since ${sinceDate(kept.since)}, each session against its own model`;
407
+ : `; ${routingAnswer(across)} since ${sinceDate(kept.since)}, each session against its own model`;
478
408
  return `Session ${label}: no routed replies yet${saved}`;
479
409
  }
480
- // Per billing the parts would subtract quota from cash, so a split says its two differences alone.
481
- const answer = split && !splitCompared(split) ? answerText(session, split) : `${answerText(session, split)} ${label}`;
482
- if (session.early) return `Session: ${answer}, ${replyCount(session.replies)}, early sample, est. at list prices`;
483
- const parts = split ? [] : costParts(session).map(([amount, words]) => `${amount} ${words}`);
484
- return `Session: ${answer}${parts.length ? ` = ${parts.join(' ')}` : ''}, ${replyCount(session.replies)}, est. at list prices`;
410
+ if (session.early)
411
+ return `Session: ${routingAnswer(session)} ${label}, ${spentText(session.routedUsd)}, ${replyCount(session.replies)}, early sample`;
412
+ const parts = costParts(session).map(([amount, words]) => `${amount} ${words}`);
413
+ return `Session: ${routingAnswer(session)} ${label}${parts.length ? ` = ${parts.join(' ')}` : ''}, ${spentText(session.routedUsd)}, ${replyCount(session.replies)}`;
485
414
  }
486
415
 
487
416
  export const GATEWAY_SETTINGS = 'v0.8 gateway settings remain · see /router';
package/lib/panel.mjs CHANGED
@@ -18,12 +18,6 @@ import { effortSharesCache, routeEffort } from './cost.mjs';
18
18
  import {
19
19
  activityReading,
20
20
  activityVerb,
21
- answerSegments,
22
- answerText,
23
- BILLINGS,
24
- billingDifference,
25
- billingOf,
26
- billingSplit,
27
21
  COST_PART,
28
22
  classifierLabel,
29
23
  classifierStatus,
@@ -31,7 +25,6 @@ import {
31
25
  formatTokens,
32
26
  GATEWAY_CLEANUP,
33
27
  GATEWAY_SETTINGS,
34
- keptSplit,
35
28
  liveUsage,
36
29
  missingCredentials,
37
30
  missingText,
@@ -44,6 +37,7 @@ import {
44
37
  recordedModels,
45
38
  routeLabel,
46
39
  routeName,
40
+ routingAnswer,
47
41
  routingModeOf,
48
42
  routingModeText,
49
43
  savingsColor,
@@ -51,7 +45,6 @@ import {
51
45
  shownConfig,
52
46
  signedUsd,
53
47
  sparkline,
54
- splitCompared,
55
48
  switchesLost,
56
49
  TIER_COLOR,
57
50
  unavailableReason,
@@ -359,10 +352,10 @@ function nowTab(ui, config, view, usage, actions, _modelOptions, columns, now) {
359
352
  // Today repeats this session's part of it until another session adds to it.
360
353
  const ownToday = summarize(liveUsage(view, view.usageSession), periodRange('today', now));
361
354
  if (today.observed.replies > ownToday.observed.replies)
362
- out.push(ui.text(' '), ...todayLines(ui, config, today, actions, columns));
355
+ out.push(ui.text(' '), ...todayLines(ui, today, actions, columns));
363
356
  out.push(
364
357
  ...sessionAgentLines(ui, view, actions, columns),
365
- ...worthLines(ui, config, today, actions, columns),
358
+ ...worthLines(ui, today, actions, columns),
366
359
  ui.text(' '),
367
360
  ui.gauge('Context ', metrics.contextBar, contextSuffix(metrics)),
368
361
  ui.line(
@@ -507,12 +500,11 @@ function sessionLines(ui, config, view, summary, actions, columns, now) {
507
500
  if (!strip && !summary.observed.replies) return [ui.line(ui.head('SESSION'), ui.dim(' · no replies yet'))];
508
501
  const out = [ui.line(ui.head('SESSION'), head.length ? ui.dim(` · ${head.join(' · ')}`) : null)];
509
502
  // The band's session row, then the parts that add up to it.
510
- const split = billingSplit(config, summary);
511
503
  if (summary.observed.uncomparedReplies) {
512
504
  out.push(
513
505
  ui.line(
514
506
  ' ',
515
- ui.text(observedUsageText(summary.observed, split)),
507
+ ui.text(observedUsageText(summary.observed)),
516
508
  ' ',
517
509
  ui.Button({ key: 'usage-session', label: 'Usage', onPress: () => actions.usageFor('session') }),
518
510
  ),
@@ -520,23 +512,11 @@ function sessionLines(ui, config, view, summary, actions, columns, now) {
520
512
  } else if (summary.replies) {
521
513
  const r = readout(summary);
522
514
  out.push(
523
- answerLine(
524
- ui,
525
- r,
526
- split,
527
- comparedModel(config, view, summary),
528
- () => actions.usageFor('session'),
529
- 'session',
530
- columns,
531
- ),
515
+ answerLine(ui, r, comparedModel(config, view, summary), () => actions.usageFor('session'), 'session', columns),
532
516
  );
533
517
  if (!r.early)
534
- out.push(
535
- ...(split
536
- ? billingLedger(ui, split)
537
- : ledger(ui, config, view, { period: 'session', r, summary, legacy: null, columns, compact: true })),
538
- );
539
- if (!r.early && !split && switchesLost(r)) out.push(lostLine(ui, actions));
518
+ out.push(...ledger(ui, config, view, { period: 'session', r, summary, legacy: null, columns, compact: true }));
519
+ if (!r.early && switchesLost(r)) out.push(lostLine(ui, actions));
540
520
  }
541
521
  if (strip) {
542
522
  out.push(
@@ -599,12 +579,12 @@ function lastSwitchLine(ui, last, now) {
599
579
 
600
580
  // Routing against your model in the band's words, "routing −$1.84 (−22%) vs Opus 5.5 · xhigh", with the Usage tab on
601
581
  // the same period one press away; an early sample says so.
602
- function answerLine(ui, r, split, against, open, period, columns) {
582
+ function answerLine(ui, r, against, open, period, columns) {
603
583
  const early = ' · early sample';
604
- const width = 2 + answerText(r, split).length + ` vs ${against}`.length + early.length + USAGE_LINK;
584
+ const width = 2 + routingAnswer(r).length + ` vs ${against}`.length + early.length + USAGE_LINK;
605
585
  return ui.line(
606
586
  ' ',
607
- ...answerParts(ui, r, split, against),
587
+ ...answerParts(ui, r, against),
608
588
  r.early && (!Number.isFinite(columns) || width <= columns) ? ui.dim(early) : null,
609
589
  ' ',
610
590
  ui.Button({ key: `usage-${period}`, label: 'Usage', onPress: open }),
@@ -620,9 +600,8 @@ const lostLine = (ui, actions) =>
620
600
  );
621
601
 
622
602
  // Today across sessions, shown once another session added to it.
623
- function todayLines(ui, config, summary, actions, columns) {
603
+ function todayLines(ui, summary, actions, columns) {
624
604
  const switches = summary.switches.tier + summary.switches.activity;
625
- const split = billingSplit(config, summary);
626
605
  return [
627
606
  ui.line(
628
607
  ui.head('TODAY'),
@@ -632,32 +611,17 @@ function todayLines(ui, config, summary, actions, columns) {
632
611
  ),
633
612
  summary.observed.uncomparedReplies
634
613
  ? ui.line(
635
- ui.text(observedUsageText(summary.observed, split)),
614
+ ui.text(observedUsageText(summary.observed)),
636
615
  ' ',
637
616
  ui.Button({ key: 'usage-today', label: 'Usage', onPress: () => actions.usageFor('today') }),
638
617
  )
639
- : answerLine(
640
- ui,
641
- readout(summary),
642
- split,
643
- 'each session’s own model',
644
- () => actions.usageFor('today'),
645
- 'today',
646
- columns,
647
- ),
618
+ : answerLine(ui, readout(summary), 'each session’s own model', () => actions.usageFor('today'), 'today', columns),
648
619
  ];
649
620
  }
650
621
 
651
- // The findings that hold within one billing: with plan and credits apart, a part against your model would subtract
652
- // quota from cash, so only the share of the cost stays.
653
- const billingInsights = (summary, split) => insights(summary).filter((insight) => !split || insight.kind === 'cost');
654
-
655
622
  // Today's first finding from Usage's WORTH A LOOK, with the tab that changes it; nothing when there is none.
656
- function worthLines(ui, config, summary, actions, columns) {
657
- const [first] =
658
- !summary.observed.uncomparedReplies && summary.replies >= INSIGHT_REPLIES
659
- ? billingInsights(summary, billingSplit(config, summary))
660
- : [];
623
+ function worthLines(ui, summary, actions, columns) {
624
+ const [first] = !summary.observed.uncomparedReplies && summary.replies >= INSIGHT_REPLIES ? insights(summary) : [];
661
625
  if (!first) return [];
662
626
  return [ui.text(' '), ui.line(ui.head('WORTH A LOOK'), ui.dim(' · today')), insightLine(ui, first, actions, columns)];
663
627
  }
@@ -1326,10 +1290,9 @@ function storeUsage(ui, store, metrics) {
1326
1290
  // The footer as [text, joiner] pieces, packed to the pane: two lines at full width, more in a narrow pane, never a
1327
1291
  // line that ends in a joiner.
1328
1292
  const SAVINGS_FOOTER = [
1329
- ['API list prices', ' · '],
1330
- ['same tokens and output length', ' · '],
1293
+ ['every $ at API prices, plan and credits alike', ' · '],
1331
1294
  ['not a bill;', ' '],
1332
- ['on a Claude plan it stands for quota', ' · '],
1295
+ ['on a Claude plan it shows quota use', ' · '],
1333
1296
  ['answer quality not measured', ''],
1334
1297
  ];
1335
1298
  const FULL_WIDTH = 68;
@@ -1761,10 +1724,10 @@ function scopeLine(ui, config, view, period, summary, now) {
1761
1724
  }
1762
1725
 
1763
1726
  // The answer first, in the band's words: "routing −$1.84 (−22%) vs Opus 5.5 · xhigh", or why there is nothing to compare.
1764
- function headline(ui, config, view, period, r, summary, observed, split) {
1727
+ function headline(ui, config, view, period, r, summary, observed = summary.observed) {
1765
1728
  if (observed.uncomparedReplies)
1766
1729
  return [
1767
- ui.text(observedUsageText(observed, split), { bold: true }),
1730
+ ui.text(observedUsageText(observed), { bold: true }),
1768
1731
  ui.dim(
1769
1732
  `${observed.uncomparedReplies} of ${observed.replies} replies have no comparison; savings are not estimated for them.`,
1770
1733
  ),
@@ -1775,7 +1738,6 @@ function headline(ui, config, view, period, r, summary, observed, split) {
1775
1738
  ...answerParts(
1776
1739
  ui,
1777
1740
  r,
1778
- split,
1779
1741
  period === 'session' ? comparedModel(config, view, summary) : 'each session’s own model',
1780
1742
  ),
1781
1743
  ),
@@ -1798,7 +1760,7 @@ function headline(ui, config, view, period, r, summary, observed, split) {
1798
1760
  const against = period === 'session' ? comparedModel(config, view, summary) : 'each session’s own model';
1799
1761
  return [
1800
1762
  ui.line(
1801
- ...answerParts(ui, r, split, against),
1763
+ ...answerParts(ui, r, against),
1802
1764
  r.early ? ui.text(` early sample · ${plural(r.replies, 'reply', 'replies')}`, { color: 'yellow' }) : null,
1803
1765
  ),
1804
1766
  ];
@@ -1806,39 +1768,10 @@ function headline(ui, config, view, period, r, summary, observed, split) {
1806
1768
 
1807
1769
  const capital = (words) => words[0].toUpperCase() + words.slice(1);
1808
1770
 
1809
- // "routing −$1.84 (−22%) vs Opus 5.5 · xhigh", the answer bold in the savings color, as the band says it; per billing
1810
- // each difference in its own color. A split without one billing for your models compares with nothing.
1811
- function answerParts(ui, r, split, against) {
1812
- return [
1813
- ...answerSegments(r, split).map(({ text, value }) =>
1814
- ui.text(text, { bold: true, ...(savingsColor(value) ? { color: savingsColor(value) } : {}) }),
1815
- ),
1816
- split && !splitCompared(split) ? null : ` vs ${against}`,
1817
- ].filter(Boolean);
1818
- }
1819
-
1820
- // Per billing, what the replies cost, what your model would have, and the difference: plan dollars stand for quota
1821
- // and credits are paid, so neither is added to the other. `note` says so under the table.
1822
- function billingLedger(ui, split, note = false) {
1823
- const amount = (value) => (value === null ? '—' : usd(value)).padStart(BILLING_AMOUNT);
1824
- return [
1825
- ui.dim(
1826
- ` ${''.padEnd(LEDGER_LABEL)}${'routed'.padStart(LEDGER_AMOUNT)}${'your model'.padStart(BILLING_AMOUNT)}${'difference'.padStart(BILLING_AMOUNT)}`,
1827
- ),
1828
- ...BILLINGS.map((billing) => {
1829
- const side = split[billing];
1830
- return ui.line(
1831
- ' ',
1832
- ui.cell(LEDGER_LABEL, ui.text(capital(billing))),
1833
- usd(side.routedUsd).padStart(LEDGER_AMOUNT),
1834
- amount(side.yoursUsd),
1835
- side.yoursUsd === null ? amount(null) : differenceText(ui, billingDifference(side), BILLING_AMOUNT),
1836
- );
1837
- }),
1838
- ...(note ? [ui.dim(' at list prices; plan dollars stand for quota, credits are paid')] : []),
1839
- ];
1771
+ // "routing −$1.84 (−22%) vs Opus 5.5 · xhigh", the answer bold in the savings color, as the band says it.
1772
+ function answerParts(ui, r, against) {
1773
+ return [ui.text(routingAnswer(r), { bold: true, color: savingsColor(r.differenceUsd) }), ` vs ${against}`];
1840
1774
  }
1841
- const BILLING_AMOUNT = 13;
1842
1775
 
1843
1776
  // Your model − cheaper models + stronger models + switch cache writes = routed, in whole cents that add up (readout).
1844
1777
  function ledger(ui, config, view, { period, r, summary, legacy, columns, compact = false }) {
@@ -1926,10 +1859,8 @@ const statsLine = (ui, s) =>
1926
1859
  );
1927
1860
 
1928
1861
  // The period's cost by activity, model or tier, most first; `g` presses the next grouping. A row opens to what it
1929
- // holds and its cost parts. A narrow pane drops "mostly on" (or the share) before any number. With a billing split, a
1930
- // row whose models are not all billed as your model is names its billing in place of `vs yours` and its parts: that
1931
- // difference would subtract quota from cash.
1932
- function breakdownLines(ui, config, view, actions, summary, columns, split) {
1862
+ // holds and its cost parts. A narrow pane drops "mostly on" (or the share) before any number.
1863
+ function breakdownLines(ui, view, actions, summary, columns) {
1933
1864
  const by = GROUPS.some(([id]) => id === view.usageGroup) ? view.usageGroup : 'activity';
1934
1865
  const next = GROUPS[(GROUPS.findIndex(([id]) => id === by) + 1) % GROUPS.length][0];
1935
1866
  const out = [
@@ -1959,24 +1890,14 @@ function breakdownLines(ui, config, view, actions, summary, columns, split) {
1959
1890
  ` ${''.padEnd(NAME)}${'replies'.padStart(8)}${'cost'.padStart(10)}${'vs yours'.padStart(11)}${tail ? ` ${tailHead}` : ''}`,
1960
1891
  ),
1961
1892
  );
1962
- const otherBilling = (rowCells) => {
1963
- if (!split) return null;
1964
- const billings = new Set(breakdown(rowCells, 'model').map(({ name }) => billingOf(config, name)));
1965
- if (billings.size === 1 && billings.has(split.yours)) return null;
1966
- return billings.size === 1 ? [...billings][0] : 'both';
1967
- };
1968
- const numbers = (sums, unavailable, rowCells) => {
1969
- const other = unavailable ? null : otherBilling(rowCells);
1970
- return [
1971
- `${String(sums[0]).padStart(8)}${usd(sums[1]).padStart(10)}`,
1972
- unavailable || other ? ui.dim((other ?? '—').padStart(11)) : differenceText(ui, sums[1] - sums[2], 11),
1973
- ];
1974
- };
1893
+ const numbers = (sums, unavailable) => [
1894
+ `${String(sums[0]).padStart(8)}${usd(sums[1]).padStart(10)}`,
1895
+ unavailable ? ui.dim('—'.padStart(11)) : differenceText(ui, sums[1] - sums[2], 11),
1896
+ ];
1975
1897
  for (const group of groups) {
1976
1898
  const id = `${by}:${group.name}`;
1977
1899
  const open = view.usageOpen === id;
1978
- const groupCells = cellsWhere(cells, by, group.name);
1979
- const route = by === 'model' ? null : mostlyOn(groupCells);
1900
+ const route = by === 'model' ? null : mostlyOn(cellsWhere(cells, by, group.name));
1980
1901
  out.push(
1981
1902
  ui.line(
1982
1903
  ' ',
@@ -1988,7 +1909,7 @@ function breakdownLines(ui, config, view, actions, summary, columns, split) {
1988
1909
  }),
1989
1910
  ' ',
1990
1911
  ui.cell(NAME, groupName(ui, by, group.name)),
1991
- ...numbers(group.sums, missing.has(group.name), groupCells),
1912
+ ...numbers(group.sums, missing.has(group.name)),
1992
1913
  !tail
1993
1914
  ? null
1994
1915
  : by === 'model'
@@ -2007,20 +1928,16 @@ function breakdownLines(ui, config, view, actions, summary, columns, split) {
2007
1928
  ...numbers(
2008
1929
  child.sums,
2009
1930
  missing.get(group.name)?.children.some((c) => c.name === child.name),
2010
- cellsWhere(groupCells, CHILD_BY[by], child.name),
2011
1931
  ),
2012
1932
  ),
2013
1933
  );
2014
1934
  const [, , , cheaper, stronger, switched, input, , output] = group.sums;
2015
- const tokens = `input ${formatTokens(input)} · output ${formatTokens(output)}`;
2016
1935
  out.push(
2017
1936
  ...dimLines(
2018
1937
  ui,
2019
1938
  missing.has(group.name)
2020
- ? ` comparison unavailable · ${tokens}`
2021
- : otherBilling(groupCells)
2022
- ? ` ${tokens}`
2023
- : ` cheaper ${signedUsd(cents(cheaper))} · stronger ${signedUsd(cents(stronger))} · switch ${signedUsd(cents(switched))} · ${tokens}`,
1939
+ ? ` comparison unavailable · input ${formatTokens(input)} · output ${formatTokens(output)}`
1940
+ : ` cheaper ${signedUsd(cents(cheaper))} · stronger ${signedUsd(cents(stronger))} · switch ${signedUsd(cents(switched))} · input ${formatTokens(input)} · output ${formatTokens(output)}`,
2024
1941
  columns,
2025
1942
  ),
2026
1943
  );
@@ -2029,9 +1946,8 @@ function breakdownLines(ui, config, view, actions, summary, columns, split) {
2029
1946
  }
2030
1947
 
2031
1948
  // What the period's tokens would cost on each model alone, as your model for every reply (compareModels), beside what
2032
- // routing spent and your own models; a model some reply had no price on is left out. With a billing split, a model
2033
- // billed otherwise than your model names its billing in place of the difference.
2034
- function compareLines(ui, config, summary, split) {
1949
+ // routing spent and your own models; a model some reply had no price on is left out.
1950
+ function compareLines(ui, summary) {
2035
1951
  if (summary.observed.uncomparedReplies)
2036
1952
  return [ui.dim('What if unavailable: some replies have no comparable cache history.')];
2037
1953
  const yours = Object.keys(summary.yours);
@@ -2043,7 +1959,6 @@ function compareLines(ui, config, summary, split) {
2043
1959
  value,
2044
1960
  routed: false,
2045
1961
  yours: model === single,
2046
- other: split && billingOf(config, model) !== split.yours ? billingOf(config, model) : null,
2047
1962
  }));
2048
1963
  if (!rows.some((row) => row.yours))
2049
1964
  rows.push({
@@ -2051,9 +1966,8 @@ function compareLines(ui, config, summary, split) {
2051
1966
  value: summary.yoursUsd,
2052
1967
  routed: false,
2053
1968
  yours: true,
2054
- other: null,
2055
1969
  });
2056
- rows.push({ label: 'Routed', value: summary.routedUsd, routed: true, yours: false, other: null });
1970
+ rows.push({ label: 'Routed', value: summary.routedUsd, routed: true, yours: false });
2057
1971
  rows.sort((a, b) => a.value - b.value);
2058
1972
  const max = Math.max(...rows.map((row) => row.value));
2059
1973
  return [
@@ -2065,15 +1979,10 @@ function compareLines(ui, config, summary, split) {
2065
1979
  ui.text('█'.repeat(filled), { color: row.routed ? 'cyan' : 'gray' }),
2066
1980
  ' '.repeat(BAR - filled),
2067
1981
  usd(row.value).padStart(LEDGER_AMOUNT),
2068
- row.routed
2069
- ? ''
2070
- : row.yours || row.other
2071
- ? ui.dim((row.other ?? '—').padStart(11))
2072
- : differenceText(ui, row.value - summary.yoursUsd, 11),
1982
+ row.routed ? '' : row.yours ? ui.dim('—'.padStart(11)) : differenceText(ui, row.value - summary.yoursUsd, 11),
2073
1983
  );
2074
1984
  }),
2075
1985
  ui.dim(' same tokens and output on each model alone · answer quality not measured'),
2076
- ...(split ? [ui.dim(' Routed adds plan and credits at list prices; plan dollars stand for quota')] : []),
2077
1986
  ];
2078
1987
  }
2079
1988
 
@@ -2101,9 +2010,9 @@ function trendLines(ui, view, actions, summary, period, now) {
2101
2010
 
2102
2011
  // The evidence worth a look, each with the tab that changes it: the cell that carried most of the cost, the switch
2103
2012
  // writes against the saving, the cell that ran above your model. Never which model to use.
2104
- function insightLines(ui, summary, actions, columns, split) {
2013
+ function insightLines(ui, summary, actions, columns) {
2105
2014
  if (summary.observed.uncomparedReplies || summary.replies < INSIGHT_REPLIES) return [];
2106
- const list = billingInsights(summary, split);
2015
+ const list = insights(summary);
2107
2016
  if (!list.length) return [];
2108
2017
  return [
2109
2018
  ui.text(' '),
@@ -2175,21 +2084,14 @@ function usageTab(ui, config, view, _usage, actions, _modelOptions, columns, now
2175
2084
  const kept = period === 'all' ? allTime(record, view.savingsStore) : null;
2176
2085
  const legacy = kept?.legacy ?? null;
2177
2086
  const r = readout(kept?.totals ?? summary);
2178
- const split = billingSplit(config, summary);
2179
- const answerSplit = kept ? keptSplit(config, kept) : split;
2180
2087
  const out = [periodRow(ui, period, actions), scopeLine(ui, config, view, period, summary, now), ui.text(' ')];
2181
- out.push(...headline(ui, config, view, period, r, summary, kept?.observed ?? summary.observed, answerSplit));
2088
+ out.push(...headline(ui, config, view, period, r, summary, kept?.observed ?? summary.observed));
2182
2089
  if (r.replies) {
2183
- out.push(
2184
- ui.text(' '),
2185
- ...(answerSplit
2186
- ? billingLedger(ui, answerSplit, true)
2187
- : ledger(ui, config, view, { period, r, summary, legacy, columns })),
2188
- );
2090
+ out.push(ui.text(' '), ...ledger(ui, config, view, { period, r, summary, legacy, columns }));
2189
2091
  }
2190
2092
  if (summary.observed.replies) out.push(ui.text(' '), statsLine(ui, { ...summary.observed, turns: summary.turns }));
2191
2093
  if (summary.observed.replies) {
2192
- out.push(ui.text(' '), ...breakdownLines(ui, config, view, actions, summary, columns, split), ui.text(' '));
2094
+ out.push(ui.text(' '), ...breakdownLines(ui, view, actions, summary, columns), ui.text(' '));
2193
2095
  out.push(
2194
2096
  ...(view.usageCompare
2195
2097
  ? [
@@ -2198,10 +2100,10 @@ function usageTab(ui, config, view, _usage, actions, _modelOptions, columns, now
2198
2100
  ui.dim(' · the same tokens on one model '),
2199
2101
  ui.Button({ key: 'usage-compare', label: 'Trend', hotkey: 'c', onPress: actions.usageCompare }),
2200
2102
  ),
2201
- ...compareLines(ui, config, summary, split),
2103
+ ...compareLines(ui, summary),
2202
2104
  ]
2203
2105
  : trendLines(ui, view, actions, summary, period, now)),
2204
- ...insightLines(ui, summary, actions, columns, split),
2106
+ ...insightLines(ui, summary, actions, columns),
2205
2107
  );
2206
2108
  }
2207
2109
  out.push(
@@ -2218,8 +2120,8 @@ function helpLines(ui) {
2218
2120
  return [
2219
2121
  ui.text(' '),
2220
2122
  ui.head('ABOUT THESE NUMBERS'),
2221
- ui.dim('Cost, context and cache are Claude readings. $ estimates use the'),
2222
- ui.dim('list prices in router.json; plan prices are equivalents, not cash.'),
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.'),
2223
2125
  ui.dim('Routing vs your model holds tokens and output length the same'),
2224
2126
  ui.dim('and does not measure answer quality. Cache benefit is before writes.'),
2225
2127
  ui.dim('The context bar uses the routed model’s window, 20% in reserve.'),
package/lib/usage.mjs CHANGED
@@ -355,7 +355,7 @@ export function summarize(record, { from, to }) {
355
355
  const READOUT_SUMS = ['replies', 'routedUsd', 'yoursUsd', 'cheaperUsd', 'strongerUsd', 'switchUsd'];
356
356
 
357
357
  // Every routed reply kept: the usage records' days and the undated savings totals from before them, as `readout`
358
- // takes them, and since when (ms; null without any); `summary` is the dated days alone.
358
+ // takes them, and since when (ms; null without any).
359
359
  export function allTime(usageStore, savingsStore) {
360
360
  const record = readUsage(usageStore);
361
361
  const summary = summarize(record, { from: null, to: null });
@@ -369,7 +369,6 @@ export function allTime(usageStore, savingsStore) {
369
369
  routedUsd: summary.observed.routedUsd + legacy.routedUsd,
370
370
  },
371
371
  legacy,
372
- summary,
373
372
  };
374
373
  }
375
374
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alexeiled/claude-router",
3
- "version": "1.20.0",
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",