@alexeiled/claude-router 1.7.4 → 1.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +1 -1
- package/CHANGELOG.md +16 -0
- package/docs/activity-routing.md +1 -1
- package/docs/architecture.md +1 -1
- package/docs/evaluation.md +3 -3
- package/docs/native-router.md +2 -2
- package/docs/router-band.svg +68 -87
- package/docs/router-pane-now.svg +2 -2
- package/docs/router-pane-usage.svg +98 -97
- package/docs/user-guide.md +11 -10
- package/hooks/native-router.mjs +25 -14
- package/lib/band.mjs +66 -52
- package/lib/display.mjs +24 -1
- package/lib/panel.mjs +36 -6
- package/lib/route.mjs +4 -3
- package/lib/savings.mjs +39 -0
- package/lib/view.mjs +2 -0
- package/package.json +1 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 657
|
|
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="
|
|
9
|
-
<rect x="10" y="10" width="637" height="
|
|
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">
|
|
42
|
-
<text x="
|
|
43
|
-
<text x="
|
|
44
|
-
<text x="
|
|
45
|
-
<text x="
|
|
46
|
-
<text x="
|
|
47
|
-
<text x="
|
|
48
|
-
<text x="
|
|
49
|
-
<text x="
|
|
50
|
-
<text x="
|
|
51
|
-
<text x="
|
|
52
|
-
<text x="
|
|
53
|
-
<text x="
|
|
54
|
-
<text x="
|
|
55
|
-
<text x="
|
|
56
|
-
<text x="
|
|
57
|
-
<text x="
|
|
58
|
-
<text x="
|
|
59
|
-
<text x="
|
|
60
|
-
<text x="
|
|
61
|
-
<text x="
|
|
62
|
-
<text x="
|
|
63
|
-
<text x="
|
|
64
|
-
<text x="
|
|
65
|
-
<text x="
|
|
66
|
-
<text x="
|
|
67
|
-
<text x="
|
|
68
|
-
<text x="
|
|
69
|
-
<text x="24.0" y="357" fill="#7c7c7c" xml:space="preserve">
|
|
70
|
-
<text x="24.0" y="376" fill="#7c7c7c" xml:space="preserve">
|
|
71
|
-
<text x="24.0" y="
|
|
72
|
-
<text x="24.0" y="433" fill="#
|
|
73
|
-
<text x="
|
|
74
|
-
<text x="
|
|
75
|
-
<text x="24.0" y="471" fill="#
|
|
76
|
-
<text x="24.0" y="490" fill="#
|
|
77
|
-
<text x="24.0" y="509" fill="#
|
|
78
|
-
<text x="24.0" y="528" fill="#
|
|
79
|
-
<text x="24.0" y="
|
|
80
|
-
<text x="
|
|
81
|
-
<text x="
|
|
82
|
-
<text x="
|
|
83
|
-
<text x="
|
|
84
|
-
<text x="
|
|
85
|
-
<text x="
|
|
86
|
-
<text x="
|
|
87
|
-
<text x="
|
|
88
|
-
<text x="
|
|
89
|
-
<text x="
|
|
90
|
-
<text x="
|
|
91
|
-
<text x="
|
|
92
|
-
<text x="
|
|
93
|
-
<text x="
|
|
94
|
-
<text x="
|
|
95
|
-
<text x="
|
|
96
|
-
<text x="
|
|
97
|
-
<text x="
|
|
98
|
-
<text x="
|
|
99
|
-
<text x="
|
|
100
|
-
<text x="
|
|
101
|
-
<text x="
|
|
102
|
-
<text x="24.0" y="623" fill="#87d787" xml:space="preserve">
|
|
103
|
-
<text x="24.0" y="
|
|
104
|
-
<text x="
|
|
105
|
-
<text x="
|
|
106
|
-
<text x="24.0" y="699" fill="#
|
|
107
|
-
<text x="
|
|
108
|
-
<text x="
|
|
109
|
-
<text x="
|
|
110
|
-
<text x="
|
|
111
|
-
<text x="
|
|
112
|
-
<text x="
|
|
113
|
-
<text x="
|
|
114
|
-
<text x="
|
|
115
|
-
<text x="
|
|
116
|
-
<text x="24.0" y="775" fill="#d0d0d0" xml:space="preserve">
|
|
117
|
-
<text x="24.0" y="
|
|
118
|
-
<text x="24.0" y="832" fill="#
|
|
119
|
-
<text x="24.0" y="851" fill="#d0d0d0" xml:space="preserve">
|
|
120
|
-
<text x="24.0" y="870" fill="#d0d0d0" xml:space="preserve">
|
|
121
|
-
<text x="24.0" y="889" fill="#d0d0d0" xml:space="preserve">
|
|
122
|
-
<text x="24.0" y="908" fill="#d0d0d0" xml:space="preserve">
|
|
123
|
-
<text x="24.0" y="927" fill="#d0d0d0" xml:space="preserve">
|
|
124
|
-
<text x="24.0" y="946" fill="#d0d0d0" xml:space="preserve">
|
|
125
|
-
<
|
|
126
|
-
<
|
|
127
|
-
<text x="
|
|
128
|
-
<text x="
|
|
129
|
-
<text x="24.0" y="1022" fill="#
|
|
130
|
-
<text x="24.0" y="1041" fill="#d0d0d0" xml:space="preserve">
|
|
131
|
-
<text x="24.0" y="1060" fill="#
|
|
132
|
-
<
|
|
133
|
-
<
|
|
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>
|
package/docs/user-guide.md
CHANGED
|
@@ -37,10 +37,11 @@ Router draws one line above the prompt. The line ends with a **Router** button t
|
|
|
37
37
|
Read the first line of the picture from left to right:
|
|
38
38
|
|
|
39
39
|
- **Tier meter** `▂▄▆█`: one bar per tier, lit up to the current tier in its color, like signal strength.
|
|
40
|
-
- **Tier, activity, and model**: the route for this turn. The activity, such as `
|
|
41
|
-
- **Reason**: one or two words with a direction, such as `↑ jump`, `↓ downgrade`, `= fits`, or `… waiting to go down`. An activity move reads `↗
|
|
42
|
-
- **Classifier support**: what the active classifier, such as Jev or Clef Flash, gave the switch against the bar the policy required.
|
|
43
|
-
- **
|
|
40
|
+
- **Tier, activity, and model**: the route for this turn. The activity sits between the tier and the model as a verb in orange italic, such as `coding →`: `coding`, `debugging`, `exploring`, `planning`, `reviewing`, `running` (commands: git, builds, tests, CI) or `documenting`. See [Route by activity](#route-by-activity). **fallback** means Claude Code answered with another model.
|
|
41
|
+
- **Reason**: one or two words with a direction, such as `↑ jump`, `↓ downgrade`, `= fits`, or `… waiting to go down`. An activity move reads `↗ coding` or `↘ running`, and a refused one `… running: 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, 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
|
|
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
|

|
|
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
|
|
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
|

|
|
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
|

|
|
96
97
|
|
|
97
|
-
**ROUTING VS YOUR MODEL** opens the Usage tab. Your model is the model
|
|
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
|
|
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
|
|
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
|
|
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
|
|
package/hooks/native-router.mjs
CHANGED
|
@@ -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
|
-
|
|
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.
|
|
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.
|
|
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
|
|
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
|
|
651
|
-
//
|
|
652
|
-
// counted; any other failure leaves the loop's
|
|
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
|
|
665
|
+
return compareModels(cfg, loop.yoursBy ?? {}, {
|
|
658
666
|
usage: response.usage,
|
|
659
667
|
served: { model: response.usage.model, effort: servedEffort },
|
|
660
|
-
|
|
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
|
|
670
|
-
|
|
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
|
-
|
|
674
|
-
|
|
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
|
|
|
@@ -956,7 +967,7 @@ function paneActions($, router, view) {
|
|
|
956
967
|
const [stats, records] = await Promise.all([clear(STORE_KEY, emptyStore()), clearRecords().catch(() => false)]);
|
|
957
968
|
await updateView($, router, {
|
|
958
969
|
activityStats: null,
|
|
959
|
-
|
|
970
|
+
savingsBy: {},
|
|
960
971
|
...(stats ? { activityStore: emptyStore() } : {}),
|
|
961
972
|
...(records ? { activityMetrics: emptyMetrics(), savingsStore: emptySavingsStore() } : {}),
|
|
962
973
|
notice:
|