@alexeiled/claude-router 1.2.0 → 1.3.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 +21 -0
- package/README.md +2 -2
- package/docs/architecture.md +2 -2
- package/docs/configuration.md +6 -6
- package/docs/native-router.md +5 -5
- package/docs/router-pane-classifier.svg +45 -0
- package/docs/router-pane-now.svg +7 -6
- package/docs/router-pane-routing.svg +81 -0
- package/docs/user-guide.md +30 -21
- package/hooks/native-router.mjs +149 -46
- package/lib/config.mjs +19 -11
- package/lib/native-panel.mjs +118 -106
- package/package.json +1 -1
- package/types/index.d.ts +3 -3
- package/docs/router-pane-tiers.svg +0 -62
- package/docs/router-pane-tuning.svg +0 -58
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "router",
|
|
3
3
|
"displayName": "Router",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.3.1",
|
|
5
5
|
"description": "Model and effort routing for the main conversation, advised by a prompt classifier (Jev, Clef or Clef Flash). Preserves subagent model choices.",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Alexei Ledenev",
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.3.1 (2026-10-08)
|
|
4
|
+
|
|
5
|
+
### Changed
|
|
6
|
+
|
|
7
|
+
- `micro` is now Haiku 5.5 at `low` effort (was Haiku 4.5 with no effort setting). The `haiku` alias is `claude-haiku-5-5` with a 1,000,000-token window, all five effort levels, and list prices of 0.1 / 0.5 / 0.01 USD per million tokens. Those prices hold for prompts up to 100,000 tokens and are higher above, so estimates run low there.
|
|
8
|
+
- To keep Haiku 4.5, set `models.haiku` to `claude-haiku-4-5` with `"efforts": []`, a 200,000-token window, and 1 / 5 / 0.1 prices, and set `routes.micro.effort` to `null`.
|
|
9
|
+
|
|
10
|
+
## 1.3.0 (2026-10-06)
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
|
|
14
|
+
- The pane's settings follow one rule per tab. **Routing** (was Tiers, now with the policy controls) edits routes and policy as one draft with one **Save** (`s`) and **Discard** (`d`). **Classifier** (was the classifier part of Tuning) writes a row or a deadline at once.
|
|
15
|
+
- Unsaved routing changes show on every tab: the tab reads **Routing ●**, and the status bar lists the `router.json` lines **Save** will write. The draft stays when you change tab or close the pane, and a new session drops it.
|
|
16
|
+
- **Undo** (`u`) puts back the settings the last pane write changed, from any tab: a classifier, a deadline, or a routing save. It writes back what `router.json` held before that write, so a hand edit elsewhere in the file stays. It no longer goes away when you change tab.
|
|
17
|
+
- **Reset policy to defaults** joins **Reset routes to defaults**. A policy value equal to its default is removed from `router.json`, as routes and deadlines already were.
|
|
18
|
+
- Notices sit in the status bar: green for a write or an undo, red for a refused write. In Manual the pin buttons give way to "Pins need Auto". **Manual: keep /model** is now **Manual**.
|
|
19
|
+
|
|
20
|
+
### Fixed
|
|
21
|
+
|
|
22
|
+
- The pane opened with the notice from the last press before it was closed. It now opens without one; the last write keeps its **Undo**.
|
|
23
|
+
|
|
3
24
|
## 1.2.0 (2026-10-05)
|
|
4
25
|
|
|
5
26
|
### Added
|
package/README.md
CHANGED
|
@@ -40,7 +40,7 @@ The active classifier labels a new logical turn once. Tool continuations keep th
|
|
|
40
40
|
|
|
41
41
|
| Tier | Default model | Effort |
|
|
42
42
|
| -------- | ------------- | ------------------------ |
|
|
43
|
-
| `micro` | Haiku
|
|
43
|
+
| `micro` | Haiku 5.5 | `low` |
|
|
44
44
|
| `low` | Sonnet 5.5 | Keeps the session effort |
|
|
45
45
|
| `medium` | Opus 5.5 | `medium` |
|
|
46
46
|
| `high` | Opus 5.5 | `xhigh` |
|
|
@@ -56,7 +56,7 @@ claude plugin marketplace add alexei-led/claude-router
|
|
|
56
56
|
claude plugin install router@alexei-led-claude-router
|
|
57
57
|
```
|
|
58
58
|
|
|
59
|
-
Start Claude Code on the full baseline model, for example `claude --model claude-sonnet-5-5`. Run `/plugin configure router` and save the key. For Clef or Clef Flash, save the Cloudflare token and account ID, then pick the classifier on the pane's
|
|
59
|
+
Start Claude Code on the full baseline model, for example `claude --model claude-sonnet-5-5`. Run `/plugin configure router` and save the key. For Clef or Clef Flash, save the Cloudflare token and account ID, then pick the classifier on the pane's Classifier tab. A session on the baseline model starts in Auto; on another model it starts in Manual, and `/router auto` turns routing on.
|
|
60
60
|
|
|
61
61
|
Claude Code updates the plugin at startup when auto-update is on for this marketplace. Otherwise run `claude plugin marketplace update alexei-led-claude-router`, then `claude plugin update router@alexei-led-claude-router`.
|
|
62
62
|
|
package/docs/architecture.md
CHANGED
|
@@ -34,7 +34,7 @@ The active classifier receives only the current prompt and up to six recent user
|
|
|
34
34
|
|
|
35
35
|
All classifiers share one wire contract: the same `state` and typed `questions` request, and the same `answers.route` choice with per-tier probabilities. Cloudflare's REST API wraps the answer in `{ result, success, errors }`, which the parser unwraps.
|
|
36
36
|
|
|
37
|
-
Claude Code builds each request for the model the Mod selects, so no request rewriting is needed: Haiku
|
|
37
|
+
Claude Code builds each request for the model the Mod selects, so no request rewriting is needed: Haiku 4.5 got its own thinking mode and a 32K output cap. On Claude Code 2.1.289, a billed chain of pinned turns (Opus, Haiku 4.5, Sonnet at `xhigh`, Sonnet, Haiku 4.5) used a tool on every turn over the previous models' history, and no request was rejected. Sonnet and Opus accepted histories above 589K input tokens. These checks cover tested requests. They do not prove every Claude Code feature combination.
|
|
38
38
|
|
|
39
39
|
## Responsibilities
|
|
40
40
|
|
|
@@ -78,7 +78,7 @@ In a 20-process loopback test, timeout fallback had 1,504 ms p95 and 1,505 ms wo
|
|
|
78
78
|
|
|
79
79
|
## Cache and cost
|
|
80
80
|
|
|
81
|
-
Cache identity uses the exact response model ID and effective effort. The
|
|
81
|
+
Cache identity uses the exact response model ID and effective effort. The Haiku 4.5 dated snapshot has an explicit mapping; Haiku 5.5 has no dated ID. An unrecognized substituted model gets no cache credit for the requested route.
|
|
82
82
|
|
|
83
83
|
The cached prefix is observed `cache_read + cache_creation`. Output tokens count only toward the next context size. Freshness uses the configured five-minute lifetime with its safety margin. Claude's usage counters do not prove one-hour cache lifetime.
|
|
84
84
|
|
package/docs/configuration.md
CHANGED
|
@@ -9,7 +9,7 @@ The router works with its built-in defaults. Configure the key of the active cla
|
|
|
9
9
|
| Jev API key | Sensitive plugin option `typesafe_api_key` | Run `/plugin configure router`, or use **Set up** or **Credentials → Edit** in the router pane. |
|
|
10
10
|
| Cloudflare API token | Sensitive plugin option `cloudflare_api_token` | The same dialog. Used by Clef and Clef Flash. |
|
|
11
11
|
| Cloudflare account ID | Plugin option `cloudflare_account_id` | The same dialog, or the config menu row. Not a secret. |
|
|
12
|
-
| Router settings and classifier | `router.json` in the active Claude Code profile | Edit the file directly, or use the pane's
|
|
12
|
+
| Router settings and classifier | `router.json` in the active Claude Code profile | Edit the file directly, or use the pane's Routing and Classifier tabs. |
|
|
13
13
|
| Anthropic credentials and API cost | Claude Code | The Mod leaves these to Claude Code. |
|
|
14
14
|
|
|
15
15
|
The active profile directory is `CLAUDE_CONFIG_DIR` when set. Otherwise it is `~/.claude`. The Mod does not need an Anthropic proxy URL, model alias, hint header, daemon, or custom status line.
|
|
@@ -32,7 +32,7 @@ The default baseline is tier `low`. Each route refers to an alias in `models`.
|
|
|
32
32
|
|
|
33
33
|
| Tier | Model alias | Model ID | Effort |
|
|
34
34
|
| -------- | ----------- | ------------------- | ------------------------------------ |
|
|
35
|
-
| `micro` | `haiku` | `claude-haiku-
|
|
35
|
+
| `micro` | `haiku` | `claude-haiku-5-5` | `low` |
|
|
36
36
|
| `low` | `sonnet` | `claude-sonnet-5-5` | Keeps the effort sent by Claude Code |
|
|
37
37
|
| `medium` | `opus` | `claude-opus-5-5` | `medium` |
|
|
38
38
|
| `high` | `opus` | `claude-opus-5-5` | `xhigh` |
|
|
@@ -43,9 +43,9 @@ Default model settings:
|
|
|
43
43
|
| -------- | --------------------------------------------------- | -------------- | ------- | --------------------------------------- |
|
|
44
44
|
| `opus` | 4 / 20 / 0.2 | 1,000,000 | `plan` | `low`, `medium`, `high`, `xhigh`, `max` |
|
|
45
45
|
| `sonnet` | 2 / 10 / 0.2 | 1,000,000 | `plan` | `low`, `medium`, `high`, `xhigh`, `max` |
|
|
46
|
-
| `haiku` | 1 / 5 / 0.
|
|
46
|
+
| `haiku` | 0.1 / 0.5 / 0.01 | 1,000,000 | `plan` | `low`, `medium`, `high`, `xhigh`, `max` |
|
|
47
47
|
|
|
48
|
-
Prices are configured list-price inputs for estimates. They are not a subscription bill or a claim of savings. Haiku receives no effort field. A route without an effort keeps the session effort, clamped to what the model supports. To make a tier whose default names an effort keep the session effort instead, set `"effort": null`, for example `"routes": { "high": { "model": "opus", "effort": null } }`.
|
|
48
|
+
Prices are configured list-price inputs for estimates. They are not a subscription bill or a claim of savings. Haiku 5.5 prices are for prompts up to 100,000 tokens; above that Anthropic charges more, so estimates run low there. A model with `"efforts": []` receives no effort field. A route without an effort keeps the session effort, clamped to what the model supports. To make a tier whose default names an effort keep the session effort instead, set `"effort": null`, for example `"routes": { "high": { "model": "opus", "effort": null } }`.
|
|
49
49
|
|
|
50
50
|
## Classifiers
|
|
51
51
|
|
|
@@ -57,7 +57,7 @@ Prices are configured list-price inputs for estimates. They are not a subscripti
|
|
|
57
57
|
| `clef` | `https://api.cloudflare.com/client/v4/accounts/{cloudflare_account_id}/ai/run/@cf/cloudflare/clef` | `clef` | `cloudflare_api_token` | `3000` |
|
|
58
58
|
| `clef-flash` | `https://api.cloudflare.com/client/v4/accounts/{cloudflare_account_id}/ai/run/@cf/cloudflare/clef-flash` | `clef-flash` | `cloudflare_api_token` | `3000` |
|
|
59
59
|
|
|
60
|
-
`jev` is the default. Select another one with a row
|
|
60
|
+
`jev` is the default. Select another one with a row on the pane's **Classifier** tab, or in `router.json`:
|
|
61
61
|
|
|
62
62
|
```json
|
|
63
63
|
{ "classifier": "clef-flash" }
|
|
@@ -128,7 +128,7 @@ Policy defaults:
|
|
|
128
128
|
| `escalationHoldTurns` | `2` | Turns held after a repeated tool error escalates the route. |
|
|
129
129
|
| `cashCapUsd` | `2` | Maximum estimated cold cache write for a `credits` model. It does not cap output or session spend. |
|
|
130
130
|
|
|
131
|
-
The pane writes a subset of these settings. The **
|
|
131
|
+
The pane writes a subset of these settings. The **Routing** tab sets `routes`, `baselineTier`, `policy.downgradeVotes`, `policy.downgradeHorizonTurns`, and `policy.cashCapUsd` in one save: it writes only values that differ from the defaults and removes the rest. The **Classifier** tab sets `classifier` and the active classifier's `timeoutMs` at once. **Undo** reverts the settings the last pane write changed. Each save validates the whole file, keeps other keys, and applies from the next turn. A failed check names the setting and leaves the file unchanged. The pane refuses to write through a symlink. Model aliases and the other settings require a direct edit.
|
|
132
132
|
|
|
133
133
|
Native cache freshness is unknown after 270 seconds or after a history reset. Claude usage does not report the cache TTL. The policy evaluates price bounds for five-minute and one-hour writes, but the one-hour case is not observed fact. See the [architecture](architecture.md#cache-and-cost) for the estimate rules.
|
|
134
134
|
|
package/docs/native-router.md
CHANGED
|
@@ -26,7 +26,7 @@ Mode belongs to a Claude Code session. Clear starts a new session in Auto. Resum
|
|
|
26
26
|
|
|
27
27
|
## Router pane
|
|
28
28
|
|
|
29
|
-
The status band is one line above the prompt: a tier meter, the route, a short reason, classifier support, and context and cache use. Segments drop by priority when the band is narrow. Hovering reveals pins, Manual, and a two-row view. The band yields to surveys and does not describe subagent transcripts. A model change between turns raises a toast. A pin, or a step that changes only the effort, such as `medium` to `high` on the defaults, raises none. While the classifier runs, the turn's spinner says `Choosing model`. In Manual mode or when routing is unavailable, the prompt footer carries `router off` or `router unavailable`. The **Router** button opens the pane. The pane has four tabs, Now,
|
|
29
|
+
The status band is one line above the prompt: a tier meter, the route, a short reason, classifier support, and context and cache use. Segments drop by priority when the band is narrow. Hovering reveals pins, Manual, and a two-row view. The band yields to surveys and does not describe subagent transcripts. A model change between turns raises a toast. A pin, or a step that changes only the effort, such as `medium` to `high` on the defaults, raises none. While the classifier runs, the turn's spinner says `Choosing model`. In Manual mode or when routing is unavailable, the prompt footer carries `router off` or `router unavailable`. The **Router** button opens the pane. The pane has four tabs, Now, Routing, Classifier, and Usage, with Auto and Manual on every tab. The [user guide](user-guide.md#open-the-router-pane) describes each tab.
|
|
30
30
|
|
|
31
31
|
| Reading | Meaning and limits |
|
|
32
32
|
| ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- |
|
|
@@ -46,9 +46,9 @@ The status band is one line above the prompt: a tier meter, the route, a short r
|
|
|
46
46
|
|
|
47
47
|
There is no router-owned cost ledger or cumulative savings counter. Classifier charges are not included. See [Evaluation](evaluation.md) for what the available trace can support.
|
|
48
48
|
|
|
49
|
-
##
|
|
49
|
+
## Routing and classifier settings
|
|
50
50
|
|
|
51
|
-
The
|
|
51
|
+
The Routing tab edits each tier's model alias and effort, the baseline tier, and three policy controls as one draft. The draft does not affect the active turn, survives a tab change or closing the pane, and is dropped at a new session. **Save** validates the whole file with the same loader the Mod starts with, writes `router.json` for future turns, and keeps unrelated keys. A route or policy value equal to the built-in default is removed from the file, so later default changes still reach it. The Classifier tab writes the classifier choice and its deadline at once. **Undo** reverts the settings the last pane write changed, from any tab, until the next write or a new session.
|
|
52
52
|
|
|
53
53
|
| Control | Values in the pane | Effect |
|
|
54
54
|
| ---------------- | --------------------------- | ---------------------------------------------------------------------------------------- |
|
|
@@ -57,7 +57,7 @@ The Tiers tab edits each tier's model alias and effort and the baseline tier. Th
|
|
|
57
57
|
| Payback horizon | 1, 3, 5, 10 turns | Later turns included in downgrade economics. |
|
|
58
58
|
| Credits cap | $0.50, $1, $2, $5 | Largest estimated cold write on a `credits` model. |
|
|
59
59
|
|
|
60
|
-
The classifier section lists every configured classifier as a row with its service host and whether its key and endpoint settings are complete. Selecting a row writes `classifier` to `router.json` at once, or removes it for the default, through the same validation, and resets the new classifier's failure count. A turn already being classified finishes with its own classifier; its readings stay off the pane. **Undo** returns to the previous classifier
|
|
60
|
+
The classifier section lists every configured classifier as a row with its service host and whether its key and endpoint settings are complete. Selecting a row writes `classifier` to `router.json` at once, or removes it for the default, through the same validation, and resets the new classifier's failure count. A turn already being classified finishes with its own classifier; its readings stay off the pane. **Undo** returns to the previous classifier. The deadline saves at once too, and a built-in classifier's default deadline is written as no override. **Sends** names the host that receives prompt text.
|
|
61
61
|
|
|
62
62
|
The pane refuses to write through a symlink. A failed validation names the setting and leaves the file unchanged. New model aliases and the other supported fields need an edit to the active profile's `router.json`.
|
|
63
63
|
|
|
@@ -80,6 +80,6 @@ On 2026-10-05, live probes of Clef and Clef Flash on Workers AI took 0.7 to 1.3
|
|
|
80
80
|
|
|
81
81
|
Recorded acceptance checks cover the local HTTP deadline and one-request admission, session clear/resume, circuit-breaker pause, reload, replacement, unload, engine fallback, and interrupt during Jev advice. The interrupt check closed the loopback socket within 4 ms and discarded late advice without changing the active route or UI. Results are stored under [`experiments/mod-router/results`](../experiments/mod-router/results/).
|
|
82
82
|
|
|
83
|
-
A billed chain of pinned turns moved across Opus, Haiku, and Sonnet with a tool call on every turn, and no request was rejected. Claude Code builds each model's request itself; Haiku
|
|
83
|
+
A billed chain of pinned turns moved across Opus, Haiku 4.5, and Sonnet with a tool call on every turn, and no request was rejected. Claude Code builds each model's request itself; Haiku 4.5 received its own thinking mode and a 32K output cap. Haiku 5.5 was not probed. Sonnet and Opus accepted histories above 589K input tokens. These probes validate the tested path only. Claude Code and organization policy control other model and request combinations.
|
|
84
84
|
|
|
85
85
|
To stop routing in a session, run `/router off`. To stop loading the Mod, run `claude plugin disable router@alexei-led-claude-router` and restart.
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 626 363" role="img" aria-labelledby="title desc">
|
|
2
|
+
<title id="title">Router pane, Classifier tab</title>
|
|
3
|
+
<desc id="desc">The classifier rows with the active one marked, a missing Jev API key with Set up, the deadline, health, the receiving host and the credentials each classifier needs, and Undo after a switch.</desc>
|
|
4
|
+
<style>
|
|
5
|
+
text { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace; font-size: 13px; }
|
|
6
|
+
.cap { font-family: system-ui, -apple-system, 'Segoe UI', sans-serif; font-size: 12px; fill: #9a988f; }
|
|
7
|
+
</style>
|
|
8
|
+
<rect width="626" height="363" rx="8" fill="#1c1c1c"/>
|
|
9
|
+
<rect x="10" y="10" width="606" height="343" rx="6" fill="none" stroke="#3f5f8f"/>
|
|
10
|
+
<text x="24.0" y="34" fill="#5fafd7" font-weight="700" xml:space="preserve">ROUTER · Auto</text>
|
|
11
|
+
<text x="148.8" y="34" fill="#87d787" xml:space="preserve">Clef Flash ready</text>
|
|
12
|
+
<text x="24.0" y="53" fill="#87afff" font-weight="700" xml:space="preserve">[ Auto ]</text>
|
|
13
|
+
<text x="94.2" y="53" fill="#d0d0d0" xml:space="preserve">[ Manual ]</text>
|
|
14
|
+
<text x="172.2" y="53" fill="#7c7c7c" xml:space="preserve"> Manual keeps the /model choice</text>
|
|
15
|
+
<text x="24.0" y="72" fill="#d0d0d0" xml:space="preserve">[ Now ]</text>
|
|
16
|
+
<text x="86.4" y="72" fill="#d0d0d0" xml:space="preserve">[ Routing ]</text>
|
|
17
|
+
<text x="180.0" y="72" fill="#87afff" font-weight="700" xml:space="preserve">[ Classifier ]</text>
|
|
18
|
+
<text x="297.0" y="72" fill="#d0d0d0" xml:space="preserve">[ Usage ]</text>
|
|
19
|
+
<text x="375.0" y="72" fill="#d0d0d0" xml:space="preserve">[ ? ]</text>
|
|
20
|
+
<text x="24.0" y="110" fill="#5fafd7" font-weight="700" xml:space="preserve">CLASSIFIER</text>
|
|
21
|
+
<text x="102.0" y="110" fill="#7c7c7c" xml:space="preserve"> · applies next turn · saves at once</text>
|
|
22
|
+
<text x="24.0" y="129" fill="#7c7c7c" xml:space="preserve">Asked once per new turn.</text>
|
|
23
|
+
<text x="24.0" y="148" fill="#d0d0d0" xml:space="preserve">[ ○ Jev ]</text>
|
|
24
|
+
<text x="164.4" y="148" fill="#7c7c7c" xml:space="preserve">api.typesafe.ai</text>
|
|
25
|
+
<text x="320.4" y="148" fill="#d7af5f" xml:space="preserve">○ no API key </text>
|
|
26
|
+
<text x="429.6" y="148" fill="#d0d0d0" xml:space="preserve">[ Set up ]</text>
|
|
27
|
+
<text x="24.0" y="167" fill="#d0d0d0" xml:space="preserve">[ ○ Clef ]</text>
|
|
28
|
+
<text x="164.4" y="167" fill="#7c7c7c" xml:space="preserve">api.cloudflare.com</text>
|
|
29
|
+
<text x="320.4" y="167" fill="#87d787" xml:space="preserve">● ready</text>
|
|
30
|
+
<text x="24.0" y="186" fill="#87afff" font-weight="700" xml:space="preserve">[ ◉ Clef Flash ]</text>
|
|
31
|
+
<text x="164.4" y="186" fill="#7c7c7c" xml:space="preserve">api.cloudflare.com</text>
|
|
32
|
+
<text x="320.4" y="186" fill="#87d787" xml:space="preserve">● ready</text>
|
|
33
|
+
<text x="24.0" y="205" fill="#d0d0d0" xml:space="preserve">Deadline</text>
|
|
34
|
+
<text x="94.2" y="205" fill="#d0d0d0" xml:space="preserve">3000 ms ▾</text>
|
|
35
|
+
<text x="187.8" y="205" fill="#7c7c7c" xml:space="preserve">then keep the model</text>
|
|
36
|
+
<text x="24.0" y="224" fill="#d0d0d0" xml:space="preserve">Health active · 0 recent failures</text>
|
|
37
|
+
<text x="24.0" y="243" fill="#7c7c7c" xml:space="preserve">Sends prompt + 6 recent turns → api.cloudflare.com</text>
|
|
38
|
+
<text x="24.0" y="262" fill="#d0d0d0" xml:space="preserve">Credentials </text>
|
|
39
|
+
<text x="125.4" y="262" fill="#d0d0d0" xml:space="preserve">[ Edit ]</text>
|
|
40
|
+
<text x="187.8" y="262" fill="#7c7c7c" xml:space="preserve"> opens /plugin configure</text>
|
|
41
|
+
<text x="24.0" y="281" fill="#7c7c7c" xml:space="preserve"> Jev: API key · Clef, Clef Flash: API token, account ID</text>
|
|
42
|
+
<text x="24.0" y="319" fill="#87d787" xml:space="preserve">Saved: classifier Clef → Clef Flash. Applies from the next turn. </text>
|
|
43
|
+
<text x="538.8" y="319" fill="#d0d0d0" xml:space="preserve">[ Undo ]</text>
|
|
44
|
+
<text x="24.0" y="338" fill="#d0d0d0" xml:space="preserve">[ Close ]</text>
|
|
45
|
+
</svg>
|
package/docs/router-pane-now.svg
CHANGED
|
@@ -10,12 +10,13 @@
|
|
|
10
10
|
<text x="24.0" y="34" fill="#5fafd7" font-weight="700" xml:space="preserve">ROUTER · Auto</text>
|
|
11
11
|
<text x="148.8" y="34" fill="#87d787" xml:space="preserve">Jev ready · 347 ms</text>
|
|
12
12
|
<text x="24.0" y="53" fill="#87afff" font-weight="700" xml:space="preserve">[ Auto ]</text>
|
|
13
|
-
<text x="94.2" y="53" fill="#d0d0d0" xml:space="preserve">[ Manual
|
|
13
|
+
<text x="94.2" y="53" fill="#d0d0d0" xml:space="preserve">[ Manual ]</text>
|
|
14
|
+
<text x="172.2" y="53" fill="#7c7c7c" xml:space="preserve"> Manual keeps the /model choice</text>
|
|
14
15
|
<text x="24.0" y="72" fill="#87afff" font-weight="700" xml:space="preserve">[ Now ]</text>
|
|
15
|
-
<text x="86.4" y="72" fill="#d0d0d0" xml:space="preserve">[
|
|
16
|
-
<text x="
|
|
17
|
-
<text x="
|
|
18
|
-
<text x="
|
|
16
|
+
<text x="86.4" y="72" fill="#d0d0d0" xml:space="preserve">[ Routing ]</text>
|
|
17
|
+
<text x="180.0" y="72" fill="#d0d0d0" xml:space="preserve">[ Classifier ]</text>
|
|
18
|
+
<text x="297.0" y="72" fill="#d0d0d0" xml:space="preserve">[ Usage ]</text>
|
|
19
|
+
<text x="375.0" y="72" fill="#d0d0d0" xml:space="preserve">[ ? ]</text>
|
|
19
20
|
<text x="24.0" y="110" fill="#d0d0d0" xml:space="preserve">Now </text>
|
|
20
21
|
<text x="78.6" y="110" fill="#e0708a" font-weight="700" xml:space="preserve">▌high </text>
|
|
21
22
|
<text x="133.2" y="110" fill="#d0d0d0" xml:space="preserve">Opus 5.5 · xhigh</text>
|
|
@@ -40,7 +41,7 @@
|
|
|
40
41
|
<text x="351.6" y="243" fill="#d0d0d0" xml:space="preserve"> 3% </text>
|
|
41
42
|
<text x="406.2" y="243" fill="#d0d0d0" xml:space="preserve">[ pin ]</text>
|
|
42
43
|
<text x="39.6" y="262" fill="#5fd7af" font-weight="700" xml:space="preserve">micro </text>
|
|
43
|
-
<text x="102.0" y="262" fill="#d0d0d0" xml:space="preserve">Haiku
|
|
44
|
+
<text x="102.0" y="262" fill="#d0d0d0" xml:space="preserve">Haiku 5.5 · low </text>
|
|
44
45
|
<text x="273.6" y="262" fill="#5fd7af" xml:space="preserve">░░░░░░░░░░</text>
|
|
45
46
|
<text x="351.6" y="262" fill="#d0d0d0" xml:space="preserve"> 2% </text>
|
|
46
47
|
<text x="406.2" y="262" fill="#d0d0d0" xml:space="preserve">[ pin ]</text>
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 594 686" role="img" aria-labelledby="title desc">
|
|
2
|
+
<title id="title">Router pane, Routing tab</title>
|
|
3
|
+
<desc id="desc">Model and effort per tier with prices and windows, the baseline tier, how the policy prices each step up, the policy controls, and the unsaved router.json change with Save and Discard.</desc>
|
|
4
|
+
<style>
|
|
5
|
+
text { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace; font-size: 13px; }
|
|
6
|
+
.cap { font-family: system-ui, -apple-system, 'Segoe UI', sans-serif; font-size: 12px; fill: #9a988f; }
|
|
7
|
+
</style>
|
|
8
|
+
<rect width="594" height="686" rx="8" fill="#1c1c1c"/>
|
|
9
|
+
<rect x="10" y="10" width="574" height="666" rx="6" fill="none" stroke="#3f5f8f"/>
|
|
10
|
+
<text x="24.0" y="34" fill="#5fafd7" font-weight="700" xml:space="preserve">ROUTER · Auto</text>
|
|
11
|
+
<text x="148.8" y="34" fill="#87d787" xml:space="preserve">Jev ready · 347 ms</text>
|
|
12
|
+
<text x="24.0" y="53" fill="#87afff" font-weight="700" xml:space="preserve">[ Auto ]</text>
|
|
13
|
+
<text x="94.2" y="53" fill="#d0d0d0" xml:space="preserve">[ Manual ]</text>
|
|
14
|
+
<text x="172.2" y="53" fill="#7c7c7c" xml:space="preserve"> Manual keeps the /model choice</text>
|
|
15
|
+
<text x="24.0" y="72" fill="#d0d0d0" xml:space="preserve">[ Now ]</text>
|
|
16
|
+
<text x="86.4" y="72" fill="#87afff" font-weight="700" xml:space="preserve">[ Routing ● ]</text>
|
|
17
|
+
<text x="195.6" y="72" fill="#d0d0d0" xml:space="preserve">[ Classifier ]</text>
|
|
18
|
+
<text x="312.6" y="72" fill="#d0d0d0" xml:space="preserve">[ Usage ]</text>
|
|
19
|
+
<text x="390.6" y="72" fill="#d0d0d0" xml:space="preserve">[ ? ]</text>
|
|
20
|
+
<text x="24.0" y="110" fill="#5fafd7" font-weight="700" xml:space="preserve">ROUTES</text>
|
|
21
|
+
<text x="70.8" y="110" fill="#7c7c7c" xml:space="preserve"> · applies next turn · edit, then Save</text>
|
|
22
|
+
<text x="24.0" y="129" fill="#7c7c7c" xml:space="preserve">tier model effort $/M in · out window</text>
|
|
23
|
+
<text x="24.0" y="148" fill="#e0708a" font-weight="700" xml:space="preserve">high</text>
|
|
24
|
+
<text x="86.4" y="148" fill="#d0d0d0" xml:space="preserve">Opus 5.5 ▾</text>
|
|
25
|
+
<text x="195.6" y="148" fill="#d0d0d0" xml:space="preserve">xhigh ▾</text>
|
|
26
|
+
<text x="304.8" y="148" fill="#d0d0d0" xml:space="preserve">4 · 20</text>
|
|
27
|
+
<text x="414.0" y="148" fill="#d0d0d0" xml:space="preserve">1M</text>
|
|
28
|
+
<text x="24.0" y="167" fill="#d7af5f" font-weight="700" xml:space="preserve">medium</text>
|
|
29
|
+
<text x="86.4" y="167" fill="#d0d0d0" xml:space="preserve">Sonnet 5.5 ▾</text>
|
|
30
|
+
<text x="195.6" y="167" fill="#d0d0d0" xml:space="preserve">xhigh ▾</text>
|
|
31
|
+
<text x="289.2" y="167" fill="#d7af5f" xml:space="preserve">●</text>
|
|
32
|
+
<text x="304.8" y="167" fill="#d0d0d0" xml:space="preserve">2 · 10</text>
|
|
33
|
+
<text x="414.0" y="167" fill="#d0d0d0" xml:space="preserve">1M</text>
|
|
34
|
+
<text x="24.0" y="186" fill="#5f9fe0" font-weight="700" xml:space="preserve">low</text>
|
|
35
|
+
<text x="86.4" y="186" fill="#d0d0d0" xml:space="preserve">Sonnet 5.5 ▾</text>
|
|
36
|
+
<text x="195.6" y="186" fill="#d0d0d0" xml:space="preserve">session ▾</text>
|
|
37
|
+
<text x="304.8" y="186" fill="#d0d0d0" xml:space="preserve">2 · 10</text>
|
|
38
|
+
<text x="414.0" y="186" fill="#d0d0d0" xml:space="preserve">1M</text>
|
|
39
|
+
<text x="24.0" y="205" fill="#5fd7af" font-weight="700" xml:space="preserve">micro</text>
|
|
40
|
+
<text x="86.4" y="205" fill="#d0d0d0" xml:space="preserve">Haiku 5.5 ▾</text>
|
|
41
|
+
<text x="195.6" y="205" fill="#d0d0d0" xml:space="preserve">low ▾</text>
|
|
42
|
+
<text x="304.8" y="205" fill="#d0d0d0" xml:space="preserve">0.1 · 0.5</text>
|
|
43
|
+
<text x="414.0" y="205" fill="#d0d0d0" xml:space="preserve">1M</text>
|
|
44
|
+
<text x="24.0" y="224" fill="#d0d0d0" xml:space="preserve">Baseline tier: low ▾</text>
|
|
45
|
+
<text x="304.8" y="224" fill="#7c7c7c" xml:space="preserve">start here, fall back here</text>
|
|
46
|
+
<text x="24.0" y="262" fill="#5fafd7" font-weight="700" xml:space="preserve">SWITCH COST · from these routes</text>
|
|
47
|
+
<text x="24.0" y="281" fill="#7c7c7c" xml:space="preserve">· </text>
|
|
48
|
+
<text x="39.6" y="281" fill="#d0d0d0" xml:space="preserve">medium → high </text>
|
|
49
|
+
<text x="164.4" y="281" fill="#d0d0d0" xml:space="preserve">model change: priced as a cold cache write</text>
|
|
50
|
+
<text x="24.0" y="300" fill="#7c7c7c" xml:space="preserve">· </text>
|
|
51
|
+
<text x="39.6" y="300" fill="#d0d0d0" xml:space="preserve">low → medium </text>
|
|
52
|
+
<text x="164.4" y="300" fill="#d0d0d0" xml:space="preserve">same model, new effort: priced as a new cache</text>
|
|
53
|
+
<text x="24.0" y="319" fill="#7c7c7c" xml:space="preserve">· </text>
|
|
54
|
+
<text x="39.6" y="319" fill="#d0d0d0" xml:space="preserve">micro → low </text>
|
|
55
|
+
<text x="164.4" y="319" fill="#d0d0d0" xml:space="preserve">model change: priced as a cold cache write</text>
|
|
56
|
+
<text x="24.0" y="338" fill="#d0d0d0" xml:space="preserve">[ Reset routes to defaults ]</text>
|
|
57
|
+
<text x="24.0" y="357" fill="#7c7c7c" xml:space="preserve">A new model ID needs router.json → models: price, window, efforts.</text>
|
|
58
|
+
<text x="24.0" y="395" fill="#5fafd7" font-weight="700" xml:space="preserve">POLICY</text>
|
|
59
|
+
<text x="70.8" y="395" fill="#7c7c7c" xml:space="preserve"> · applies next turn · edit, then Save</text>
|
|
60
|
+
<text x="24.0" y="414" fill="#d0d0d0" xml:space="preserve">Votes to go down</text>
|
|
61
|
+
<text x="180.0" y="414" fill="#d0d0d0" xml:space="preserve">2 ▾</text>
|
|
62
|
+
<text x="289.2" y="414" fill="#7c7c7c" xml:space="preserve">agreeing turns before cheaper</text>
|
|
63
|
+
<text x="24.0" y="433" fill="#d0d0d0" xml:space="preserve">Payback horizon</text>
|
|
64
|
+
<text x="180.0" y="433" fill="#d0d0d0" xml:space="preserve">5 turns ▾</text>
|
|
65
|
+
<text x="289.2" y="433" fill="#7c7c7c" xml:space="preserve">a switch repays its cache</text>
|
|
66
|
+
<text x="24.0" y="452" fill="#d0d0d0" xml:space="preserve">Credits cap</text>
|
|
67
|
+
<text x="180.0" y="452" fill="#d0d0d0" xml:space="preserve">$2.00 ▾</text>
|
|
68
|
+
<text x="289.2" y="452" fill="#7c7c7c" xml:space="preserve">max cold write on credits</text>
|
|
69
|
+
<text x="24.0" y="471" fill="#d0d0d0" xml:space="preserve">[ Reset policy to defaults ]</text>
|
|
70
|
+
<text x="24.0" y="509" fill="#5fafd7" font-weight="700" xml:space="preserve">CONFIG</text>
|
|
71
|
+
<text x="24.0" y="528" fill="#d0d0d0" xml:space="preserve">File ~/.claude/router.json </text>
|
|
72
|
+
<text x="273.6" y="528" fill="#d0d0d0" xml:space="preserve">[ copy ]</text>
|
|
73
|
+
<text x="24.0" y="547" fill="#7c7c7c" xml:space="preserve">Main conversation only. Subagents keep their own model.</text>
|
|
74
|
+
<text x="24.0" y="585" fill="#7c7c7c" xml:space="preserve">router.json changes:</text>
|
|
75
|
+
<text x="24.0" y="604" fill="#e06c6c" xml:space="preserve">- routes.medium Opus 5.5 · medium</text>
|
|
76
|
+
<text x="24.0" y="623" fill="#87d787" xml:space="preserve">+ routes.medium Sonnet 5.5 · xhigh</text>
|
|
77
|
+
<text x="24.0" y="642" fill="#d7af5f" xml:space="preserve">● 1 unsaved routing change </text>
|
|
78
|
+
<text x="242.4" y="642" fill="#87afff" font-weight="700" xml:space="preserve">[ Save ]</text>
|
|
79
|
+
<text x="312.6" y="642" fill="#d0d0d0" xml:space="preserve">[ Discard ]</text>
|
|
80
|
+
<text x="24.0" y="661" fill="#d0d0d0" xml:space="preserve">[ Close ]</text>
|
|
81
|
+
</svg>
|
package/docs/user-guide.md
CHANGED
|
@@ -21,7 +21,7 @@ In Claude Code:
|
|
|
21
21
|
2. Enter the credentials of the classifier you use, and save them:
|
|
22
22
|
- **Jev** (the default): the Jev API key from typesafe.ai.
|
|
23
23
|
- **Clef** or **Clef Flash** on Cloudflare Workers AI: the Cloudflare API token and the Cloudflare account ID. One token covers both models.
|
|
24
|
-
3. To use Clef or Clef Flash, open the pane's **
|
|
24
|
+
3. To use Clef or Clef Flash, open the pane's **Classifier** tab and select its row. See [Choose the classifier](#choose-the-classifier).
|
|
25
25
|
4. Check the band above the prompt: `▂▄▆█ Auto · ready`. On another model the session starts in Manual; run `/router auto` to route.
|
|
26
26
|
|
|
27
27
|
Keys are stored as sensitive plugin options. Do not paste them into a model conversation. The [configuration guide](configuration.md) covers optional settings and migrations.
|
|
@@ -66,18 +66,27 @@ Run `/router` or select **Router** above the prompt. Without a UI surface, as in
|
|
|
66
66
|
|
|
67
67
|
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.
|
|
68
68
|
|
|
69
|
-

|
|
70
70
|
|
|
71
|
-
The **
|
|
71
|
+
The **Routing** tab edits the routes and the policy. In the picture, `medium` was changed to Sonnet 5.5 at `xhigh`: the tier shows **●**, the tab reads **Routing ●**, the switch-cost lines now price `medium → high` as a model change, and the status bar lists the one `router.json` line that **Save** will write. [Edit routes and policy](#edit-routes-and-policy) explains the controls.
|
|
72
72
|
|
|
73
|
-
| Tab
|
|
74
|
-
|
|
|
75
|
-
| 1 Now
|
|
76
|
-
| 2
|
|
77
|
-
| 3
|
|
78
|
-
| 4 Usage
|
|
73
|
+
| Tab | What it shows |
|
|
74
|
+
| ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
75
|
+
| 1 Now | The current tier, model, and reason; the classifier's support for each tier with a **pin** button; the last 30 replies by tier; context and cache. |
|
|
76
|
+
| 2 Routing | The model and effort for each tier, the baseline tier, the cache cost of each step up; downgrade votes, payback horizon, and credits cap; the `router.json` path. |
|
|
77
|
+
| 3 Classifier | The classifier rows with their credentials state, the active classifier's deadline and health, and the credentials each classifier needs. |
|
|
78
|
+
| 4 Usage | Claude-reported cost, context and cache detail, input per reply, quota, and configured-price estimates. |
|
|
79
79
|
|
|
80
|
-
**Auto** and **Manual
|
|
80
|
+
**Auto** and **Manual** stay at the top of every tab. **?** shows what the estimates leave out.
|
|
81
|
+
|
|
82
|
+
### Save and undo changes
|
|
83
|
+
|
|
84
|
+
The two settings tabs follow one rule each, and the section captions say which:
|
|
85
|
+
|
|
86
|
+
- **Routing**: edit as a set, then save. Changes stay a draft until **Save** (`s`). **Discard** (`d`) drops them. The draft stays when you change tab or close the pane: the tab reads **Routing ●**, and every tab shows the `router.json` lines that **Save** will write, with **Save** and **Discard**. A new session drops the draft.
|
|
87
|
+
- **Classifier**: a row or a deadline is written to `router.json` when you select it.
|
|
88
|
+
|
|
89
|
+
Every write applies from the next turn and can be undone. **Undo** (`u`) puts back the settings the last write changed, from any tab, and leaves any other edit to `router.json` alone. A new session clears it. Green notices confirm a write or an undo; a red one names why nothing was written.
|
|
81
90
|
|
|
82
91
|
### Understand usage and estimates
|
|
83
92
|
|
|
@@ -102,30 +111,30 @@ There is no router-side spend or savings ledger. The pane does not include class
|
|
|
102
111
|
| `/router off` | Enter Manual mode and preserve Claude's selected model. |
|
|
103
112
|
| `/router pin <micro\|low\|medium\|high>` | Pin the next turn and its tool continuations. Auto must already be enabled. |
|
|
104
113
|
| `/model <name>` | Select a model and enter Manual mode. Use `/router auto` to resume. |
|
|
105
|
-
| **Auto** / **Manual
|
|
114
|
+
| **Auto** / **Manual** | The same as `/router auto` and `/router off`. |
|
|
106
115
|
| **pin** on the Now tab | Pin that tier for the next turn. Auto must already be enabled. |
|
|
107
116
|
|
|
108
117
|
A pin does not change the next turn after the pinned turn finishes. A fresh session on the baseline model starts in Auto. A fresh session on another model starts in Manual. `/clear` starts the new session in Auto. Resuming a saved session restores its saved Auto or Manual mode.
|
|
109
118
|
|
|
110
|
-
## Edit
|
|
119
|
+
## Edit routes and policy
|
|
111
120
|
|
|
112
|
-
On the **
|
|
121
|
+
On the **Routing** tab, pick a model and an effort for any tier. The model list comes from the aliases in `router.json` `models`, limited by the `availableModels` setting. `session` keeps the effort Claude Code sends. A model without effort levels, such as a custom one with `"efforts": []`, shows `none`.
|
|
113
122
|
|
|
114
|
-
Changed tiers show **●**.
|
|
123
|
+
Changed tiers show **●**. **Reset routes to defaults** (`r`) loads the built-in routes into the draft; **Save** then removes your route overrides from `router.json`.
|
|
115
124
|
|
|
116
125
|
**Switch cost** reads the draft from the bottom tier up and shows how the policy prices each step. A model change is priced as a cold cache write. An effort change on the same model is also priced as a new messages cache; whether the API actually keeps the cache across an effort change is not measured. Two identical tiers make that step change nothing.
|
|
117
126
|
|
|
118
127
|
A new model ID needs an entry in `router.json` `models` with its price, context window, and effort levels. See [Configuration](configuration.md).
|
|
119
128
|
|
|
120
|
-
|
|
129
|
+
### Tune future decisions
|
|
121
130
|
|
|
122
|
-
|
|
131
|
+
Under **Policy** on the same tab, pick the values. One **Save** writes them with any route changes:
|
|
123
132
|
|
|
124
133
|
- **Votes to go down:** 1, 2, or 3 consecutive votes before a cheaper tier.
|
|
125
134
|
- **Payback horizon:** 1, 3, 5, or 10 later turns used by the downgrade estimate.
|
|
126
135
|
- **Credits cap:** $0.50, $1, $2, or $5 for an estimated cold cache write on a `credits` model.
|
|
127
136
|
|
|
128
|
-
The current turn keeps the settings it started with. A save preserves unrelated `router.json` keys and refuses to write through a symlink. When validation fails, the pane names the setting and leaves the file unchanged.
|
|
137
|
+
**Reset policy to defaults** loads the built-in values; **Save** then removes your policy overrides. The current turn keeps the settings it started with. A save preserves unrelated `router.json` keys and refuses to write through a symlink. When validation fails, the pane names the setting and leaves the file unchanged.
|
|
129
138
|
|
|
130
139
|
## Choose the classifier
|
|
131
140
|
|
|
@@ -137,13 +146,13 @@ Router asks one classifier per turn. Three are built in:
|
|
|
137
146
|
| Clef | Cloudflare Workers AI, 27B | Cloudflare API token and Cloudflare account ID | 3,000 ms |
|
|
138
147
|
| Clef Flash | Cloudflare Workers AI, 9B | Cloudflare API token and Cloudflare account ID | 3,000 ms |
|
|
139
148
|
|
|
140
|
-

|
|
141
150
|
|
|
142
|
-
You can save credentials for all of them; only the active one is asked. The **Classifier**
|
|
151
|
+
You can save credentials for all of them; only the active one is asked. The **Classifier** tab has one row per classifier: `◉` marks the active one, followed by its service and whether its credentials are complete. A row that lacks one names it, such as `○ no API token`, and has its own **Set up** button.
|
|
143
152
|
|
|
144
|
-
Select a row to switch. The choice is written to `router.json` at once and applies from the next turn.
|
|
153
|
+
Select a row to switch. The choice is written to `router.json` at once and applies from the next turn. **Undo** in the status bar returns to the previous classifier. A turn that is already being classified finishes with the classifier it started with. The new classifier starts with a clean failure count.
|
|
145
154
|
|
|
146
|
-
- **Deadline:** 500, 1,000, 1,500, or 3,000 ms for the active classifier's total advice attempt, including any retry. Each classifier keeps its own deadline, saved at once
|
|
155
|
+
- **Deadline:** 500, 1,000, 1,500, or 3,000 ms for the active classifier's total advice attempt, including any retry. Each classifier keeps its own deadline, saved at once, with **Undo**.
|
|
147
156
|
- **Health** shows recent failures or a pause. **Sends** names the service that receives prompt text.
|
|
148
157
|
- **Credentials** lists what each classifier needs, such as `Jev: API key · Clef, Clef Flash: API token, account ID`. **Edit** opens Claude Code's secure plugin configuration, where you enter them.
|
|
149
158
|
|