@alexeiled/claude-router 1.7.3 → 1.8.0

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.7.3",
4
+ "version": "1.8.0",
5
5
  "description": "Model and effort routing for the main conversation by task difficulty and activity, advised by a prompt classifier (Jev, Clef, Clef Flash, OpenAI or local Ollama). Preserves subagent model choices.",
6
6
  "author": {
7
7
  "name": "Alexei Ledenev",
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.8.0 (2026-10-10)
4
+
5
+ ### Changed
6
+
7
+ - The band's second row now shows one thing: this session against your model, by name. For example, `session saved $1.84 (22%) vs Opus 5.5 · xhigh · 64 replies · cold-cache writes +$0.47`, or `extra $2.48 (×5.0) vs Haiku 5.5 · high` when routing cost more. The strip of recent replies, the switch count and the last reply's cache saving are gone from the band. The reply count drops first on a short row, then the cost part.
8
+ - Your model is the one `/model` selects now. Each routed reply is priced against every model in `router.json`, so after a `/model` change the band and the Usage tab show the whole session against the new model. The Usage tab adds `vs other models: Sonnet 5.5 extra $2.28 · Haiku 5.5 extra $6.19`. The totals kept across sessions still price each reply against the model selected when it ran.
9
+ - The first band row shows the switch cost, `switch cost ≈ $0.37`, next to the decision it explains. A classifier figure shows tenths when whole percents would read as equal: `Jev 81.0% < 81.4%`, not `81% < 81%`. `cache` now reads `cache hit`.
10
+ - The words are plainer. `tax` is now **switch cost**, `cache saved` and **Cache read benefit** are now **cache hits saved**, and `vs your model −5% (−$0.89, list prices)` is now `saved $0.89 (5%) vs <model>`.
11
+
12
+ ## 1.7.4 (2026-10-10)
13
+
14
+ ### Fixed
15
+
16
+ - Routing turned off while a turn's record is being saved ends the escalation watch, as it already did for the rest of the turn. Before, a switch of routing off and back on during that last step could start the watch again for the turn's cheaper move. Routing itself is unchanged.
17
+
3
18
  ## 1.7.3 (2026-10-10)
4
19
 
5
20
  ### Fixed
@@ -213,7 +213,7 @@ label was right, not the classifier's probabilities.
213
213
  ## What the estimates mean
214
214
 
215
215
  **In the pane.** The band, the Now tab and the Usage tab report Claude's own readings: cost, context, and cache. The
216
- dollar figures next to them, such as the switch tax, the payback, and the shadow line on the Usage tab, are estimates
216
+ dollar figures next to them, such as the switch cost, the payback, and the shadow line on the Usage tab, are estimates
217
217
  at the list prices in `router.json`. They are not your bill: a plan does not charge list prices. They are not measured
218
218
  savings: the router does not know what another model would have answered, or how many requests it would have needed.
219
219
 
@@ -115,7 +115,7 @@ Nothing is recorded with `activityRouting: off`. Stats run inside a guard: a fai
115
115
 
116
116
  ### Routing vs your model
117
117
 
118
- After each main reply, where the response is observed, `savings.mjs` prices the reply on the model that served it and the same tokens on "your model": the session's model and the effort Claude Code sent on the turn's first request. Your model keeps a simulated single cache in the loop as `yours` (`{ total, at, onYours, model, effort }`), which a history reset clears; after `/model` or an effort change the next reply finds it cold, since it was kept for another model or effort. The session's totals are `savings` in the view; at turn completion the turn's totals are added to the session's own `$.store` key `savings:v1:<session id>` (replies, five sums and `since`), under the same reset guard as the activity stats. Each key has one writer, and Claude Code 2.1.296 writes one key under a file lock (observed in its code; the `$.store` types do not promise it), so sessions that finish turns at the same moment do not overwrite each other. The view's `savingsStore` adds up two parts: every other session's key, read at session start and when the pane opens, and this session's record, which the router reads once, holds in memory, adds each finished turn to and then writes, so a pane opened during that write counts the turn once. **Reset stats** first writes the time in `savings:reset:v1`, then deletes every such key and every activity metrics record. A record whose first reply is older than that time reads as empty, and each session reads the time before it adds a turn, so a session that still holds its record from before a Reset in another session drops it instead of writing it back. The comparison is by milliseconds: a record whose first reply has the reset's millisecond, or one written while the clock had moved back, still counts. A stored value of any other shape reads as empty. A reply with routing off or after an engine fallback is not counted, but it still moves your model's cache. A reply whose cache lifetime cannot be read loses its prices only, and your model's cache still follows it; a usage without rate limits prices writes at five minutes. No failure here fails the turn. [Evaluation](evaluation.md#routing-vs-your-model) gives the method and its limits.
118
+ After each main reply, where the response is observed, `savings.mjs` prices the reply on the model that served it and the same tokens on "your model": the session's model and the effort Claude Code sent on the turn's first request. `compareModels` prices each reply against every model in `router.json` as "your model", at the session effort. Each keeps a simulated single cache in the loop under its models key in `yoursBy` (`{ total, at, onYours, model, effort }`), which a history reset clears; after an effort change the next reply finds it cold. The session's totals per model are `savingsBy` in the view, and `updateView` sets `savings` to the entry for the model `/model` selects whenever the model or the totals change, so a `/model` change re-prices the whole session without a replay. At turn completion the turn's totals against the model selected then are added to the session's own `$.store` key `savings:v1:<session id>` (replies, five sums and `since`), under the same reset guard as the activity stats. Each key has one writer, and Claude Code 2.1.296 writes one key under a file lock (observed in its code; the `$.store` types do not promise it), so sessions that finish turns at the same moment do not overwrite each other. The view's `savingsStore` adds up two parts: every other session's key, read at session start and when the pane opens, and this session's record, which the router reads once, holds in memory, adds each finished turn to and then writes, so a pane opened during that write counts the turn once. **Reset stats** first writes the time in `savings:reset:v1`, then deletes every such key and every activity metrics record. A record whose first reply is older than that time reads as empty, and each session reads the time before it adds a turn, so a session that still holds its record from before a Reset in another session drops it instead of writing it back. The comparison is by milliseconds: a record whose first reply has the reset's millisecond, or one written while the clock had moved back, still counts. A stored value of any other shape reads as empty. A reply with routing off or after an engine fallback is not counted, but it still moves your model's cache. A reply whose cache lifetime cannot be read loses its prices only, and your model's cache still follows it; a usage without rate limits prices writes at five minutes. No failure here fails the turn. [Evaluation](evaluation.md#routing-vs-your-model) gives the method and its limits.
119
119
 
120
120
  Subagent events pass directly to Claude Code. They do not create classifier requests or change main-conversation metrics. This is the selected scope because Mods do not expose whether a subagent model was explicit or inherited.
121
121
 
@@ -110,18 +110,18 @@ Ollama's latency covers both requests and stays inside its 5000 ms deadline; on
110
110
 
111
111
  ## Routing vs your model
112
112
 
113
- The Usage tab compares what routed replies cost with what the same tokens would cost on your model, the session's model and effort before routing. It answers "at list prices, did routing spend more or less than my own model for this work". It does not answer whether the answers were as good.
113
+ The Usage tab compares what routed replies cost with what the same tokens would cost on your model, the model `/model` selects now at the session effort. It answers "at list prices, did routing spend more or less than my own model for this work". It does not answer whether the answers were as good.
114
114
 
115
115
  Method, per main reply that routing chose:
116
116
 
117
117
  - **Routed** prices the usage Claude reported (uncached input, cache read, cache write, output) on the model that served it.
118
- - **Yours** prices the same tokens on your model. While this reply and the one before it ran on your route, it is the reply's own usage, so a session on your model differs by exactly $0.00. Otherwise your model keeps one cache that never switched: it reads the previous prompt, up to this one less its uncached input, inside the cache lifetime, unless a compaction shrank the history or your model or effort changed since, and never less than the API actually read; it writes the rest. Output tokens are the same.
118
+ - **Yours** prices the same tokens on each model in `router.json` at the session effort, and the readout shows the one `/model` selects now, so a `/model` change shows the whole session against the new model. While this reply and the one before it ran on that model's route, it is the reply's own usage, so a session on your model differs by exactly $0.00. Otherwise each model keeps one cache that never switched: it reads the previous prompt, up to this one less its uncached input, inside the cache lifetime, unless a compaction shrank the history or the effort changed since, and never less than the API actually read; it writes the rest. Output tokens are the same. The totals kept across sessions price each reply against the model selected when it ran.
119
119
  - **Parts**: the served model on your cache against yours is the model price, under cheaper models when negative and stronger than yours when positive; routed against the served model on your cache is the cache the switches cost, never negative. They sum to the difference. The pane rounds to cents and gives the remainder only to a part that is not zero: a surplus to the switch part, else the stronger part, else the cheaper part toward $0.00; a shortfall comes off the stronger part, down to $0.00, then the cheaper part. The shown parts add up, none changes sign, and none appears from rounding alone.
120
120
  - **Prices**: `router.json` list prices through `ratesAt`, so Haiku 5.5 above 100,000 prompt tokens is priced at 5x. Claude Code reports no 5m/1h split to a Mod, so cache writes use the lifetime Claude Code 2.1.296 gives the main conversation by its own rule: one hour on a Claude plan unless an environment variable or the `promptCacheTtl` setting says otherwise, five minutes with an API key.
121
121
 
122
122
  Checks:
123
123
 
124
- - Unit tests (`test/savings.test.mjs`) cover a session that saves, one that costs more with Haiku as your model, equal routes at exactly 0, cache expiry at 5m and 1h, a compaction, a change of your model or effort, the 100K surcharge, an unpriced model, and a corrupted store. `test/hook-routing.test.mjs` covers two sessions finishing turns at the same moment.
124
+ - Unit tests (`test/savings.test.mjs`) cover a session that saves, one that costs more with Haiku as your model, equal routes at exactly 0, cache expiry at 5m and 1h, a compaction, a change of your model or effort, the 100K surcharge, an unpriced model, and a corrupted store. `test/hook-routing.test.mjs` covers two sessions finishing turns at the same moment, and a `/model` change mid-session that shows the whole session against the new model.
125
125
  - A one-off replay, not checked in, of this machine's main-conversation transcripts from 2026-10-01 to 2026-10-10 (nine sessions with 10 or more replies) gave $0.00 for every session that ran only on the model it was compared with: three on Opus 5.5, one on Haiku 5.5. Every main-conversation cache write in them was a one-hour write, which is what the lifetime rule gives on this Max plan.
126
126
  - A live Claude Code 2.1.296 session on 2026-10-10, Opus 5.5 at `high` with turns pinned to Haiku 5.5, showed **Routed replies $0.48** beside **Cost $0.480 reported by Claude** for the same 16 replies; its last Haiku reply had a 114K-token prompt, which agrees only at the 5x rate. A Haiku 5.5 session with a pinned Opus turn showed $0.45 routed against $0.446 reported.
127
127
 
@@ -38,7 +38,7 @@ The status band is one line above the prompt: a tier meter, the activity, the ro
38
38
  | Activity | The classifier's activity choice with its share and the two next-best answers. Empty with routing off, a pin, or no answer. |
39
39
  | Route (activity) | With `on`: the route for the tier and activity, marked `(override)` with the base route beside it, or `(base)`. With `shadow`: what `on` would use, and the route in use (`shadow; same route` when they agree). |
40
40
  | Replies | The tier that served each of the last 30 main-conversation replies; a dot where the router did not choose. A second row of letters names each reply's activity: `c` code, `d` debug, `e` explore, `p` plan, `r` review, `o` ops, `w` docs. |
41
- | Routing vs your model (Usage) | Routed replies at configured list prices against the same tokens on your model (the session's model and effort), this session and since the last reset (each session against its own model); the difference split into cheaper models, stronger than yours, and cache writes from switches. `too early` below 10 replies. Output length is held the same; answer quality is not measured. |
41
+ | Routing vs your model (Usage) | Routed replies at configured list prices against the same tokens on your model (the model `/model` selects now, at the session effort; after a `/model` change, the whole session against the new one), this session and since the last reset (each reply against the model selected when it ran); the session against the other configured models; the difference split into cheaper models, stronger than yours, and cache writes from switches. `too early` below 10 replies. Output length is held the same; answer quality is not measured. |
42
42
  | Activity stats (Usage) | Counts for this session: turns, requests and share per activity, its `est. cost` at configured list prices (`—` unless every reply had a price) and the route it was `mostly on`; switches by tier and by activity, and activity moves refused in `on`; tool agreement; in `shadow`, turns `on` would route differently with their summed next-request estimate at configured list prices. |
43
43
  | Across sessions (Usage) | The counts kept since the last reset: labelled turns, tool agreement on the classifier's raw answer, overall and for `code`, `ops` and `explore`, the two largest mismatches, activity moves inside a tier taken and refused, escalations after a cheaper activity move, the active classifier's p95 latency, and the shadow readout. `/router` text shows the agreement. |
44
44
  | Cost | Claude Code's native usage value. A plan's list-price estimates are not subscription cash charges. |
@@ -50,7 +50,7 @@ The status band is one line above the prompt: a tier meter, the activity, the ro
50
50
  | Classifier header | Active classifier state and elapsed time. Missing-key, missing-account, busy, and paused skips have no network latency reading. |
51
51
  | Next-turn difference | Configured-price range for the suggested tier versus the incumbent on the next request. Negative means estimated lower cost. |
52
52
  | Conservative payback | Conditional later-turn estimate based on configured cache prices, future reads, and the last output size. It is not measured savings. |
53
- | Cache read benefit | Estimated price difference for observed cache reads before cache writes. It is not net savings. |
53
+ | Cache hits saved | Estimated price difference for observed cache reads before cache writes. It is not net savings. |
54
54
 
55
55
  The router keeps no bill. Routing vs your model is a configured-price estimate, not a measured saving, and leaves out classifier charges. See [Evaluation](evaluation.md) for what the available trace can support.
56
56
 
@@ -23,10 +23,10 @@
23
23
  <text x="507.6" y="56" fill="#7c7c7c" xml:space="preserve"> · </text>
24
24
  <text x="546.6" y="56" fill="#d0d0d0" xml:space="preserve">ctx </text>
25
25
  <text x="577.8" y="56" fill="#87d787" xml:space="preserve">40%</text>
26
- <text x="601.2" y="56" fill="#d0d0d0" xml:space="preserve"> · cache </text>
27
- <text x="671.4" y="56" fill="#87d787" xml:space="preserve">100%</text>
28
- <text x="718.2" y="56" fill="#d0d0d0" xml:space="preserve">Router</text>
29
- <text class="cap" x="20" y="95">Two rows, with the hover row shown: recent replies by tier, the session against your model, pins, Turn off</text>
26
+ <text x="601.2" y="56" fill="#d0d0d0" xml:space="preserve"> · cache hit </text>
27
+ <text x="702.6" y="56" fill="#87d787" xml:space="preserve">100%</text>
28
+ <text x="749.4" y="56" fill="#d0d0d0" xml:space="preserve">Router</text>
29
+ <text class="cap" x="20" y="95">Two rows, with the hover row shown: the session against your model, pins, Turn off</text>
30
30
  <rect x="12" y="103" width="897.6" height="67" rx="5" fill="#232323"/>
31
31
  <text x="24.0" y="121" fill="#e0708a" xml:space="preserve">▂</text>
32
32
  <text x="31.8" y="121" fill="#e0708a" xml:space="preserve">▄</text>
@@ -41,35 +41,16 @@
41
41
  <text x="367.2" y="121" fill="#7c7c7c" xml:space="preserve"> · </text>
42
42
  <text x="406.2" y="121" fill="#d0d0d0" xml:space="preserve">ctx </text>
43
43
  <text x="437.4" y="121" fill="#87d787" xml:space="preserve">40%</text>
44
- <text x="460.8" y="121" fill="#d0d0d0" xml:space="preserve"> · cache </text>
45
- <text x="531.0" y="121" fill="#87d787" xml:space="preserve">100%</text>
46
- <text x="577.8" y="121" fill="#d0d0d0" xml:space="preserve">Router</text>
47
- <text x="24.0" y="140" fill="#7c7c7c" xml:space="preserve">replies </text>
48
- <text x="86.4" y="140" fill="#5f9fe0" xml:space="preserve">█</text>
49
- <text x="94.2" y="140" fill="#5f9fe0" xml:space="preserve">█</text>
50
- <text x="102.0" y="140" fill="#5f9fe0" xml:space="preserve">█</text>
51
- <text x="109.8" y="140" fill="#5f9fe0" xml:space="preserve">█</text>
52
- <text x="117.6" y="140" fill="#5f9fe0" xml:space="preserve">█</text>
53
- <text x="125.4" y="140" fill="#5f9fe0" xml:space="preserve">█</text>
54
- <text x="133.2" y="140" fill="#d7af5f" xml:space="preserve">█</text>
55
- <text x="141.0" y="140" fill="#d7af5f" xml:space="preserve">█</text>
56
- <text x="148.8" y="140" fill="#5f9fe0" xml:space="preserve">█</text>
57
- <text x="156.6" y="140" fill="#5f9fe0" xml:space="preserve">█</text>
58
- <text x="164.4" y="140" fill="#5f9fe0" xml:space="preserve">█</text>
59
- <text x="172.2" y="140" fill="#5f9fe0" xml:space="preserve">█</text>
60
- <text x="180.0" y="140" fill="#e0708a" xml:space="preserve">█</text>
61
- <text x="187.8" y="140" fill="#e0708a" xml:space="preserve">█</text>
62
- <text x="195.6" y="140" fill="#e0708a" xml:space="preserve">█</text>
63
- <text x="203.4" y="140" fill="#e0708a" xml:space="preserve">█</text>
64
- <text x="211.2" y="140" fill="#e0708a" xml:space="preserve">█</text>
65
- <text x="219.0" y="140" fill="#e0708a" xml:space="preserve">█</text>
66
- <text x="226.8" y="140" fill="#e0708a" xml:space="preserve">█</text>
67
- <text x="234.6" y="140" fill="#e0708a" xml:space="preserve">█</text>
68
- <text x="242.4" y="140" fill="#7c7c7c" xml:space="preserve"> 0 switches · cache saved ≈ $1.52</text>
69
- <text x="507.6" y="140" fill="#7c7c7c" xml:space="preserve"> · </text>
70
- <text x="546.6" y="140" fill="#d0d0d0" xml:space="preserve">vs your model </text>
71
- <text x="655.8" y="140" fill="#6fcf97" xml:space="preserve">−22%</text>
72
- <text x="687.0" y="140" fill="#7c7c7c" xml:space="preserve"> (−$1.84, list prices)</text>
44
+ <text x="460.8" y="121" fill="#d0d0d0" xml:space="preserve"> · cache hit </text>
45
+ <text x="562.2" y="121" fill="#87d787" xml:space="preserve">100%</text>
46
+ <text x="609.0" y="121" fill="#d0d0d0" xml:space="preserve">Router</text>
47
+ <text x="24.0" y="140" fill="#7c7c7c" xml:space="preserve">session </text>
48
+ <text x="94.2" y="140" fill="#6fcf97" font-weight="700" xml:space="preserve">saved $1.84 (22%)</text>
49
+ <text x="226.8" y="140" fill="#d0d0d0" xml:space="preserve"> vs Opus 5.5 · xhigh</text>
50
+ <text x="382.8" y="140" fill="#7c7c7c" xml:space="preserve"> · </text>
51
+ <text x="421.8" y="140" fill="#7c7c7c" xml:space="preserve">64 replies</text>
52
+ <text x="499.8" y="140" fill="#7c7c7c" xml:space="preserve"> · </text>
53
+ <text x="538.8" y="140" fill="#7c7c7c" xml:space="preserve">cold-cache writes +$0.47</text>
73
54
  <text x="24.0" y="159" fill="#7c7c7c" xml:space="preserve">pin next turn </text>
74
55
  <rect x="133.2" y="145" width="70.2" height="18" rx="4" fill="#2e3340"/>
75
56
  <text x="133.2" y="159" fill="#d0d0d0" xml:space="preserve">[ micro ]</text>
@@ -103,9 +84,9 @@
103
84
  <text x="554.4" y="224" fill="#7c7c7c" xml:space="preserve"> · </text>
104
85
  <text x="593.4" y="224" fill="#d0d0d0" xml:space="preserve">ctx </text>
105
86
  <text x="624.6" y="224" fill="#87d787" xml:space="preserve">40%</text>
106
- <text x="648.0" y="224" fill="#d0d0d0" xml:space="preserve"> · cache </text>
107
- <text x="718.2" y="224" fill="#87d787" xml:space="preserve">100%</text>
108
- <text x="765.0" y="224" fill="#d0d0d0" xml:space="preserve">Router</text>
87
+ <text x="648.0" y="224" fill="#d0d0d0" xml:space="preserve"> · cache hit </text>
88
+ <text x="749.4" y="224" fill="#87d787" xml:space="preserve">100%</text>
89
+ <text x="796.2" y="224" fill="#d0d0d0" xml:space="preserve">Router</text>
109
90
  <text class="cap" x="20" y="263">No classifier key: routing keeps the model and offers Set up</text>
110
91
  <rect x="12" y="271" width="897.6" height="29" rx="5" fill="#232323"/>
111
92
  <text x="24.0" y="289" fill="#f0b429" xml:space="preserve">⚠ Jev: no API key</text>
@@ -151,9 +132,9 @@
151
132
  <text x="367.2" y="419" fill="#7c7c7c" xml:space="preserve"> · </text>
152
133
  <text x="406.2" y="419" fill="#d0d0d0" xml:space="preserve">ctx </text>
153
134
  <text x="437.4" y="419" fill="#87d787" xml:space="preserve">40%</text>
154
- <text x="460.8" y="419" fill="#d0d0d0" xml:space="preserve"> · cache </text>
155
- <text x="531.0" y="419" fill="#87d787" xml:space="preserve">100%</text>
156
- <text x="577.8" y="419" fill="#d0d0d0" xml:space="preserve">Router</text>
135
+ <text x="460.8" y="419" fill="#d0d0d0" xml:space="preserve"> · cache hit </text>
136
+ <text x="562.2" y="419" fill="#87d787" xml:space="preserve">100%</text>
137
+ <text x="609.0" y="419" fill="#d0d0d0" xml:space="preserve">Router</text>
157
138
  <text class="cap" x="20" y="458">Activity routing in shadow: the label is shown, the base route still runs</text>
158
139
  <rect x="12" y="466" width="897.6" height="29" rx="5" fill="#232323"/>
159
140
  <text x="24.0" y="484" fill="#5f9fe0" xml:space="preserve">▂</text>
@@ -169,7 +150,7 @@
169
150
  <text x="429.6" y="484" fill="#7c7c7c" xml:space="preserve"> · </text>
170
151
  <text x="468.6" y="484" fill="#d0d0d0" xml:space="preserve">ctx </text>
171
152
  <text x="499.8" y="484" fill="#87d787" xml:space="preserve">40%</text>
172
- <text x="523.2" y="484" fill="#d0d0d0" xml:space="preserve"> · cache </text>
173
- <text x="593.4" y="484" fill="#87d787" xml:space="preserve">100%</text>
174
- <text x="640.2" y="484" fill="#d0d0d0" xml:space="preserve">Router</text>
153
+ <text x="523.2" y="484" fill="#d0d0d0" xml:space="preserve"> · cache hit </text>
154
+ <text x="624.6" y="484" fill="#87d787" xml:space="preserve">100%</text>
155
+ <text x="671.4" y="484" fill="#d0d0d0" xml:space="preserve">Router</text>
175
156
  </svg>
@@ -61,7 +61,7 @@
61
61
  <text x="351.6" y="300" fill="#d0d0d0" xml:space="preserve"> 2% </text>
62
62
  <rect x="406.2" y="286" width="54.6" height="18" rx="4" fill="#2e3340"/>
63
63
  <text x="406.2" y="300" fill="#d0d0d0" xml:space="preserve">[ pin ]</text>
64
- <text x="24.0" y="319" fill="#7c7c7c" xml:space="preserve"> switch needs 82% · Jev gave 88% up · tax ≈ $0.48</text>
64
+ <text x="24.0" y="319" fill="#7c7c7c" xml:space="preserve"> switch needs 82% · Jev gave 88% up · switch cost ≈ $0.48</text>
65
65
  <text x="24.0" y="338" fill="#7c7c7c" xml:space="preserve"> Pins serve the next turn only.</text>
66
66
  <text x="24.0" y="376" fill="#5fafd7" font-weight="700" xml:space="preserve">REPLIES · last 20</text>
67
67
  <text x="39.6" y="395" fill="#5f9fe0" font-weight="700" xml:space="preserve">█</text>
@@ -118,7 +118,7 @@
118
118
  <text x="24.0" y="509" fill="#87d787" xml:space="preserve">Cache ████████████████ 100% reused on the last reply</text>
119
119
  <text x="24.0" y="528" fill="#d0d0d0" xml:space="preserve">Cost $18.003 </text>
120
120
  <text x="156.6" y="528" fill="#7c7c7c" xml:space="preserve">by Claude</text>
121
- <text x="226.8" y="528" fill="#d0d0d0" xml:space="preserve"> · cache saved ≈ $1.52</text>
121
+ <text x="226.8" y="528" fill="#d0d0d0" xml:space="preserve"> · cache hits saved ≈ $1.52</text>
122
122
  <rect x="24.0" y="533" width="70.2" height="18" rx="4" fill="#2e3340"/>
123
123
  <text x="24.0" y="547" fill="#d0d0d0" xml:space="preserve">[ Close ]</text>
124
124
  </svg>
@@ -1,12 +1,12 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 657 1104" role="img" aria-labelledby="title desc">
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 657 1123" role="img" aria-labelledby="title desc">
2
2
  <title id="title">Router pane, Usage tab</title>
3
- <desc id="desc">Routing vs your model first: routed replies against the same tokens on your model, Opus 5.5 at xhigh this session and each session’s own model since the last reset, the difference split into cheaper models, stronger models and switch cache writes, the two costs as bars and the replies by tier; then Claude’s own readings, activity counts with their estimated cost and route, the counts across sessions, and estimates.</desc>
3
+ <desc id="desc">Routing vs your model first: routed replies against the same tokens on your model, Opus 5.5 at xhigh this session and each session’s own model since the last reset, the difference split into cheaper models, stronger models and switch cache writes, the session against the other models, the two costs as bars and the replies by tier; then Claude’s own readings, activity counts with their estimated cost and route, the counts across sessions, and estimates.</desc>
4
4
  <style>
5
5
  text { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace; font-size: 13px; }
6
6
  .cap { font-family: system-ui, -apple-system, 'Segoe UI', sans-serif; font-size: 12px; fill: #9a988f; }
7
7
  </style>
8
- <rect width="657" height="1104" rx="8" fill="#1c1c1c"/>
9
- <rect x="10" y="10" width="637" height="1084" rx="6" fill="none" stroke="#3f5f8f"/>
8
+ <rect width="657" height="1123" rx="8" fill="#1c1c1c"/>
9
+ <rect x="10" y="10" width="637" height="1103" rx="6" fill="none" stroke="#3f5f8f"/>
10
10
  <text x="24.0" y="34" fill="#5fafd7" font-weight="700" xml:space="preserve">ROUTING</text>
11
11
  <rect x="94.2" y="20" width="62.4" height="18" rx="4" fill="#87afff"/>
12
12
  <text x="94.2" y="34" fill="#0d1016" font-weight="700" xml:space="preserve">[ ◉ on ]</text>
@@ -38,97 +38,98 @@
38
38
  <text x="24.0" y="167" fill="#d0d0d0" font-weight="700" xml:space="preserve"> Difference</text>
39
39
  <text x="359.4" y="167" fill="#6fcf97" font-weight="700" xml:space="preserve">−$1.84 −22%</text>
40
40
  <text x="476.4" y="167" fill="#6fcf97" font-weight="700" xml:space="preserve">−$11.42 −22%</text>
41
- <text x="24.0" y="186" fill="#7c7c7c" xml:space="preserve"> cheaper models</text>
42
- <text x="359.4" y="186" fill="#6fcf97" xml:space="preserve">−$2.31</text>
43
- <text x="476.4" y="186" fill="#6fcf97" xml:space="preserve">−$14.90</text>
44
- <text x="24.0" y="205" fill="#7c7c7c" xml:space="preserve"> stronger than yours</text>
45
- <text x="359.4" y="205" fill="#d0d0d0" xml:space="preserve">$0.00</text>
46
- <text x="476.4" y="205" fill="#d0d0d0" xml:space="preserve">$0.00</text>
47
- <text x="24.0" y="224" fill="#7c7c7c" xml:space="preserve"> cache writes from switches</text>
48
- <text x="359.4" y="224" fill="#f0b429" xml:space="preserve">+$0.47</text>
49
- <text x="476.4" y="224" fill="#f0b429" xml:space="preserve">+$3.48</text>
50
- <text x="24.0" y="262" fill="#7c7c7c" xml:space="preserve"> routed </text>
51
- <text x="133.2" y="262" fill="#5fd7af" xml:space="preserve">█</text>
52
- <text x="141.0" y="262" fill="#5f9fe0" xml:space="preserve">██████</text>
53
- <text x="187.8" y="262" fill="#d7af5f" xml:space="preserve">██████</text>
54
- <text x="234.6" y="262" fill="#e0708a" xml:space="preserve">████</text>
55
- <text x="265.8" y="262" fill="#7c7c7c" xml:space="preserve">░░░░░</text>
56
- <text x="304.8" y="262" fill="#d0d0d0" xml:space="preserve"> $6.40</text>
57
- <text x="24.0" y="281" fill="#7c7c7c" xml:space="preserve"> your model </text>
58
- <text x="133.2" y="281" fill="#e0708a" xml:space="preserve">██████████████████████</text>
59
- <text x="304.8" y="281" fill="#d0d0d0" xml:space="preserve"> $8.24</text>
60
- <text x="39.6" y="300" fill="#5fd7af" font-weight="700" xml:space="preserve">■ </text>
61
- <text x="55.2" y="300" fill="#7c7c7c" xml:space="preserve">micro 19% </text>
62
- <text x="141.0" y="300" fill="#5f9fe0" font-weight="700" xml:space="preserve">■ </text>
63
- <text x="156.6" y="300" fill="#7c7c7c" xml:space="preserve">low 41% </text>
64
- <text x="226.8" y="300" fill="#d7af5f" font-weight="700" xml:space="preserve">■ </text>
65
- <text x="242.4" y="300" fill="#7c7c7c" xml:space="preserve">medium 27% </text>
66
- <text x="336.0" y="300" fill="#e0708a" font-weight="700" xml:space="preserve">■ </text>
67
- <text x="351.6" y="300" fill="#7c7c7c" xml:space="preserve">high 14% of replies</text>
68
- <text x="24.0" y="338" fill="#7c7c7c" xml:space="preserve"> since Oct 3: each session compared with its own model</text>
69
- <text x="24.0" y="357" fill="#7c7c7c" xml:space="preserve"> API list prices · same tokens and output length · not a bill;</text>
70
- <text x="24.0" y="376" fill="#7c7c7c" xml:space="preserve"> on a Claude plan it stands for quota · answer quality not measured</text>
71
- <text x="24.0" y="414" fill="#5fafd7" font-weight="700" xml:space="preserve">USAGE · Claude readings</text>
72
- <text x="24.0" y="433" fill="#d0d0d0" xml:space="preserve">Cost $18.003 </text>
73
- <text x="172.2" y="433" fill="#7c7c7c" xml:space="preserve">reported by Claude</text>
74
- <text x="24.0" y="452" fill="#87d787" xml:space="preserve">Context ██████░░░░░░░░░░ 40% ~402.9K / 1.00M</text>
75
- <text x="24.0" y="471" fill="#7c7c7c" xml:space="preserve"> observed 402.4K · estimated 401.8K</text>
76
- <text x="24.0" y="490" fill="#87d787" xml:space="preserve">Cache ████████████████ 100% last reply</text>
77
- <text x="24.0" y="509" fill="#7c7c7c" xml:space="preserve"> read 400.6K · written 1.8K tokens</text>
78
- <text x="24.0" y="528" fill="#d0d0d0" xml:space="preserve">Output 499 tokens on the last reply</text>
79
- <text x="24.0" y="566" fill="#5fafd7" font-weight="700" xml:space="preserve">INPUT PER REPLY · lowest to highest</text>
80
- <text x="39.6" y="585" fill="#5f9fe0" font-weight="700" xml:space="preserve">▁</text>
81
- <text x="47.4" y="585" fill="#5f9fe0" font-weight="700" xml:space="preserve">▂</text>
82
- <text x="55.2" y="585" fill="#5f9fe0" font-weight="700" xml:space="preserve">▂</text>
83
- <text x="63.0" y="585" fill="#5f9fe0" font-weight="700" xml:space="preserve">▂</text>
84
- <text x="70.8" y="585" fill="#5f9fe0" font-weight="700" xml:space="preserve">▃</text>
85
- <text x="78.6" y="585" fill="#5f9fe0" font-weight="700" xml:space="preserve">▃</text>
86
- <text x="86.4" y="585" fill="#d7af5f" font-weight="700" xml:space="preserve">▃</text>
87
- <text x="94.2" y="585" fill="#d7af5f" font-weight="700" xml:space="preserve">▄</text>
88
- <text x="102.0" y="585" fill="#5f9fe0" font-weight="700" xml:space="preserve">▄</text>
89
- <text x="109.8" y="585" fill="#5f9fe0" font-weight="700" xml:space="preserve">▅</text>
90
- <text x="117.6" y="585" fill="#5f9fe0" font-weight="700" xml:space="preserve">▅</text>
91
- <text x="125.4" y="585" fill="#5f9fe0" font-weight="700" xml:space="preserve">▆</text>
92
- <text x="133.2" y="585" fill="#e0708a" font-weight="700" xml:space="preserve">▆</text>
93
- <text x="141.0" y="585" fill="#e0708a" font-weight="700" xml:space="preserve">▆</text>
94
- <text x="148.8" y="585" fill="#e0708a" font-weight="700" xml:space="preserve">▇</text>
95
- <text x="156.6" y="585" fill="#e0708a" font-weight="700" xml:space="preserve">▇</text>
96
- <text x="164.4" y="585" fill="#e0708a" font-weight="700" xml:space="preserve">▇</text>
97
- <text x="172.2" y="585" fill="#e0708a" font-weight="700" xml:space="preserve">▇</text>
98
- <text x="180.0" y="585" fill="#e0708a" font-weight="700" xml:space="preserve">█</text>
99
- <text x="187.8" y="585" fill="#e0708a" font-weight="700" xml:space="preserve">█</text>
100
- <text x="195.6" y="585" fill="#7c7c7c" xml:space="preserve"> 361.0K … 402.4K</text>
101
- <text x="24.0" y="604" fill="#87d787" xml:space="preserve">five hour ████████░░░░░░░░ 48% used</text>
102
- <text x="24.0" y="623" fill="#87d787" xml:space="preserve">seven day ███████░░░░░░░░░ 43% used</text>
103
- <text x="24.0" y="661" fill="#5fafd7" font-weight="700" xml:space="preserve">ACTIVITY · this session</text>
104
- <text x="203.4" y="661" fill="#7c7c7c" xml:space="preserve"> activity routing on</text>
105
- <text x="24.0" y="680" fill="#7c7c7c" xml:space="preserve"> turns requests share est. cost mostly on</text>
106
- <text x="24.0" y="699" fill="#d0d0d0" xml:space="preserve"> code </text>
107
- <text x="109.8" y="699" fill="#5fafd7" xml:space="preserve">██████░░░░</text>
108
- <text x="187.8" y="699" fill="#d0d0d0" xml:space="preserve"> 14 41 58% $3.12 Sonnet 5.5 · high</text>
109
- <text x="24.0" y="718" fill="#d0d0d0" xml:space="preserve"> ops </text>
110
- <text x="109.8" y="718" fill="#5fafd7" xml:space="preserve">███░░░░░░░</text>
111
- <text x="187.8" y="718" fill="#d0d0d0" xml:space="preserve"> 6 15 25% $0.41 Haiku 5.5 · high</text>
112
- <text x="24.0" y="737" fill="#d0d0d0" xml:space="preserve"> explore </text>
113
- <text x="109.8" y="737" fill="#5fafd7" xml:space="preserve">██░░░░░░░░</text>
114
- <text x="187.8" y="737" fill="#d0d0d0" xml:space="preserve"> 4 8 17% $0.38 Haiku 5.5 · high</text>
115
- <text x="24.0" y="756" fill="#d0d0d0" xml:space="preserve">Switches 8 · 5 by tier · 3 by activity · 1 refused</text>
116
- <text x="24.0" y="775" fill="#d0d0d0" xml:space="preserve">Agreement classifier vs tools: 21 of 24 turns (88%)</text>
117
- <text x="24.0" y="813" fill="#5fafd7" font-weight="700" xml:space="preserve">ACROSS SESSIONS · since the last reset</text>
118
- <text x="24.0" y="832" fill="#d0d0d0" xml:space="preserve">Labelled 83 turns</text>
119
- <text x="24.0" y="851" fill="#d0d0d0" xml:space="preserve">Agreement classifier vs tools: 78 of 83 turns (94%)</text>
120
- <text x="24.0" y="870" fill="#d0d0d0" xml:space="preserve">Code/ops/explore classifier vs tools: 78 of 83 turns (94%)</text>
121
- <text x="24.0" y="889" fill="#d0d0d0" xml:space="preserve">Mismatch code → read 4 · ops → code 1</text>
122
- <text x="24.0" y="908" fill="#d0d0d0" xml:space="preserve">Activity moves 9 taken · 4 refused</text>
123
- <text x="24.0" y="927" fill="#d0d0d0" xml:space="preserve">Escalations after a cheaper activity move: 0 in 7 moves</text>
124
- <text x="24.0" y="946" fill="#d0d0d0" xml:space="preserve">Latency Jev p95 ≤ 350 ms · 81 turns</text>
125
- <rect x="24.0" y="951" width="117.0" height="18" rx="4" fill="#2e3340"/>
126
- <text x="24.0" y="965" fill="#d0d0d0" xml:space="preserve">[ Reset stats ]</text>
127
- <text x="141.0" y="965" fill="#7c7c7c" xml:space="preserve"> clears activity stats and routing vs your model, all sessions</text>
128
- <text x="24.0" y="1003" fill="#5fafd7" font-weight="700" xml:space="preserve">ESTIMATES · configured list prices</text>
129
- <text x="24.0" y="1022" fill="#d0d0d0" xml:space="preserve">Cache read benefit $1.522</text>
130
- <text x="24.0" y="1041" fill="#d0d0d0" xml:space="preserve">Switch tax $0.476</text>
131
- <text x="24.0" y="1060" fill="#7c7c7c" xml:space="preserve">Press ? for what these estimates leave out.</text>
132
- <rect x="24.0" y="1065" width="70.2" height="18" rx="4" fill="#2e3340"/>
133
- <text x="24.0" y="1079" fill="#d0d0d0" xml:space="preserve">[ Close ]</text>
41
+ <text x="24.0" y="186" fill="#7c7c7c" xml:space="preserve"> vs other models: Sonnet 5.5 extra $2.28 · Haiku 5.5 extra $6.19</text>
42
+ <text x="24.0" y="205" fill="#7c7c7c" xml:space="preserve"> cheaper models</text>
43
+ <text x="359.4" y="205" fill="#6fcf97" xml:space="preserve">−$2.31</text>
44
+ <text x="476.4" y="205" fill="#6fcf97" xml:space="preserve">−$14.90</text>
45
+ <text x="24.0" y="224" fill="#7c7c7c" xml:space="preserve"> stronger than yours</text>
46
+ <text x="359.4" y="224" fill="#d0d0d0" xml:space="preserve">$0.00</text>
47
+ <text x="476.4" y="224" fill="#d0d0d0" xml:space="preserve">$0.00</text>
48
+ <text x="24.0" y="243" fill="#7c7c7c" xml:space="preserve"> cache writes from switches</text>
49
+ <text x="359.4" y="243" fill="#f0b429" xml:space="preserve">+$0.47</text>
50
+ <text x="476.4" y="243" fill="#f0b429" xml:space="preserve">+$3.48</text>
51
+ <text x="24.0" y="281" fill="#7c7c7c" xml:space="preserve"> routed </text>
52
+ <text x="133.2" y="281" fill="#5fd7af" xml:space="preserve">█</text>
53
+ <text x="141.0" y="281" fill="#5f9fe0" xml:space="preserve">██████</text>
54
+ <text x="187.8" y="281" fill="#d7af5f" xml:space="preserve">██████</text>
55
+ <text x="234.6" y="281" fill="#e0708a" xml:space="preserve">████</text>
56
+ <text x="265.8" y="281" fill="#7c7c7c" xml:space="preserve">░░░░░</text>
57
+ <text x="304.8" y="281" fill="#d0d0d0" xml:space="preserve"> $6.40</text>
58
+ <text x="24.0" y="300" fill="#7c7c7c" xml:space="preserve"> your model </text>
59
+ <text x="133.2" y="300" fill="#e0708a" xml:space="preserve">██████████████████████</text>
60
+ <text x="304.8" y="300" fill="#d0d0d0" xml:space="preserve"> $8.24</text>
61
+ <text x="39.6" y="319" fill="#5fd7af" font-weight="700" xml:space="preserve">■ </text>
62
+ <text x="55.2" y="319" fill="#7c7c7c" xml:space="preserve">micro 19% </text>
63
+ <text x="141.0" y="319" fill="#5f9fe0" font-weight="700" xml:space="preserve">■ </text>
64
+ <text x="156.6" y="319" fill="#7c7c7c" xml:space="preserve">low 41% </text>
65
+ <text x="226.8" y="319" fill="#d7af5f" font-weight="700" xml:space="preserve">■ </text>
66
+ <text x="242.4" y="319" fill="#7c7c7c" xml:space="preserve">medium 27% </text>
67
+ <text x="336.0" y="319" fill="#e0708a" font-weight="700" xml:space="preserve">■ </text>
68
+ <text x="351.6" y="319" fill="#7c7c7c" xml:space="preserve">high 14% of replies</text>
69
+ <text x="24.0" y="357" fill="#7c7c7c" xml:space="preserve"> since Oct 3: each session compared with its own model</text>
70
+ <text x="24.0" y="376" fill="#7c7c7c" xml:space="preserve"> API list prices · same tokens and output length · not a bill;</text>
71
+ <text x="24.0" y="395" fill="#7c7c7c" xml:space="preserve"> on a Claude plan it stands for quota · answer quality not measured</text>
72
+ <text x="24.0" y="433" fill="#5fafd7" font-weight="700" xml:space="preserve">USAGE · Claude readings</text>
73
+ <text x="24.0" y="452" fill="#d0d0d0" xml:space="preserve">Cost $18.003 </text>
74
+ <text x="172.2" y="452" fill="#7c7c7c" xml:space="preserve">reported by Claude</text>
75
+ <text x="24.0" y="471" fill="#87d787" xml:space="preserve">Context ██████░░░░░░░░░░ 40% ~402.9K / 1.00M</text>
76
+ <text x="24.0" y="490" fill="#7c7c7c" xml:space="preserve"> observed 402.4K · estimated 401.8K</text>
77
+ <text x="24.0" y="509" fill="#87d787" xml:space="preserve">Cache ████████████████ 100% last reply</text>
78
+ <text x="24.0" y="528" fill="#7c7c7c" xml:space="preserve"> read 400.6K · written 1.8K tokens</text>
79
+ <text x="24.0" y="547" fill="#d0d0d0" xml:space="preserve">Output 499 tokens on the last reply</text>
80
+ <text x="24.0" y="585" fill="#5fafd7" font-weight="700" xml:space="preserve">INPUT PER REPLY · lowest to highest</text>
81
+ <text x="39.6" y="604" fill="#5f9fe0" font-weight="700" xml:space="preserve">▁</text>
82
+ <text x="47.4" y="604" fill="#5f9fe0" font-weight="700" xml:space="preserve">▂</text>
83
+ <text x="55.2" y="604" fill="#5f9fe0" font-weight="700" xml:space="preserve">▂</text>
84
+ <text x="63.0" y="604" fill="#5f9fe0" font-weight="700" xml:space="preserve">▂</text>
85
+ <text x="70.8" y="604" fill="#5f9fe0" font-weight="700" xml:space="preserve">▃</text>
86
+ <text x="78.6" y="604" fill="#5f9fe0" font-weight="700" xml:space="preserve">▃</text>
87
+ <text x="86.4" y="604" fill="#d7af5f" font-weight="700" xml:space="preserve">▃</text>
88
+ <text x="94.2" y="604" fill="#d7af5f" font-weight="700" xml:space="preserve">▄</text>
89
+ <text x="102.0" y="604" fill="#5f9fe0" font-weight="700" xml:space="preserve">▄</text>
90
+ <text x="109.8" y="604" fill="#5f9fe0" font-weight="700" xml:space="preserve">▅</text>
91
+ <text x="117.6" y="604" fill="#5f9fe0" font-weight="700" xml:space="preserve">▅</text>
92
+ <text x="125.4" y="604" fill="#5f9fe0" font-weight="700" xml:space="preserve">▆</text>
93
+ <text x="133.2" y="604" fill="#e0708a" font-weight="700" xml:space="preserve">▆</text>
94
+ <text x="141.0" y="604" fill="#e0708a" font-weight="700" xml:space="preserve">▆</text>
95
+ <text x="148.8" y="604" fill="#e0708a" font-weight="700" xml:space="preserve">▇</text>
96
+ <text x="156.6" y="604" fill="#e0708a" font-weight="700" xml:space="preserve">▇</text>
97
+ <text x="164.4" y="604" fill="#e0708a" font-weight="700" xml:space="preserve">▇</text>
98
+ <text x="172.2" y="604" fill="#e0708a" font-weight="700" xml:space="preserve">▇</text>
99
+ <text x="180.0" y="604" fill="#e0708a" font-weight="700" xml:space="preserve">█</text>
100
+ <text x="187.8" y="604" fill="#e0708a" font-weight="700" xml:space="preserve">█</text>
101
+ <text x="195.6" y="604" fill="#7c7c7c" xml:space="preserve"> 361.0K … 402.4K</text>
102
+ <text x="24.0" y="623" fill="#87d787" xml:space="preserve">five hour ████████░░░░░░░░ 48% used</text>
103
+ <text x="24.0" y="642" fill="#87d787" xml:space="preserve">seven day ███████░░░░░░░░░ 43% used</text>
104
+ <text x="24.0" y="680" fill="#5fafd7" font-weight="700" xml:space="preserve">ACTIVITY · this session</text>
105
+ <text x="203.4" y="680" fill="#7c7c7c" xml:space="preserve"> activity routing on</text>
106
+ <text x="24.0" y="699" fill="#7c7c7c" xml:space="preserve"> turns requests share est. cost mostly on</text>
107
+ <text x="24.0" y="718" fill="#d0d0d0" xml:space="preserve"> code </text>
108
+ <text x="109.8" y="718" fill="#5fafd7" xml:space="preserve">██████░░░░</text>
109
+ <text x="187.8" y="718" fill="#d0d0d0" xml:space="preserve"> 14 41 58% $3.12 Sonnet 5.5 · high</text>
110
+ <text x="24.0" y="737" fill="#d0d0d0" xml:space="preserve"> ops </text>
111
+ <text x="109.8" y="737" fill="#5fafd7" xml:space="preserve">███░░░░░░░</text>
112
+ <text x="187.8" y="737" fill="#d0d0d0" xml:space="preserve"> 6 15 25% $0.41 Haiku 5.5 · high</text>
113
+ <text x="24.0" y="756" fill="#d0d0d0" xml:space="preserve"> explore </text>
114
+ <text x="109.8" y="756" fill="#5fafd7" xml:space="preserve">██░░░░░░░░</text>
115
+ <text x="187.8" y="756" fill="#d0d0d0" xml:space="preserve"> 4 8 17% $0.38 Haiku 5.5 · high</text>
116
+ <text x="24.0" y="775" fill="#d0d0d0" xml:space="preserve">Switches 8 · 5 by tier · 3 by activity · 1 refused</text>
117
+ <text x="24.0" y="794" fill="#d0d0d0" xml:space="preserve">Agreement classifier vs tools: 21 of 24 turns (88%)</text>
118
+ <text x="24.0" y="832" fill="#5fafd7" font-weight="700" xml:space="preserve">ACROSS SESSIONS · since the last reset</text>
119
+ <text x="24.0" y="851" fill="#d0d0d0" xml:space="preserve">Labelled 83 turns</text>
120
+ <text x="24.0" y="870" fill="#d0d0d0" xml:space="preserve">Agreement classifier vs tools: 78 of 83 turns (94%)</text>
121
+ <text x="24.0" y="889" fill="#d0d0d0" xml:space="preserve">Code/ops/explore classifier vs tools: 78 of 83 turns (94%)</text>
122
+ <text x="24.0" y="908" fill="#d0d0d0" xml:space="preserve">Mismatch code → read 4 · ops → code 1</text>
123
+ <text x="24.0" y="927" fill="#d0d0d0" xml:space="preserve">Activity moves 9 taken · 4 refused</text>
124
+ <text x="24.0" y="946" fill="#d0d0d0" xml:space="preserve">Escalations after a cheaper activity move: 0 in 7 moves</text>
125
+ <text x="24.0" y="965" fill="#d0d0d0" xml:space="preserve">Latency Jev p95 ≤ 350 ms · 81 turns</text>
126
+ <rect x="24.0" y="970" width="117.0" height="18" rx="4" fill="#2e3340"/>
127
+ <text x="24.0" y="984" fill="#d0d0d0" xml:space="preserve">[ Reset stats ]</text>
128
+ <text x="141.0" y="984" fill="#7c7c7c" xml:space="preserve"> clears activity stats and routing vs your model, all sessions</text>
129
+ <text x="24.0" y="1022" fill="#5fafd7" font-weight="700" xml:space="preserve">ESTIMATES · configured list prices</text>
130
+ <text x="24.0" y="1041" fill="#d0d0d0" xml:space="preserve">Cache hits saved $1.522</text>
131
+ <text x="24.0" y="1060" fill="#d0d0d0" xml:space="preserve">Switch cost $0.476</text>
132
+ <text x="24.0" y="1079" fill="#7c7c7c" xml:space="preserve">Press ? for what these estimates leave out.</text>
133
+ <rect x="24.0" y="1084" width="70.2" height="18" rx="4" fill="#2e3340"/>
134
+ <text x="24.0" y="1098" fill="#d0d0d0" xml:space="preserve">[ Close ]</text>
134
135
  </svg>
@@ -39,8 +39,9 @@ Read the first line of the picture from left to right:
39
39
  - **Tier meter** `▂▄▆█`: one bar per tier, lit up to the current tier in its color, like signal strength.
40
40
  - **Tier, activity, and model**: the route for this turn. The activity, such as `code →`, sits between the tier and the model; see [Route by activity](#route-by-activity). **fallback** means Claude Code answered with another model.
41
41
  - **Reason**: one or two words with a direction, such as `↑ jump`, `↓ downgrade`, `= fits`, or `… waiting to go down`. An activity move reads `↗ code` or `↘ ops`, and a refused one `… ops: not worth a switch`.
42
- - **Classifier support**: what the active classifier, such as Jev or Clef Flash, gave the switch against the bar the policy required.
43
- - **ctx** and **cache**: context use and cache reuse on the last reply. They turn yellow at 60% context and red at 80%.
42
+ - **Classifier support**: what the active classifier, such as Jev or Clef Flash, gave the switch against the bar the policy required, such as `Jev 88% ≥ 82%`. When whole percents would read as equal, it shows tenths: `Jev 81.0% < 81.4%`.
43
+ - **Switch cost**: `switch cost ≈ $0.37`, the policy's price for the switch it weighed this turn, mostly the prompt cache the other model must write. For a move to a cheaper model it is net of what that model saves over the next turns. The higher the cost, the higher the bar a stronger model must clear.
44
+ - **ctx** and **cache hit**: context use and the share of input read from the cache on the last reply. They turn yellow at 60% context and red at 80%.
44
45
 
45
46
  | Band shows | Meaning |
46
47
  | ----------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- |
@@ -54,7 +55,7 @@ Read the first line of the picture from left to right:
54
55
  | `✕ Routing unavailable` | Nothing routes: an old Claude Code or leftover v0.8 settings. **Fix** opens the pane. |
55
56
  | `○ Router · subagents keep their own model` | You are viewing a subagent's transcript, which Router does not route. |
56
57
 
57
- 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 a strip of recent replies colored by tier, the number of route switches (a change of model or effort, a move inside a tier included), the switch tax, the cache saving and, from the tenth reply, the session against your model, such as `vs your model −22% (−$1.84, list prices)` or `vs your model +$2.48 (stronger models, list prices)`. It drops first when the row is short. 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.
58
+ 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 one `/model` selects now: `session saved $1.84 (22%) vs Opus 5.5 · xhigh · 64 replies · cold-cache writes +$0.47`, or `session extra $2.48 (×5.0) vs Haiku 5.5 · high · 41 replies · stronger models +$2.31` when routing cost more. The last part names the larger of the two costs behind the result, when there is one. After a `/model` change the row shows the whole session against the new model. Before the tenth routed reply it reads `session 3 replies · too early to compare`. When the row is short, the cost part drops first, then the reply count. 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.
58
59
 
59
60
  The band steps aside while a survey needs the space.
60
61
 
@@ -66,7 +67,7 @@ Run `/router` or select **Router** above the prompt. Without a UI surface, as in
66
67
 
67
68
  ![The Now tab: the route, the activity and its alternatives, the reason, classifier support per tier with pin buttons, recent replies by tier and activity, and context, cache and cost](router-pane-now.svg)
68
69
 
69
- The **Now** tab answers "what runs next turn, and why". The ladder lists the tiers from strongest to cheapest with the route each one uses. The bar is the support the classifier gave that tier on the last turn. The line under the ladder compares the support for a switch with the bar the policy required and shows the estimated switch tax. **pin** forces that tier for the next turn only. The **Activity** and **Route** lines under the route are covered in [Route by activity](#route-by-activity).
70
+ The **Now** tab answers "what runs next turn, and why". The ladder lists the tiers from strongest to cheapest with the route each one uses. The bar is the support the classifier gave that tier on the last turn. The line under the ladder compares the support for a switch with the bar the policy required and shows the estimated switch cost. **pin** forces that tier for the next turn only. The **Activity** and **Route** lines under the route are covered in [Route by activity](#route-by-activity).
70
71
 
71
72
  ![The Routing tab: model and effort per tier, the baseline tier, how each step up is priced, the activity matrix and overrides, the policy controls, and the unsaved router.json changes with Save and Discard](router-pane-routing.svg)
72
73
 
@@ -94,7 +95,7 @@ Every write applies from the next turn and can be undone. **Undo** (`u`) puts ba
94
95
 
95
96
  ![The Usage tab: routing vs your model, this session and since the last reset, with the difference split into its three parts, bars and replies by tier, then Claude's readings, activity counts with their estimated cost and route, the counts across sessions, and estimates](router-pane-usage.svg)
96
97
 
97
- **ROUTING VS YOUR MODEL** opens the Usage tab. Your model is the model and effort the session had before routing: the `--model` or `/model` choice and the session effort, shown in the heading. For every reply routing chose, it prices the tokens Claude reported on the model that served them, and the same tokens on your model, at the list prices in `router.json`.
98
+ **ROUTING VS YOUR MODEL** opens the Usage tab. Your model is the model `/model` (or `--model`) selects now, at the session effort, shown in the heading. For every reply routing chose, it prices the reported tokens on the model that served them. It also prices the same tokens on each model in `router.json`, at its list prices. After a `/model` change, the session column shows the whole session against the new model. The line `vs other models: Sonnet 5.5 extra $2.28 · Haiku 5.5 extra $6.19` shows the session against the others, each from its tenth routed reply.
98
99
 
99
100
  | Line | What it is |
100
101
  | -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
@@ -105,7 +106,7 @@ Every write applies from the next turn and can be undone. **Undo** (`u`) puts ba
105
106
  | stronger than yours | The part from replies on stronger models, with how many replies ran on them. |
106
107
  | cache writes from switches | The part from rewriting the prompt cache after model switches. |
107
108
 
108
- The three parts add up to the difference. Two bars compare the costs, the routed one colored by the tier that spent it, and a line gives the share of replies per tier. In activity-routing `shadow`, one more line estimates what `on` would change in this session. The columns are this session and every session since the last reset; the saved column compares each session with its own model and effort, so it can add up several models. A column reads `too early` until it has 10 routed replies. With routing off or unavailable and no routed reply this session, the section says every reply used your model. In a narrow pane the bars go first, then the saved column.
109
+ The three parts add up to the difference. Two bars compare the costs, the routed one colored by the tier that spent it, and a line gives the share of replies per tier. In activity-routing `shadow`, one more line estimates what `on` would change in this session. The columns are this session and every session since the last reset; the saved column compares each reply with the model `/model` selected when it ran, so it can add up several models. A column reads `too early` until it has 10 routed replies. With routing off or unavailable and no routed reply this session, the section says every reply used your model. In a narrow pane the bars go first, then the saved column.
109
110
 
110
111
  These are estimates, not a bill. They hold the tokens and the output length the same, although another model may write more or less, and they do not measure answer quality. On a Claude plan the dollars stand for quota. Your model's cache reads the previous prompt inside the cache lifetime Claude Code uses, one hour on a Claude plan, and never less than the API actually read. A route that changes only the effort, such as Opus at `xhigh` to Opus at `medium`, costs no less per token: it shows only its cache writes. [Evaluation](evaluation.md#routing-vs-your-model) explains the method.
111
112
 
@@ -114,10 +115,10 @@ These are estimates, not a bill. They hold the tokens and the output length the
114
115
  - **Cost** comes from Claude Code's native usage API. If the account is on a plan, a configured list-price estimate is not the subscription cash charge.
115
116
  - **Context** compares the larger available context reading with the routed model's configured window. The router reserves 20% of that window. Values can be unknown when Claude does not provide the needed estimate.
116
117
  - **Cache** reuse is cache-read tokens divided by the last response's input counters.
117
- - **Classifier support**, such as **Jev support**, is the probability the classifier gave each tier on the last classified turn. The line under it compares the support for a switch with the bar the policy required, and shows the estimated switch tax.
118
+ - **Classifier support**, such as **Jev support**, is the probability the classifier gave each tier on the last classified turn. The line under it compares the support for a switch with the bar the policy required, and shows the estimated switch cost.
118
119
  - **Replies** colors each of the last 30 main-conversation replies by the tier that served it. A dot marks a reply the router did not choose, such as one with routing off. The count beside the strip is the number of switches between those replies: a change of model or effort, so a move from Sonnet to Haiku inside `low` counts too. When activity routing is on or in shadow, a row of letters under the strip names each reply's activity: `c` code, `d` debug, `e` explore, `p` plan, `r` review, `o` ops, `w` docs.
119
120
  - **Input per reply** scales the last 30 input sizes from the lowest to the highest reading. It is a scale comparison, not a forecast.
120
- - **Cache read benefit** is a configured-price estimate for cached reads before write costs. It is not a measured saving.
121
+ - **Cache hits saved** is a configured-price estimate for cached reads before write costs. It is not a measured saving.
121
122
  - **Next-turn difference** compares the candidate with the current model under five-minute and one-hour cache-write scenarios. A negative number means the candidate is estimated to cost less for that request.
122
123
  - **Payback** estimates later turns to recover an initial difference under assumed future cache reads and the last observed output size. It does not guarantee savings.
123
124
 
@@ -65,12 +65,15 @@ import {
65
65
  resetHistory,
66
66
  } from '../lib/route.mjs';
67
67
  import {
68
+ addReplies,
68
69
  addReply,
69
70
  afterReset,
70
- compareReply,
71
+ compareModels,
71
72
  emptySavingsStore,
72
73
  emptyTotals,
73
74
  mergeSavingsStores,
75
+ modelAlias,
76
+ modelEntry,
74
77
  readSavingsStore,
75
78
  recordSavingsStore,
76
79
  SAVINGS_PREFIX,
@@ -181,6 +184,10 @@ async function rememberMode($, mode) {
181
184
  async function updateView($, router, patch) {
182
185
  const value = router.view ?? (await readView($, router));
183
186
  router.view = { ...value, ...patch };
187
+ // The session readout is against the model /model selects now, so a /model change shows the whole session against
188
+ // the new one.
189
+ if ('nativeModel' in patch || 'savingsBy' in patch)
190
+ router.view.savings = modelEntry(router.view.savingsBy, modelAlias(router.config, router.view.nativeModel)) ?? null;
184
191
  await $.state.set(VIEW, router.view);
185
192
  }
186
193
 
@@ -458,7 +465,7 @@ async function* passMain($, e, next, loop, version, nativeModel, reason, router)
458
465
  });
459
466
  // Routing chose nothing here, so the reply is not counted; your model's cache still follows it.
460
467
  const compared = await compareYours($, router, loop, response, e.effort ?? null, nativeModel);
461
- if (compared) observed.yours = compared.state;
468
+ if (compared) observed.yoursBy = compared.states;
462
469
  const written = await $.state.set(ref, observed, { ifVersion: version });
463
470
  if (written.isSet) await updateView($, router, responseMetrics(router.view, response, null));
464
471
  }
@@ -618,14 +625,14 @@ async function observeRouted($, router, { turnId, cfg, loop, loopVersion, reques
618
625
  });
619
626
  if (response.stopReason === null) observed.suspended = true;
620
627
  const compared = await compareYours($, router, loop, response, request.effort ?? null, nativeModel, cfg);
621
- if (compared) observed.yours = compared.state;
628
+ if (compared) observed.yoursBy = compared.states;
622
629
  const written = await $.state.set({ ...LOOP, id: 'main' }, observed, { ifVersion: loopVersion });
623
630
  if (!written.isSet) return;
624
631
  // A substituted reply is not the tier's: the strip and trend must not count it as one.
625
632
  const tier = isSameModel(request.model, response.usage?.model) ? loop.decision.tier : null;
626
633
  const route = `${request.model}@${request.effort ?? 'session'}`;
627
634
  await publishReply($, router, turnId, response, tier, route, compared?.reply?.routedUsd ?? null);
628
- if (compared?.reply) await addSavings($, router, turnId, compared.reply, tier);
635
+ if (compared) await addSavings($, router, turnId, compared, tier);
629
636
  }
630
637
 
631
638
  // The main conversation's prompt-cache lifetime by Claude Code's rule (sessionCacheTtl), or null when a reading
@@ -647,31 +654,35 @@ async function cacheTtlOf($) {
647
654
  }
648
655
  }
649
656
 
650
- // A main reply against your model (compareReply): the loop's next `yours` state and the reply's prices, or null. The
651
- // readout never breaks a turn. A reply whose cache lifetime cannot be read still moves your model's cache and is not
652
- // counted; any other failure leaves the loop's state and the totals as they were.
657
+ // A main reply against every configured model (compareModels): the loop's next states, the reply's prices by models
658
+ // key, and `reply`, its prices against your model now, or null. The readout never breaks a turn. A reply whose cache
659
+ // lifetime cannot be read still moves the models' caches and is not counted; any other failure leaves the loop's
660
+ // states and the totals as they were.
653
661
  async function compareYours($, router, loop, response, servedEffort, nativeModel, cfg = router.config) {
654
662
  try {
655
663
  if (!response.usage?.model) return null;
656
664
  const view = router.view ?? (await readView($, router));
657
- return compareReply(cfg, loop.yours ?? null, {
665
+ return compareModels(cfg, loop.yoursBy ?? {}, {
658
666
  usage: response.usage,
659
667
  served: { model: response.usage.model, effort: servedEffort },
660
- yours: { model: nativeModel, effort: view.nativeEffort ?? null },
668
+ effort: view.nativeEffort ?? null,
661
669
  ttl: await cacheTtlOf($),
662
670
  now: Date.now(),
671
+ yours: nativeModel,
663
672
  });
664
673
  } catch {
665
674
  return null;
666
675
  }
667
676
  }
668
677
 
669
- // A routed reply's prices added to the session totals in the view and to the turn's totals for the store.
670
- async function addSavings($, router, turnId, reply, tier) {
678
+ // A routed reply's prices added to each model's session totals in the view, and its prices against your model now to
679
+ // the turn's totals for the store.
680
+ async function addSavings($, router, turnId, compared, tier) {
671
681
  try {
672
682
  const view = router.view ?? (await readView($, router));
673
- router.turnSavings.set(turnId, addReply(router.turnSavings.get(turnId) ?? emptyTotals(), reply, tier));
674
- await updateView($, router, { savings: addReply(view.savings ?? emptyTotals(), reply, tier) });
683
+ if (compared.reply)
684
+ router.turnSavings.set(turnId, addReply(router.turnSavings.get(turnId) ?? emptyTotals(), compared.reply, tier));
685
+ await updateView($, router, { savingsBy: addReplies(view.savingsBy ?? {}, compared.replies, tier) });
675
686
  } catch {}
676
687
  }
677
688
 
@@ -703,14 +714,15 @@ async function recordActivity($, router, turn) {
703
714
  if (start < 0) return;
704
715
  const observed = observedActivity(messages, start);
705
716
  const view = router.view ?? (await readView($, router));
706
- // Routing turned off while this turn ran ends the watch here, even when it is back on by now, so the move is not
707
- // inherited.
708
- const off = (await modeOf($, router)) === 'manual' || turn.offSwitches !== router.offSwitches;
717
+ const manual = (await modeOf($, router)) === 'manual';
709
718
  // The session may have changed during the reads; this turn is not the new session's.
710
719
  if ((await $.session.id()) !== turn.sessionId) return;
711
720
  // Advanced before any further await, so a session change meanwhile cannot carry this run into the new session.
712
721
  const { run, ended } = advanceRun(router.run, turn.answer);
713
722
  router.run = run;
723
+ // Routing turned off while this turn ran ends the watch here, even when it is back on by now, so the move is not
724
+ // inherited. The counter is read after the last await: a switch during any of them counts.
725
+ const off = manual || turn.offSwitches !== router.offSwitches;
714
726
  const down = advanceDown(router.afterDown, turn);
715
727
  router.afterDown = off ? null : down.after;
716
728
  await updateView($, router, {
@@ -955,7 +967,7 @@ function paneActions($, router, view) {
955
967
  const [stats, records] = await Promise.all([clear(STORE_KEY, emptyStore()), clearRecords().catch(() => false)]);
956
968
  await updateView($, router, {
957
969
  activityStats: null,
958
- savings: null,
970
+ savingsBy: {},
959
971
  ...(stats ? { activityStore: emptyStore() } : {}),
960
972
  ...(records ? { activityMetrics: emptyMetrics(), savingsStore: emptySavingsStore() } : {}),
961
973
  notice:
package/lib/band.mjs CHANGED
@@ -6,19 +6,19 @@ import {
6
6
  differenceShare,
7
7
  modelName,
8
8
  NOT_A_TIER_REASON,
9
- percent,
9
+ percentPair,
10
10
  reasonActivity,
11
11
  routeLabel,
12
12
  SAVINGS_COLOR,
13
13
  shortReason,
14
- signedUsd,
15
- switchCount,
16
14
  TIER_COLOR,
17
15
  unavailableReason,
18
16
  usageMetrics,
17
+ usd,
18
+ yourModel,
19
19
  } from './display.mjs';
20
20
  import { isSameModel } from './route.mjs';
21
- import { emptyTotals, readout } from './savings.mjs';
21
+ import { emptyTotals, modelSpec, readout } from './savings.mjs';
22
22
 
23
23
  const BARS = '▂▄▆█';
24
24
  const SEPARATOR = ' · ';
@@ -26,7 +26,6 @@ const SEPARATOR = ' · ';
26
26
  const GAP = ' ';
27
27
  // Space the band keeps for the trailing Router button.
28
28
  const ROUTER_BUTTON = 8;
29
- const STRIP = 20;
30
29
 
31
30
  // Hex, like TIER_COLOR, so every surface draws the same shades. Yellow stays out: it marks a fault that needs action.
32
31
  const COLOR = { accent: '#7c9cff', off: '#2a3040', muted: '#8b93a7', warn: '#f0b429', ink: '#0d1016' };
@@ -100,7 +99,8 @@ function supportText(config, estimate) {
100
99
  if (!Number.isFinite(estimate?.threshold)) return null;
101
100
  const mass = Number.isFinite(estimate.upgradeMass) ? estimate.upgradeMass : estimate.downgradeMass;
102
101
  if (!Number.isFinite(mass)) return null;
103
- return `${classifierLabel(config)} ${percent(mass)} ${mass >= estimate.threshold ? '≥' : '<'} ${percent(estimate.threshold)}`;
102
+ const [shown, bar] = percentPair(mass, estimate.threshold);
103
+ return `${classifierLabel(config)} ${shown} ${mass >= estimate.threshold ? '≥' : '<'} ${bar}`;
104
104
  }
105
105
 
106
106
  export function bandSegments(config, view, usage, actions) {
@@ -175,57 +175,59 @@ export function bandSegments(config, view, usage, actions) {
175
175
  const metrics = usageMetrics(config, view, usage);
176
176
  const reading = (bar) => part(bar.percent === null ? '?' : `${bar.percent}%`, { color: bar.color });
177
177
  const support = supportText(config, view.estimate);
178
+ // The policy's price for the switch it weighed: mostly the prompt cache the other model must write. For a move to a
179
+ // cheaper model it is net of what that model saves over the downgrade horizon.
180
+ const switchUsd = view.estimate?.taxUsd;
178
181
  return [
179
182
  main,
180
183
  pin,
181
184
  segment(1, part(shortReason(view.reason, reasonActivity(config, view)), { dimColor: true })),
182
185
  support ? segment(4, part(support, { dimColor: true })) : null,
186
+ Number.isFinite(switchUsd) && switchUsd >= 0.005
187
+ ? segment(4, part(`switch cost ≈ ${usd(switchUsd)}`, { dimColor: true }))
188
+ : null,
183
189
  metrics.contextBar.percent === null && metrics.cacheBar.percent === null
184
190
  ? null
185
- : segment(3, part('ctx '), reading(metrics.contextBar), part(' · cache '), reading(metrics.cacheBar)),
191
+ : segment(3, part('ctx '), reading(metrics.contextBar), part(' · cache hit '), reading(metrics.cacheBar)),
186
192
  ].filter(Boolean);
187
193
  }
188
194
 
189
- // The session against your model, once it is past "too early": "vs your model −22% (−$1.84, list prices)", or the
190
- // extra with what bought it, "+$2.48 (stronger models, list prices)". Null before that.
191
- export function savingsParts(view) {
195
+ // The larger of the two costs that cut a saving or made an extra, if the session had one: "stronger models +$0.68".
196
+ function costPart(r) {
197
+ const [label, value] =
198
+ r.strongerUsd >= r.switchUsd ? ['stronger models', r.strongerUsd] : ['cold-cache writes', r.switchUsd];
199
+ return value > 0 ? `${label} +${usd(value)}` : null;
200
+ }
201
+
202
+ // The second row of the detailed band: this session against the model /model selects now, one scope end to end, so a
203
+ // /model change shows the whole session against the new one. The answer stays; the reply count and the cost behind it
204
+ // drop first when the band is narrow.
205
+ export function sessionRow(config, view, columns) {
206
+ const label = part('session ', { dimColor: true });
207
+ if (!modelSpec(config, view.nativeModel))
208
+ return [label, part(`${modelName(view.nativeModel)} has no list price`, { dimColor: true })];
192
209
  const r = readout(view.savings ?? emptyTotals());
193
- if (r.early) return null;
194
- const share = differenceShare(r);
195
- const [shown, note] =
210
+ if (!r.replies) return [part('no replies yet', { dimColor: true })];
211
+ const replies = `${r.replies} repl${r.replies === 1 ? 'y' : 'ies'}`;
212
+ if (r.early) return [label, part(`${replies} · too early to compare`, { dimColor: true })];
213
+ const share = differenceShare(r)?.replace(/^[−+]/, '');
214
+ const amount = `${usd(r.differenceUsd)}${share ? ` (${share})` : ''}`;
215
+ const answer =
196
216
  r.differenceUsd < 0
197
- ? [share ?? signedUsd(r.differenceUsd), `${signedUsd(r.differenceUsd)}, list prices`]
217
+ ? [part(`saved ${amount}`, { color: SAVINGS_COLOR.less, bold: true }), part(` vs ${yourModel(view)}`)]
198
218
  : r.differenceUsd > 0
199
- ? [
200
- signedUsd(r.differenceUsd),
201
- `${r.strongerUsd >= r.switchUsd ? 'stronger models' : 'switch cache writes'}, list prices`,
202
- ]
203
- : ['$0.00', 'list prices'];
204
- const color = r.differenceUsd < 0 ? SAVINGS_COLOR.less : r.differenceUsd > 0 ? SAVINGS_COLOR.more : undefined;
205
- return [part('vs your model '), part(shown, color ? { color } : {}), part(` (${note})`, { dimColor: true })];
206
- }
207
-
208
- // The second row of the detailed band: recent replies by tier, the session's switch economics, and the session
209
- // against your model when the row has room for it.
210
- function detailRow(config, view, usage, columns) {
211
- const tiers = (view.tiers ?? []).slice(-STRIP);
212
- if (!tiers.length) return [part('no replies yet', { dimColor: true })];
213
- const switches = switchCount((view.routes ?? []).slice(-tiers.length));
214
- const metrics = usageMetrics(config, view, usage);
215
- const savings = savingsParts(view);
216
- const row = [
217
- part('replies ', { dimColor: true }),
218
- ...tiers.map((tier) => (tier ? part('█', { color: TIER_COLOR[tier] }) : part('·', { dimColor: true }))),
219
- part(
220
- ` ${switches} switch${switches === 1 ? '' : 'es'}` +
221
- `${Number.isFinite(view.estimate?.taxUsd) ? ` · tax ≈ $${view.estimate.taxUsd.toFixed(2)}` : ''}` +
222
- `${Number.isFinite(metrics.cacheBenefit) ? ` · cache saved ≈ $${metrics.cacheBenefit.toFixed(2)}` : ''}`,
223
- { dimColor: true },
224
- ),
225
- ];
226
- const tail = savings ? [part(SEPARATOR, { dimColor: true }), ...savings] : [];
227
- const width = (parts) => parts.reduce((n, p) => n + partWidth(p), 0);
228
- return width(row) + width(tail) <= columns ? [...row, ...tail] : row;
219
+ ? [part(`extra ${amount}`, { color: SAVINGS_COLOR.more, bold: true }), part(` vs ${yourModel(view)}`)]
220
+ : [part(`same cost as ${yourModel(view)}`)];
221
+ const cost = costPart(r);
222
+ const kept = fitSegments(
223
+ [
224
+ segment(0, label, answer),
225
+ segment(2, part(replies, { dimColor: true })),
226
+ cost ? segment(3, part(cost, { dimColor: true })) : null,
227
+ ].filter(Boolean),
228
+ columns,
229
+ );
230
+ return kept.flatMap((s, i) => (i ? [part(SEPARATOR, { dimColor: true }), ...s.parts] : s.parts));
229
231
  }
230
232
 
231
233
  // The row revealed under the pointer: pins and the mode control while routing is on, and the one- or two-row choice.
@@ -268,7 +270,7 @@ export function renderBand({ Box, Text, Button }, config, view, usage, { columns
268
270
  flexDirection: 'column',
269
271
  children: [
270
272
  row(line),
271
- view.bandDetail && routing ? row(detailRow(config, view, usage, columns)) : null,
273
+ view.bandDetail && routing ? row(sessionRow(config, view, columns)) : null,
272
274
  Box({
273
275
  display: 'none',
274
276
  hover: { display: 'flex' },
package/lib/display.mjs CHANGED
@@ -47,6 +47,17 @@ export const switchCount = (routes) =>
47
47
 
48
48
  export const percent = (value) => `${Math.round(value * 100)}%`;
49
49
 
50
+ // Two shares that are compared, such as a classifier's support and the bar it must clear: whole percents, or as many
51
+ // decimals (up to two) as it takes for unequal values not to read as equal, "81.0%" against "81.4%".
52
+ export function percentPair(a, b) {
53
+ const at = (digits) => [a, b].map((value) => `${(value * 100).toFixed(digits)}%`);
54
+ for (const digits of [0, 1]) {
55
+ const pair = at(digits);
56
+ if (a === b || pair[0] !== pair[1]) return pair;
57
+ }
58
+ return at(2);
59
+ }
60
+
50
61
  export const REASONS = {
51
62
  ready: 'ready for the next turn',
52
63
  'same-tier': 'the task fits the current tier',
package/lib/panel.mjs CHANGED
@@ -30,6 +30,7 @@ import {
30
30
  missingText,
31
31
  modelName,
32
32
  percent,
33
+ percentPair,
33
34
  probeText,
34
35
  routeLabel,
35
36
  routeName,
@@ -47,7 +48,15 @@ import {
47
48
  yourModel,
48
49
  } from './display.mjs';
49
50
  import { cellForModel, isSameModel } from './route.mjs';
50
- import { EARLY_REPLIES, emptyTotals, modelSpec, readout, readSavingsStore } from './savings.mjs';
51
+ import {
52
+ EARLY_REPLIES,
53
+ emptyTotals,
54
+ modelAlias,
55
+ modelEntry,
56
+ modelSpec,
57
+ readout,
58
+ readSavingsStore,
59
+ } from './savings.mjs';
51
60
 
52
61
  const TABS = [
53
62
  ['now', '1', 'Now'],
@@ -264,10 +273,11 @@ function nowTab(ui, config, view, usage, actions) {
264
273
  const [direction, mass] = Number.isFinite(estimate.upgradeMass)
265
274
  ? ['up', estimate.upgradeMass]
266
275
  : ['down', estimate.downgradeMass];
276
+ const [bar, gave] = percentPair(estimate.threshold, Number.isFinite(mass) ? mass : estimate.threshold);
267
277
  out.push(
268
278
  ui.dim(
269
- ` switch needs ${percent(estimate.threshold)} · ${label} gave ${Number.isFinite(mass) ? percent(mass) : '—'} ${direction}` +
270
- `${Number.isFinite(estimate.taxUsd) ? ` · tax ≈ $${estimate.taxUsd.toFixed(2)}` : ''}`,
279
+ ` switch needs ${bar} · ${label} gave ${Number.isFinite(mass) ? gave : '—'} ${direction}` +
280
+ `${Number.isFinite(estimate.taxUsd) ? ` · switch cost ≈ ${usd(estimate.taxUsd)}` : ''}`,
271
281
  ),
272
282
  );
273
283
  }
@@ -292,7 +302,7 @@ function nowTab(ui, config, view, usage, actions) {
292
302
  ui.line(
293
303
  `Cost ${dollars(metrics.cost)} `,
294
304
  ui.dim('by Claude'),
295
- Number.isFinite(metrics.cacheBenefit) ? ` · cache saved ≈ $${metrics.cacheBenefit.toFixed(2)}` : '',
305
+ Number.isFinite(metrics.cacheBenefit) ? ` · cache hits saved ≈ ${usd(metrics.cacheBenefit)}` : '',
296
306
  ),
297
307
  );
298
308
  return out;
@@ -1026,6 +1036,24 @@ function savingsDetail(ui, config, view, { totals, session, across, row, tier, n
1026
1036
  return out;
1027
1037
  }
1028
1038
 
1039
+ // This session against each other priced model as yours, those past "too early", in router.json order:
1040
+ // "Opus 5.5 saved $6.20 · Haiku 5.5 extra $1.10". Null when there is none.
1041
+ function otherModels(config, view) {
1042
+ const current = modelAlias(config, view.nativeModel);
1043
+ const parts = Object.keys(config.models)
1044
+ .filter((alias) => alias !== current && modelEntry(view.savingsBy, alias))
1045
+ .map((alias) => [modelName(config.models[alias].id), readout(modelEntry(view.savingsBy, alias))])
1046
+ .filter(([, r]) => !r.early)
1047
+ .map(([name, r]) =>
1048
+ r.differenceUsd < 0
1049
+ ? `${name} saved ${usd(r.differenceUsd)}`
1050
+ : r.differenceUsd > 0
1051
+ ? `${name} extra ${usd(r.differenceUsd)}`
1052
+ : `${name} same cost`,
1053
+ );
1054
+ return parts.length ? parts.join(' · ') : null;
1055
+ }
1056
+
1029
1057
  // The tier whose route is your model at your effort, for its color; else any tier on your model.
1030
1058
  function yourTier(config, view) {
1031
1059
  const runs = (tier) => {
@@ -1110,6 +1138,8 @@ function savingsSection(ui, config, view, columns) {
1110
1138
  );
1111
1139
  return [...out, ...notes()];
1112
1140
  }
1141
+ const others = otherModels(config, view);
1142
+ if (others) out.push(...dimLines(ui, ` vs other models: ${others}`, columns));
1113
1143
  out.push(...savingsDetail(ui, config, view, { totals, session, across, row, tier, narrow, columns }));
1114
1144
  return [...out, ...notes()];
1115
1145
  }
@@ -1149,8 +1179,8 @@ function usageTab(ui, config, view, usage, actions, _modelOptions, columns) {
1149
1179
  ...activityUsage(ui, config, view, actions, columns),
1150
1180
  ui.text(' '),
1151
1181
  ui.head('ESTIMATES · configured list prices'),
1152
- ui.text(`Cache read benefit ${dollars(metrics.cacheBenefit)}`),
1153
- Number.isFinite(view.estimate?.taxUsd) ? ui.text(`Switch tax ${dollars(view.estimate.taxUsd)}`) : null,
1182
+ ui.text(`Cache hits saved ${dollars(metrics.cacheBenefit)}`),
1183
+ Number.isFinite(view.estimate?.taxUsd) ? ui.text(`Switch cost ${dollars(view.estimate.taxUsd)}`) : null,
1154
1184
  ...(view.comparison
1155
1185
  ? [
1156
1186
  ui.text(`Compared tiers ${view.comparison.incumbent} → ${view.comparison.candidate}`),
package/lib/route.mjs CHANGED
@@ -53,8 +53,9 @@ export function emptyLoop(config, model) {
53
53
  turnId: null,
54
54
  decision: null,
55
55
  ineligible: [],
56
- // Your model's simulated cache for the routing-vs-your-model readout (compareReply in savings.mjs).
57
- yours: null,
56
+ // Each configured model's simulated cache, by models key, for the routing-vs-your-model readout (compareModels in
57
+ // savings.mjs).
58
+ yoursBy: {},
58
59
  };
59
60
  }
60
61
 
@@ -71,7 +72,7 @@ export function resetHistory(loop) {
71
72
  would: loop.would ? { ...loop.would, state: freshState(loop.would.state) } : null,
72
73
  // The active turn keeps its route, pin and fallback suspension; the next turn decides afresh.
73
74
  ineligible: [],
74
- yours: null,
75
+ yoursBy: {},
75
76
  };
76
77
  }
77
78
 
package/lib/savings.mjs CHANGED
@@ -25,6 +25,17 @@ export function modelSpec(config, id) {
25
25
  return Object.values(config.models).find((model) => isSameModel(model.id, bare) || dated(model)) ?? null;
26
26
  }
27
27
 
28
+ // A by-model record's own entry for a models key, else undefined: router.json may name a model `toString`, which a
29
+ // plain object would otherwise answer from its prototype, or `null`, which a missing alias would coerce to.
30
+ export const modelEntry = (byModel, alias) =>
31
+ typeof alias === 'string' && byModel && Object.hasOwn(byModel, alias) ? byModel[alias] : undefined;
32
+
33
+ // The router.json models key (`opus`) of the entry an API model id runs on, or null.
34
+ export function modelAlias(config, id) {
35
+ const spec = modelSpec(config, id);
36
+ return spec ? (Object.keys(config.models).find((alias) => config.models[alias] === spec) ?? null) : null;
37
+ }
38
+
28
39
  // One request's list price in USD: `counts` are its uncached input, cache read, cache write and output tokens, the
29
40
  // writes at `writeMultiplier` times input. Long-context rates follow the whole prompt.
30
41
  export function requestUsd(model, { input, cacheRead, cacheWrite, output }, writeMultiplier) {
@@ -116,6 +127,34 @@ export function compareReply(config, state, { usage, served, yours, ttl, now })
116
127
  };
117
128
  }
118
129
 
130
+ // One main reply against every configured model as yours, at your effort, so the session readout can follow a
131
+ // `/model` change without replaying the session: `states` and `replies` by models key, each as compareReply returns,
132
+ // and `reply`, the prices against `yours`, the API model id /model selects now, or null.
133
+ export function compareModels(config, states, { usage, served, effort, ttl, now, yours }) {
134
+ const out = { states: {}, replies: {}, reply: null };
135
+ for (const [alias, model] of Object.entries(config.models)) {
136
+ const { state, reply } = compareReply(config, modelEntry(states, alias) ?? null, {
137
+ usage,
138
+ served,
139
+ yours: { model: model.id, effort },
140
+ ttl,
141
+ now,
142
+ });
143
+ out.states[alias] = state;
144
+ if (reply) out.replies[alias] = reply;
145
+ }
146
+ out.reply = modelEntry(out.replies, modelAlias(config, yours)) ?? null;
147
+ return out;
148
+ }
149
+
150
+ // Each model's session totals with this reply's prices added; models without a price for it keep theirs.
151
+ export function addReplies(byModel, replies, tier) {
152
+ const next = { ...byModel };
153
+ for (const [alias, reply] of Object.entries(replies))
154
+ next[alias] = addReply(modelEntry(next, alias) ?? emptyTotals(), reply, tier);
155
+ return next;
156
+ }
157
+
119
158
  const SUMS = ['routedUsd', 'yoursUsd', 'cheaperUsd', 'strongerUsd', 'switchUsd'];
120
159
 
121
160
  // A session's totals: replies, the five sums, and per tier (`none`: not chosen by routing) the replies and their
package/lib/view.mjs CHANGED
@@ -44,6 +44,8 @@ export function initialView(model) {
44
44
  activityStore: null,
45
45
  activityMetrics: null,
46
46
  // Routing vs your model: this session's totals and the totals kept across sessions as last read or written.
47
+ // Routing vs each configured model this session, by models key; `savings` is the one /model selects now.
48
+ savingsBy: {},
47
49
  savings: null,
48
50
  savingsStore: null,
49
51
  configPath: null,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alexeiled/claude-router",
3
- "version": "1.7.3",
3
+ "version": "1.8.0",
4
4
  "description": "Native Claude Code Mod: model and effort routing for the main conversation, advised by Jev, Clef, Clef Flash, OpenAI or Ollama.",
5
5
  "license": "MIT",
6
6
  "author": "Alexei Ledenev",