@alexeiled/claude-router 1.1.1 → 1.2.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.
- package/.claude-plugin/plugin.json +15 -4
- package/CHANGELOG.md +19 -0
- package/README.md +9 -9
- package/docs/architecture.md +25 -23
- package/docs/configuration.md +76 -22
- package/docs/native-router.md +20 -15
- package/docs/router-band.svg +14 -14
- package/docs/router-pane-tuning.svg +58 -0
- package/docs/user-guide.md +55 -27
- package/hooks/native-router.mjs +135 -31
- package/lib/config.mjs +107 -27
- package/lib/jev-contract.mjs +25 -6
- package/lib/native-band.mjs +31 -14
- package/lib/native-display.mjs +34 -3
- package/lib/native-jev.mjs +7 -5
- package/lib/native-panel.mjs +107 -51
- package/package.json +2 -2
- package/scripts/migrate-config.mjs +14 -3
- package/types/index.d.ts +5 -3
|
@@ -1,21 +1,32 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "router",
|
|
3
3
|
"displayName": "Router",
|
|
4
|
-
"version": "1.
|
|
5
|
-
"description": "Model and effort routing for the main conversation, advised by a prompt classifier (Jev). Preserves subagent model choices.",
|
|
4
|
+
"version": "1.2.0",
|
|
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",
|
|
8
8
|
"url": "https://github.com/alexei-led"
|
|
9
9
|
},
|
|
10
10
|
"repository": "https://github.com/alexei-led/claude-router",
|
|
11
11
|
"license": "MIT",
|
|
12
|
-
"keywords": ["router", "jev", "typesafe", "effort", "mods"],
|
|
12
|
+
"keywords": ["router", "jev", "typesafe", "clef", "cloudflare", "effort", "mods"],
|
|
13
13
|
"userConfig": {
|
|
14
14
|
"typesafe_api_key": {
|
|
15
15
|
"type": "string",
|
|
16
16
|
"title": "Jev API key (typesafe.ai)",
|
|
17
|
-
"description": "Jev API key from typesafe.ai.
|
|
17
|
+
"description": "Jev API key from typesafe.ai. Used when the classifier is Jev; without its key the current model is kept.",
|
|
18
18
|
"sensitive": true
|
|
19
|
+
},
|
|
20
|
+
"cloudflare_api_token": {
|
|
21
|
+
"type": "string",
|
|
22
|
+
"title": "Cloudflare API token (Clef, Clef Flash)",
|
|
23
|
+
"description": "Workers AI token for the Clef and Clef Flash classifiers. Scope it to Workers AI only.",
|
|
24
|
+
"sensitive": true
|
|
25
|
+
},
|
|
26
|
+
"cloudflare_account_id": {
|
|
27
|
+
"type": "string",
|
|
28
|
+
"title": "Cloudflare account ID (Clef, Clef Flash)",
|
|
29
|
+
"description": "The Cloudflare account that runs Workers AI. Not a secret."
|
|
19
30
|
}
|
|
20
31
|
},
|
|
21
32
|
"types": "./types/index.d.ts"
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.2.0 (2026-10-05)
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- Choose the classifier: Jev on typesafe.ai (the default), or Cloudflare's Clef and Clef Flash on Workers AI. Save the Cloudflare API token and account ID in `/plugin configure router`, then select the classifier's row on the Tuning tab. The choice is saved at once, with **Undo**. Only the active classifier is asked.
|
|
8
|
+
- The Tuning tab opens with the classifier section: each classifier's service and credentials state, the missing setting by name (`no API token`) with **Set up**, the active classifier's deadline and health, the host that receives the prompt text, and what each classifier needs.
|
|
9
|
+
- `router.json` can add a classifier for another service that speaks the same API. Its key and endpoint settings reuse the plugin's three options.
|
|
10
|
+
- `scripts/probe-classifier.mjs` sends the router's real request to one classifier and prints the status, latency, and answer.
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
|
|
14
|
+
- Classifier settings moved from `jev` to `classifiers.<id>`, and `classifier` names the active one. Each classifier has its own deadline (Jev 1,500 ms, Clef and Clef Flash 3,000 ms), failure count, and pause. A turn being classified when you switch finishes with its own classifier.
|
|
15
|
+
- The band and pane name the active classifier and the missing setting: `⚠ Jev: no API key`, `⚠ Clef: no account ID`. On a narrow band the warning and **Set up** come first. **Set key** is now **Set up**.
|
|
16
|
+
- A classifier endpoint must use `https`, or `http` on localhost.
|
|
17
|
+
|
|
18
|
+
### Upgrade
|
|
19
|
+
|
|
20
|
+
1. If your `router.json` has a `jev` section, run `node scripts/migrate-config.mjs ~/.claude/router.json` from the installed plugin directory after you update. Until then routing stays off and the band reads `Router unavailable`. The command keeps an exact-byte `router.json.v1.1.backup`. A file without `jev`, or no file at all, needs nothing.
|
|
21
|
+
|
|
3
22
|
## 1.1.1 (2026-10-05)
|
|
4
23
|
|
|
5
24
|
### Fixed
|
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
[](https://github.com/alexei-led/claude-router/actions/workflows/ci.yml)
|
|
4
4
|
[](https://opensource.org/licenses/MIT)
|
|
5
5
|
|
|
6
|
-
**A Claude Code Mod that chooses a model and effort for each main-conversation turn, advised by a prompt classifier
|
|
6
|
+
**A Claude Code Mod that chooses a model and effort for each main-conversation turn, advised by a prompt classifier: Jev, or Cloudflare's Clef and Clef Flash.**
|
|
7
7
|
|
|
8
8
|
The Mod changes only the model and effort in Claude Code's turn hook. Claude Code sends the request, streams the reply, runs tools, and reports usage. The router does not proxy Anthropic traffic or start a local server. Subagent model choices pass through unchanged.
|
|
9
9
|
|
|
@@ -20,13 +20,13 @@ sequenceDiagram
|
|
|
20
20
|
actor Dev as Developer
|
|
21
21
|
participant Code as Claude Code
|
|
22
22
|
participant Mod as Router Mod
|
|
23
|
-
participant
|
|
23
|
+
participant Cls as Classifier
|
|
24
24
|
participant API as Anthropic
|
|
25
25
|
Dev->>Code: Prompt
|
|
26
26
|
Code->>Mod: Main or subagent step
|
|
27
27
|
alt Main conversation in Auto
|
|
28
|
-
Mod->>
|
|
29
|
-
|
|
28
|
+
Mod->>Cls: Bounded prompt and dialogue
|
|
29
|
+
Cls-->>Mod: Tier advice
|
|
30
30
|
Mod-->>Code: Selected model and effort
|
|
31
31
|
else Manual or subagent
|
|
32
32
|
Mod-->>Code: Original model and effort
|
|
@@ -36,7 +36,7 @@ sequenceDiagram
|
|
|
36
36
|
Mod-->>Dev: Status band and router pane
|
|
37
37
|
```
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
The active classifier labels a new logical turn once. Tool continuations keep that choice. A local policy applies vote, context, failure, and cache-cost rules before the Mod changes the next step. Claude Code owns request construction, model credentials, tools, streaming, and the API cost ledger.
|
|
40
40
|
|
|
41
41
|
| Tier | Default model | Effort |
|
|
42
42
|
| -------- | ------------- | ------------------------ |
|
|
@@ -49,14 +49,14 @@ These are routing defaults. They do not claim equal model quality.
|
|
|
49
49
|
|
|
50
50
|
## Install
|
|
51
51
|
|
|
52
|
-
You need Claude Code 2.1.289 or newer and a Jev API key from [typesafe.ai](https://typesafe.ai).
|
|
52
|
+
You need Claude Code 2.1.289 or newer and credentials for one classifier: a Jev API key from [typesafe.ai](https://typesafe.ai), or a Cloudflare API token and account ID for [Clef or Clef Flash](https://developers.cloudflare.com/workers-ai/models/clef/) on Workers AI.
|
|
53
53
|
|
|
54
54
|
```sh
|
|
55
55
|
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
|
|
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 Tuning 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
|
|
|
@@ -70,7 +70,7 @@ Start Claude Code with this directory as a local plugin and the full Sonnet base
|
|
|
70
70
|
claude --plugin-dir "$PWD" --model claude-sonnet-5-5
|
|
71
71
|
```
|
|
72
72
|
|
|
73
|
-
In Claude Code, run `/plugin configure router` and save your
|
|
73
|
+
In Claude Code, run `/plugin configure router` and save your classifier key in the sensitive plugin option. The Mod adds its status band and `/router` pane. No status-line setup or gateway environment variables are needed.
|
|
74
74
|
|
|
75
75
|
Run `/router` to open the pane: route status, per-tier controls, tuning, and usage. Run `/model` to select a model and enter Manual mode, and `/router auto` to resume. For controls, metrics, tuning, and troubleshooting, see the [user guide](docs/user-guide.md).
|
|
76
76
|
|
|
@@ -83,7 +83,7 @@ npm run check && npm test && npm run validate && npm run test:plugin
|
|
|
83
83
|
## Documentation
|
|
84
84
|
|
|
85
85
|
- [User guide](docs/user-guide.md): install, use the controls, read the panel, and troubleshoot.
|
|
86
|
-
- [Configuration](docs/configuration.md): the optional profile `router.json`, defaults, and
|
|
86
|
+
- [Configuration](docs/configuration.md): classifiers and keys, the optional profile `router.json`, defaults, and migrations.
|
|
87
87
|
- [Architecture](docs/architecture.md): Mod event flow, state, safeguards, and runtime boundaries.
|
|
88
88
|
- [Native router details](docs/native-router.md): panel semantics, tuning, and accepted limits.
|
|
89
89
|
- [Evaluation](docs/evaluation.md): historical gateway results and the native shadow replay.
|
package/docs/architecture.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Architecture
|
|
2
2
|
|
|
3
|
-
Claude Code owns the model request. The router Mod asks Jev for tier advice, applies local routing policy, and changes only the next main-conversation step's model and effort. Every subagent step passes through with Claude's model selection unchanged.
|
|
3
|
+
Claude Code owns the model request. The router Mod asks the active classifier (Jev by default, or Cloudflare's Clef or Clef Flash) for tier advice, applies local routing policy, and changes only the next main-conversation step's model and effort. Every subagent step passes through with Claude's model selection unchanged.
|
|
4
4
|
|
|
5
5
|
## Request flow
|
|
6
6
|
|
|
@@ -10,13 +10,13 @@ sequenceDiagram
|
|
|
10
10
|
actor Dev as Developer
|
|
11
11
|
participant Code as Claude Code
|
|
12
12
|
participant Mod as Router Mod
|
|
13
|
-
participant
|
|
13
|
+
participant Cls as Classifier
|
|
14
14
|
participant API as Anthropic
|
|
15
15
|
Dev->>Code: Prompt
|
|
16
16
|
Code->>Mod: turn.start and turn.step
|
|
17
17
|
alt Main conversation, Auto
|
|
18
|
-
Mod->>
|
|
19
|
-
|
|
18
|
+
Mod->>Cls: Current prompt and bounded dialogue
|
|
19
|
+
Cls-->>Mod: Tier advice
|
|
20
20
|
Note over Mod: Apply votes, context fit, cache costs and failure rules
|
|
21
21
|
Mod-->>Code: Forward model and effort
|
|
22
22
|
else Manual, subagent, or unavailable
|
|
@@ -30,29 +30,31 @@ sequenceDiagram
|
|
|
30
30
|
|
|
31
31
|
The Mod does not construct an Anthropic request or proxy its response. Claude Code owns authentication, request fields, streaming, tools, model fallback, and its native usage ledger. No local gateway process or port is part of the runtime.
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
The active classifier receives only the current prompt and up to six recent user or assistant text messages. Each text is capped at 1,200 characters. System messages, tool inputs, and tool results are not included. Only the active classifier is asked: Jev sends that text to typesafe.ai, Clef and Clef Flash to Cloudflare Workers AI. The keys are sensitive plugin options; the Cloudflare account ID is a plain one that fills the endpoint. The Mod does not receive Claude's Anthropic credentials.
|
|
34
|
+
|
|
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.
|
|
34
36
|
|
|
35
37
|
Claude Code builds each request for the model the Mod selects, so no request rewriting is needed: Haiku gets its own thinking mode and a 32K output cap. On Claude Code 2.1.289, a billed chain of pinned turns (Opus, Haiku, Sonnet at `xhigh`, Sonnet, Haiku) 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.
|
|
36
38
|
|
|
37
39
|
## Responsibilities
|
|
38
40
|
|
|
39
|
-
| Component | Responsibility
|
|
40
|
-
| --------------------------------------------- |
|
|
41
|
-
| [Native hooks](../hooks/native-router.mjs) | Turn identity, controls, lifecycle, per-step rewrites, and response observation.
|
|
42
|
-
| [Jev contract](../lib/jev-contract.mjs) |
|
|
43
|
-
| [Native Jev](../lib/native-jev.mjs) |
|
|
44
|
-
| [Router controller](../lib/native-router.mjs) | Context fit, model identity, cache observations, and one-turn pins.
|
|
45
|
-
| [Policy](../lib/policy.mjs) | Tier votes, escalation, and switching gates.
|
|
46
|
-
| [Native costs](../lib/native-cost.mjs) | Cache uncertainty bounds and switching estimates.
|
|
47
|
-
| [Native panel](../lib/native-panel.mjs) | Tabbed pane: route status, tier pins, the route editor, tuning, and usage.
|
|
48
|
-
| [Router band](../lib/native-band.mjs) | Status band segments fitted to the band's width, and route-change toasts.
|
|
49
|
-
| Claude Code | API requests, tools, authentication, stream output, and usage ledger.
|
|
41
|
+
| Component | Responsibility |
|
|
42
|
+
| --------------------------------------------- | ------------------------------------------------------------------------------------------------- |
|
|
43
|
+
| [Native hooks](../hooks/native-router.mjs) | Turn identity, controls, lifecycle, per-step rewrites, and response observation. |
|
|
44
|
+
| [Jev contract](../lib/jev-contract.mjs) | Classifier request payload, credentials and endpoint filling, answer validation, and retry rules. |
|
|
45
|
+
| [Native Jev](../lib/native-jev.mjs) | Classifier HTTP, deadline, in-flight admission, and circuit breaker. |
|
|
46
|
+
| [Router controller](../lib/native-router.mjs) | Context fit, model identity, cache observations, and one-turn pins. |
|
|
47
|
+
| [Policy](../lib/policy.mjs) | Tier votes, escalation, and switching gates. |
|
|
48
|
+
| [Native costs](../lib/native-cost.mjs) | Cache uncertainty bounds and switching estimates. |
|
|
49
|
+
| [Native panel](../lib/native-panel.mjs) | Tabbed pane: route status, tier pins, the route editor, tuning, and usage. |
|
|
50
|
+
| [Router band](../lib/native-band.mjs) | Status band segments fitted to the band's width, and route-change toasts. |
|
|
51
|
+
| Claude Code | API requests, tools, authentication, stream output, and usage ledger. |
|
|
50
52
|
|
|
51
|
-
Node.js is not part of routing. It is used for development
|
|
53
|
+
Node.js is not part of routing. It is used for development, the optional configuration migration, and the classifier probe.
|
|
52
54
|
|
|
53
55
|
## Decision and context
|
|
54
56
|
|
|
55
|
-
One logical turn gets one
|
|
57
|
+
One logical turn gets one classification. Tool continuations reuse the decision and add no votes. Before each step, the controller checks whether the selected model still fits after new tool output.
|
|
56
58
|
|
|
57
59
|
A move to a smaller context window needs a main-response measurement from the current history and Claude's local context estimate. The router uses the larger available reading and reserves 20% of the model window. If it cannot establish fit, it keeps the current model with `context-unknown`. It does not infer token count from character count.
|
|
58
60
|
|
|
@@ -64,11 +66,11 @@ An explicit context-window failure marks that model ineligible until the next hi
|
|
|
64
66
|
|
|
65
67
|
Clear, branch, rewind, and committed compaction clear cache evidence and votes. A turn in progress keeps its route, pin, and any engine fallback. `/clear` starts the new session in Auto. A fresh session on the configured baseline starts in Auto. A fresh session on another model starts in Manual. Resume restores the selected session's saved mode. Hot reload retains valid `$.state`. Running `/model` enters Manual, including an explicit choice of the baseline. `/router auto` resumes routing. `/router off` also enters Manual. Pins apply to the next turn and its tool continuations. The prior Auto route resumes afterward.
|
|
66
68
|
|
|
67
|
-
Subagent events pass directly to Claude Code. They do not create
|
|
69
|
+
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.
|
|
68
70
|
|
|
69
|
-
##
|
|
71
|
+
## Classifier deadline and failure handling
|
|
70
72
|
|
|
71
|
-
Each advice attempt has a
|
|
73
|
+
Each advice attempt has a total deadline, including any transient retry: 1,500 ms for Jev and 3,000 ms for Clef and Clef Flash by default. A timeout does not retry. `Retry-After` is honored only when it fits the remaining budget. Three launched failures pause the classifier for 60 seconds. Missing-key, missing-account, busy, and paused skips do not count as failures. Each classifier has its own failure count, pause, and in-flight slot. A turn that started under one classifier finishes with it, even if the pane switches meanwhile. Switching the classifier, or starting a session with another one, starts the new one from a clean count.
|
|
72
74
|
|
|
73
75
|
The pinned host API does not expose a per-request abort option for `$.http.fetch`. The Mod returns to the incumbent at its own deadline and blocks another advice request while that wire call remains pending. Claude Code's observed host timeout is about 30 seconds. Recorded reload and unload checks closed pending sockets after 24.7 and 28.5 seconds. Replacement closed one after 31.6 seconds. These runs do not show immediate per-call cancellation. A plugin network-policy refusal degrades routing and is never bypassed with a subprocess.
|
|
74
76
|
|
|
@@ -80,10 +82,10 @@ Cache identity uses the exact response model ID and effective effort. The known
|
|
|
80
82
|
|
|
81
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.
|
|
82
84
|
|
|
83
|
-
The switching policy prices the candidate at a conservative cache-write bound and the incumbent at its best supported input bound. The pane shows the configured-price range and a conditional payback estimate. These are estimates, not measured savings. Claude's native `/cost` ledger owns total API cost.
|
|
85
|
+
The switching policy prices the candidate at a conservative cache-write bound and the incumbent at its best supported input bound. The pane shows the configured-price range and a conditional payback estimate. These are estimates, not measured savings. Claude's native `/cost` ledger owns total API cost. Classifier spend is not included.
|
|
84
86
|
|
|
85
87
|
## Deployment
|
|
86
88
|
|
|
87
|
-
Install the plugin from the `alexei-led/claude-router` marketplace, or load a checkout with `--plugin-dir`. Load only one copy of the router in a session. The plugin ships the Mod, its pure `lib/` modules, type declarations, and the
|
|
89
|
+
Install the plugin from the `alexei-led/claude-router` marketplace, or load a checkout with `--plugin-dir`. Load only one copy of the router in a session. The plugin ships the Mod, its pure `lib/` modules, type declarations, and the configuration migration script. It starts no process and opens no port.
|
|
88
90
|
|
|
89
91
|
Use the [configuration guide](configuration.md) for optional settings and migration, and the [native guide](native-router.md) for panel and control behavior.
|
package/docs/configuration.md
CHANGED
|
@@ -1,18 +1,28 @@
|
|
|
1
1
|
# Configuration
|
|
2
2
|
|
|
3
|
-
The router works with its built-in defaults. Configure
|
|
3
|
+
The router works with its built-in defaults. Configure the key of the active classifier to enable advice. Change `router.json` only when you need to change the classifier, routes, model prices, cache assumptions, or policy.
|
|
4
4
|
|
|
5
5
|
## Key and profile settings
|
|
6
6
|
|
|
7
|
-
| Item | Where it lives | How to change it
|
|
8
|
-
| ---------------------------------- | ----------------------------------------------- |
|
|
9
|
-
| Jev API key | Sensitive plugin option `typesafe_api_key` | Run `/plugin configure router`, or use **Set
|
|
10
|
-
|
|
|
11
|
-
|
|
|
7
|
+
| Item | Where it lives | How to change it |
|
|
8
|
+
| ---------------------------------- | ----------------------------------------------- | ----------------------------------------------------------------------------------------------- |
|
|
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
|
+
| Cloudflare API token | Sensitive plugin option `cloudflare_api_token` | The same dialog. Used by Clef and Clef Flash. |
|
|
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 Tiers and Tuning tabs. |
|
|
13
|
+
| Anthropic credentials and API cost | Claude Code | The Mod leaves these to Claude Code. |
|
|
12
14
|
|
|
13
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.
|
|
14
16
|
|
|
15
|
-
The Mod reads
|
|
17
|
+
The Mod reads each value from its plugin option first. When the option is empty, it reads the environment variable of the same name in upper case, then the one Claude Code exports for the option:
|
|
18
|
+
|
|
19
|
+
| Plugin option | Environment variables |
|
|
20
|
+
| ----------------------- | --------------------------------------------------------------------- |
|
|
21
|
+
| `typesafe_api_key` | `TYPESAFE_API_KEY`, `CLAUDE_PLUGIN_OPTION_TYPESAFE_API_KEY` |
|
|
22
|
+
| `cloudflare_api_token` | `CLOUDFLARE_API_TOKEN`, `CLAUDE_PLUGIN_OPTION_CLOUDFLARE_API_TOKEN` |
|
|
23
|
+
| `cloudflare_account_id` | `CLOUDFLARE_ACCOUNT_ID`, `CLAUDE_PLUGIN_OPTION_CLOUDFLARE_ACCOUNT_ID` |
|
|
24
|
+
|
|
25
|
+
Export the variables before you start `claude`. Without the key or the account ID of the active classifier, the Mod keeps Claude's current model and reports which value is missing.
|
|
16
26
|
|
|
17
27
|
Project and local settings cannot set `HOME` or `CLAUDE_CONFIG_DIR` for this Mod. Those overrides make the router unavailable for the session, so a project cannot redirect the router to another profile's key or configuration.
|
|
18
28
|
|
|
@@ -37,28 +47,68 @@ Default model settings:
|
|
|
37
47
|
|
|
38
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 } }`.
|
|
39
49
|
|
|
50
|
+
## Classifiers
|
|
51
|
+
|
|
52
|
+
`classifier` names the active entry of `classifiers`. All entries use the same typed-questions API: Router sends the same request to each and reads the same answer. Cloudflare wraps that answer in `{ result, success, errors }`; Router reads both forms.
|
|
53
|
+
|
|
54
|
+
| `classifier` | Endpoint | Request `model` | Key option | `timeoutMs` |
|
|
55
|
+
| ------------ | -------------------------------------------------------------------------------------------------------- | --------------- | ---------------------- | ----------: |
|
|
56
|
+
| `jev` | `https://api.typesafe.ai/v1/systemone` | `jev-1.13.0` | `typesafe_api_key` | `1500` |
|
|
57
|
+
| `clef` | `https://api.cloudflare.com/client/v4/accounts/{cloudflare_account_id}/ai/run/@cf/cloudflare/clef` | `clef` | `cloudflare_api_token` | `3000` |
|
|
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
|
+
|
|
60
|
+
`jev` is the default. Select another one with a row in the pane's **Tuning → Classifier**, or in `router.json`:
|
|
61
|
+
|
|
62
|
+
```json
|
|
63
|
+
{ "classifier": "clef-flash" }
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
An entry has five fields: `label` (the name the band and pane show), `endpoint`, `model`, `keyOption`, and `timeoutMs`. `endpoint` must use `https`; plain `http` is accepted only for `localhost`, `127.0.0.1`, or `[::1]`, because the key travels with each request. A `{name}` in `endpoint` is filled from the plugin option of that name, URL-encoded. `keyOption` names the plugin option sent as the bearer token. Override one field of a built-in entry and the rest stay, for example `"classifiers": { "clef": { "timeoutMs": 4000 } }`.
|
|
67
|
+
|
|
68
|
+
You can add an entry for another service that speaks the same API. Its `keyOption` and endpoint placeholders must be one of `typesafe_api_key`, `cloudflare_api_token`, or `cloudflare_account_id`. Claude Code lets a Mod read only the options its manifest declares and environment variables it names in code, so an entry cannot bring a key of its own. Nor can it add request headers. For example, a company proxy in front of Jev:
|
|
69
|
+
|
|
70
|
+
```json
|
|
71
|
+
{
|
|
72
|
+
"classifier": "jev-proxy",
|
|
73
|
+
"classifiers": {
|
|
74
|
+
"jev-proxy": {
|
|
75
|
+
"label": "Jev",
|
|
76
|
+
"endpoint": "https://jev-proxy.example.internal/v1/systemone",
|
|
77
|
+
"model": "jev-1.13.0",
|
|
78
|
+
"keyOption": "typesafe_api_key",
|
|
79
|
+
"timeoutMs": 1500
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
The active classifier receives the current prompt and recent dialogue, as described in the [architecture](architecture.md#request-flow). Give a Cloudflare token Workers AI permissions only. The routing policy thresholds were tuned against Jev; another classifier's probabilities can place the same prompt differently.
|
|
86
|
+
|
|
87
|
+
To check a classifier outside Claude Code, run `node scripts/probe-classifier.mjs [classifier]` from a checkout. It reads `router.json` and the upper-case variables `TYPESAFE_API_KEY`, `CLOUDFLARE_API_TOKEN`, and `CLOUDFLARE_ACCOUNT_ID` from the environment or `./.env`; it does not read plugin options or the `CLAUDE_PLUGIN_OPTION_*` names. It sends the router's real request, and prints the status, latency, and parsed answer. It never prints the key or the full endpoint.
|
|
88
|
+
|
|
40
89
|
## Optional `router.json`
|
|
41
90
|
|
|
42
91
|
Start with the setting you need and leave the rest at defaults. For example, require three votes before moving to a cheaper tier and allow Jev up to two seconds:
|
|
43
92
|
|
|
44
93
|
```json
|
|
45
94
|
{
|
|
46
|
-
"jev": { "timeoutMs": 2000 },
|
|
95
|
+
"classifiers": { "jev": { "timeoutMs": 2000 } },
|
|
47
96
|
"policy": { "downgradeVotes": 3 }
|
|
48
97
|
}
|
|
49
98
|
```
|
|
50
99
|
|
|
51
|
-
The Mod validates the whole file. Unknown keys and invalid values make routing unavailable with a general configuration error. Retired gateway keys trigger a migration instruction. The migration command reports an invalid setting path and does not print its value.
|
|
100
|
+
The Mod validates the whole file. Unknown keys and invalid values make routing unavailable with a general configuration error. Retired gateway keys and the 1.1 `jev` section trigger a migration instruction. The migration command reports an invalid setting path and does not print its value.
|
|
52
101
|
|
|
53
|
-
| Section
|
|
54
|
-
|
|
|
55
|
-
| `baselineTier`
|
|
56
|
-
| `routes.<tier>`
|
|
57
|
-
| `models.<alias>`
|
|
58
|
-
| `cache`
|
|
59
|
-
| `policy`
|
|
60
|
-
| `
|
|
61
|
-
| `
|
|
102
|
+
| Section | Supported fields | Defaults |
|
|
103
|
+
| ------------------ | ------------------------------------------------------------------------------------ | -------------------------------------------------------- |
|
|
104
|
+
| `baselineTier` | `micro`, `low`, `medium`, `high` | `low` |
|
|
105
|
+
| `routes.<tier>` | `model`, optional `effort` (a level, or `null` for the session effort) | As in the route table above |
|
|
106
|
+
| `models.<alias>` | `id`, `input`, optional `output`, `cacheRead`, `contextWindow`, `billing`, `efforts` | Three defaults above |
|
|
107
|
+
| `cache` | `writeMultiplier`, `ttlMs`, `warmMarginMs` | `5m: 1.25`, `1h: 2`; `300000` / `3600000` ms; `30000` ms |
|
|
108
|
+
| `policy` | Fields below | Values below |
|
|
109
|
+
| `classifier` | An id in `classifiers` | `jev` |
|
|
110
|
+
| `classifiers.<id>` | `label`, `endpoint`, `model`, `keyOption`, `timeoutMs` | [Classifiers](#classifiers) above |
|
|
111
|
+
| `context` | `recentTurns`, `maxTextChars` | `6`, `1200` |
|
|
62
112
|
|
|
63
113
|
Policy defaults:
|
|
64
114
|
|
|
@@ -78,10 +128,14 @@ Policy defaults:
|
|
|
78
128
|
| `escalationHoldTurns` | `2` | Turns held after a repeated tool error escalates the route. |
|
|
79
129
|
| `cashCapUsd` | `2` | Maximum estimated cold cache write for a `credits` model. It does not cap output or session spend. |
|
|
80
130
|
|
|
81
|
-
The pane writes a subset of these settings. The **Tiers** tab sets `routes` and `baselineTier`: it writes only tiers that differ from the defaults and removes the rest. The **Tuning** tab sets `
|
|
131
|
+
The pane writes a subset of these settings. The **Tiers** tab sets `routes` and `baselineTier`: it writes only tiers that differ from the defaults and removes the rest. The **Tuning** tab sets `classifier` and the active classifier's `timeoutMs` at once, and `policy.downgradeVotes`, `policy.downgradeHorizonTurns`, and `policy.cashCapUsd`. 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.
|
|
82
132
|
|
|
83
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.
|
|
84
134
|
|
|
135
|
+
## Convert an older `router.json`
|
|
136
|
+
|
|
137
|
+
Router 1.1 kept the Jev settings in a `jev` section. The current version reads `classifiers.jev` instead and makes routing unavailable while a `jev` section remains. Run the migration command below on the file. It moves `jev.endpoint`, `jev.model`, and `jev.timeoutMs` to `classifiers.jev`, keeps everything else, and writes an exact-byte `router.json.v1.1.backup`. A file without a `jev` section needs no change.
|
|
138
|
+
|
|
85
139
|
## Convert a v0.8 configuration
|
|
86
140
|
|
|
87
141
|
The `router.json` converter changes only that file. It does not remove Claude Code gateway settings. Remove them before the first native session.
|
|
@@ -97,13 +151,13 @@ Then inspect that profile's `settings.json`. Remove the old `jev-router[1m]` mod
|
|
|
97
151
|
No conversion is needed if you never created `router.json`. For an existing file, run the migration command that ships with the installed plugin:
|
|
98
152
|
|
|
99
153
|
```sh
|
|
100
|
-
node ~/.claude/plugins/cache/alexei-led-claude-router/router/1.
|
|
154
|
+
node ~/.claude/plugins/cache/alexei-led-claude-router/router/1.2.0/scripts/migrate-config.mjs ~/.claude/router.json
|
|
101
155
|
```
|
|
102
156
|
|
|
103
157
|
Use the installed version in the path. From a checkout, run `node scripts/migrate-config.mjs ~/.claude/router.json`.
|
|
104
158
|
|
|
105
|
-
Pass the file under your active profile instead when `CLAUDE_CONFIG_DIR` points elsewhere. The command validates the converted configuration before writing it and creates an exact-byte `router.json.v0.8.backup
|
|
159
|
+
Pass the file under your active profile instead when `CLAUDE_CONFIG_DIR` points elsewhere. The command validates the converted configuration before writing it and creates an exact-byte `router.json.v0.8.backup` for a v0.8 file, or `router.json.v1.1.backup` for a 1.1 file. It refuses to overwrite an existing backup. Route, model-price, cache, and policy overrides remain in the converted file.
|
|
106
160
|
|
|
107
|
-
The converter removes old gateway and logging settings, request-feature fields, and model output caps. It moves `gateway.baselineTier` to top-level `baselineTier`. It stops without writing when it finds an unsupported old field or invalid setting.
|
|
161
|
+
The converter removes old gateway and logging settings, request-feature fields, and model output caps. It moves `gateway.baselineTier` to top-level `baselineTier` and the `jev` section to `classifiers.jev`. It stops without writing when it finds an unsupported old field or invalid setting.
|
|
108
162
|
|
|
109
163
|
Node.js 22 or later is needed only for this migration command and project development. Claude Code runs the Mod. Node is not a routing service.
|
package/docs/native-router.md
CHANGED
|
@@ -4,9 +4,9 @@ This guide describes the Mod shipped in the plugin. Claude Code 2.1.289 is the m
|
|
|
4
4
|
|
|
5
5
|
## Turn behavior
|
|
6
6
|
|
|
7
|
-
At the first main step of a logical turn, the Mod reads recent message text and asks Jev for a tier. It applies local policy and saves the route. Tool continuations reuse that route. Before each continuation, context fit is checked again. A large tool result can move the step to a model with a larger window.
|
|
7
|
+
At the first main step of a logical turn, the Mod reads recent message text and asks the active classifier (Jev, Clef, or Clef Flash) for a tier. It applies local policy and saves the route. Tool continuations reuse that route. Before each continuation, context fit is checked again. A large tool result can move the step to a model with a larger window.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
The classifier receives the current prompt and at most six preceding user or assistant text messages. Each item is limited to 1,200 characters. It does not receive system messages, tool inputs, or tool results. Claude Code's Anthropic credentials never enter the classifier request.
|
|
10
10
|
|
|
11
11
|
The default tiers are defined in [Configuration](configuration.md#built-in-defaults). Policy uses vote hysteresis, repeated tool errors, context fit, model availability, and switching-cost estimates. The [architecture](architecture.md#request-flow) explains the event boundary and failure handling.
|
|
12
12
|
|
|
@@ -20,7 +20,7 @@ The default tiers are defined in [Configuration](configuration.md#built-in-defau
|
|
|
20
20
|
| `/router pin <tier>` | Pin the next turn and tool continuations. Auto must already be enabled. |
|
|
21
21
|
| `/model <name>` | Select a model and enter Manual mode. `/router auto` resumes routing. |
|
|
22
22
|
|
|
23
|
-
The pane's **Set
|
|
23
|
+
The pane's **Set up** and **Credentials → Edit** buttons open Claude Code's secure plugin configuration. Claude Code refuses `$.command.run` from inside a `command.run` hook, so the Mod starts that dialog from a timer after the press returns.
|
|
24
24
|
|
|
25
25
|
Mode belongs to a Claude Code session. Clear starts a new session in Auto. Resume restores the saved mode for that session. A new or forked session has a new ID: it starts in Auto on the baseline model and in Manual on another model, as a fresh launch does. A pin applies to one logical turn, then the prior Auto incumbent resumes. A history reset clears votes and cache evidence; the current turn keeps its route, pin and any native fallback.
|
|
26
26
|
|
|
@@ -31,7 +31,7 @@ The status band is one line above the prompt: a tier meter, the route, a short r
|
|
|
31
31
|
| Reading | Meaning and limits |
|
|
32
32
|
| ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- |
|
|
33
33
|
| Now / Served | The requested model and effort. **Served** appears only when the engine answered with another model. Actual effort is not reported. |
|
|
34
|
-
|
|
|
34
|
+
| Classifier support | Per-tier probabilities from the last classification, and the switch bar the policy required. Pins and skipped calls leave it empty. |
|
|
35
35
|
| Replies | The tier that served each of the last 30 main-conversation replies; a dot where the router did not choose. |
|
|
36
36
|
| Cost | Claude Code's native usage value. A plan's list-price estimates are not subscription cash charges. |
|
|
37
37
|
| Context bar | Maximum available observed and local estimated context, compared with the routed model's window. The fit rule reserves 20%. |
|
|
@@ -39,30 +39,33 @@ The status band is one line above the prompt: a tier meter, the route, a short r
|
|
|
39
39
|
| Cache reuse | Last response's cache-read tokens divided by its reported input counters. |
|
|
40
40
|
| Cache read / written; Output | Response usage counters. Cache warmth does not prove a particular TTL. |
|
|
41
41
|
| Input per reply | Up to 30 observed main-conversation input sizes, scaled from the lowest to the highest reading. |
|
|
42
|
-
|
|
|
42
|
+
| Classifier header | Active classifier state and elapsed time. Missing-key, missing-account, busy, and paused skips have no network latency reading. |
|
|
43
43
|
| Next-turn difference | Configured-price range for the suggested tier versus the incumbent on the next request. Negative means estimated lower cost. |
|
|
44
44
|
| Conservative payback | Conditional later-turn estimate based on configured cache prices, future reads, and the last output size. It is not measured savings. |
|
|
45
45
|
| Cache read benefit | Estimated price difference for observed cache reads before cache writes. It is not net savings. |
|
|
46
46
|
|
|
47
|
-
There is no router-owned cost ledger or cumulative savings counter.
|
|
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
|
## Tuning
|
|
50
50
|
|
|
51
|
-
The Tiers tab edits each tier's model alias and effort and the baseline tier. The Tuning tab has
|
|
51
|
+
The Tiers tab edits each tier's model alias and effort and the baseline tier. The Tuning tab has the classifier choice with its deadline, and three policy controls. Drafts do not affect the active turn. **Save routes** and **Save tuning** validate the whole file with the same loader the Mod starts with, write `router.json` for future turns, and keep unrelated keys. A route equal to the built-in default is removed from the file, so later default changes still reach it.
|
|
52
52
|
|
|
53
|
-
| Control | Values in the pane | Effect
|
|
54
|
-
| ---------------- | --------------------------- |
|
|
55
|
-
|
|
|
56
|
-
| Votes to go down | 1, 2, 3 | Consecutive votes required for a downgrade.
|
|
57
|
-
| Payback horizon | 1, 3, 5, 10 turns | Later turns included in downgrade economics.
|
|
58
|
-
| Credits cap | $0.50, $1, $2, $5 | Largest estimated cold write on a `credits` model.
|
|
53
|
+
| Control | Values in the pane | Effect |
|
|
54
|
+
| ---------------- | --------------------------- | ---------------------------------------------------------------------------------------- |
|
|
55
|
+
| Deadline | 500, 1,000, 1,500, 3,000 ms | The active classifier's total advice time, including any transient retry. Saved at once. |
|
|
56
|
+
| Votes to go down | 1, 2, 3 | Consecutive votes required for a downgrade. |
|
|
57
|
+
| Payback horizon | 1, 3, 5, 10 turns | Later turns included in downgrade economics. |
|
|
58
|
+
| Credits cap | $0.50, $1, $2, $5 | Largest estimated cold write on a `credits` model. |
|
|
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 until you leave the tab. 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.
|
|
59
61
|
|
|
60
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`.
|
|
61
63
|
|
|
62
64
|
## Safety and failure states
|
|
63
65
|
|
|
64
|
-
-
|
|
65
|
-
- Three launched
|
|
66
|
+
- A missing key or account ID, a classifier failure, or a policy refusal keeps the current model. Network refusal is never bypassed with a helper process.
|
|
67
|
+
- Three launched classifier failures open a 60-second pause for that classifier. One in-flight request is allowed per classifier in each active Mod instance. Pending host HTTP work blocks another request until it settles.
|
|
68
|
+
- A `router.json` with v0.8 gateway keys or the 1.1 `jev` section marks the router unavailable until the [migration command](configuration.md#convert-an-older-routerjson) converts it.
|
|
66
69
|
- Unsupported Claude Code versions and leftover v0.8 gateway settings (the `jev-router` model or the `127.0.0.1:43170` base URL) mark the router unavailable. `/router` lists the settings to remove. A local gateway does not run as part of this Mod.
|
|
67
70
|
- A context-window error makes that model ineligible until the next history reset. The Mod does not retry an Anthropic request after a stream begins.
|
|
68
71
|
- Unknown context retains the current model. There is no characters-to-tokens fallback.
|
|
@@ -73,6 +76,8 @@ The pane refuses to write through a symlink. A failed validation names the setti
|
|
|
73
76
|
|
|
74
77
|
The Team canary loaded the published 1.0.0 package with a full Sonnet baseline, reached the real Jev endpoint, and kept Sonnet on a `downgrade-pending` result. This was a routing smoke test, not a measured-savings trial.
|
|
75
78
|
|
|
79
|
+
On 2026-10-05, live probes of Clef and Clef Flash on Workers AI took 0.7 to 1.3 seconds per call, one call each, and returned the same answer shape as Jev inside Cloudflare's envelope. A rejected token returned HTTP 401, which the Mod reads as a rejected key. No Clef session has been evaluated for routing quality.
|
|
80
|
+
|
|
76
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/).
|
|
77
82
|
|
|
78
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 receives its own thinking mode and a 32K output cap. 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.
|
package/docs/router-band.svg
CHANGED
|
@@ -91,21 +91,21 @@
|
|
|
91
91
|
<text x="624.6" y="224" fill="#d0d0d0" xml:space="preserve"> · cache </text>
|
|
92
92
|
<text x="694.8" y="224" fill="#87d787" xml:space="preserve">100%</text>
|
|
93
93
|
<text x="741.6" y="224" fill="#d0d0d0" xml:space="preserve">Router</text>
|
|
94
|
-
<text class="cap" x="20" y="263">No classifier key: Router keeps the model and offers Set
|
|
94
|
+
<text class="cap" x="20" y="263">No classifier key: Router keeps the model and offers Set up</text>
|
|
95
95
|
<rect x="12" y="271" width="897.6" height="29" rx="5" fill="#232323"/>
|
|
96
|
-
<text x="24.0" y="289" fill="#
|
|
97
|
-
<text x="
|
|
98
|
-
<text x="
|
|
99
|
-
<text x="
|
|
100
|
-
<text x="
|
|
101
|
-
<text x="
|
|
102
|
-
<text x="
|
|
103
|
-
<text x="
|
|
104
|
-
<text x="
|
|
105
|
-
<text x="
|
|
106
|
-
<text x="
|
|
107
|
-
<text x="
|
|
108
|
-
<text x="
|
|
96
|
+
<text x="24.0" y="289" fill="#d7af5f" xml:space="preserve">⚠ Jev: no API key</text>
|
|
97
|
+
<text x="156.6" y="289" fill="#7c7c7c" xml:space="preserve"> · </text>
|
|
98
|
+
<text x="195.6" y="289" fill="#d0d0d0" xml:space="preserve">[ Set up ]</text>
|
|
99
|
+
<text x="273.6" y="289" fill="#7c7c7c" xml:space="preserve"> · </text>
|
|
100
|
+
<text x="312.6" y="289" fill="#5f9fe0" xml:space="preserve">▂</text>
|
|
101
|
+
<text x="320.4" y="289" fill="#5f9fe0" xml:space="preserve">▄</text>
|
|
102
|
+
<text x="328.2" y="289" fill="#7c7c7c" xml:space="preserve">▆</text>
|
|
103
|
+
<text x="336.0" y="289" fill="#7c7c7c" xml:space="preserve">█</text>
|
|
104
|
+
<text x="343.8" y="289" fill="#5f9fe0" font-weight="700" xml:space="preserve"> low </text>
|
|
105
|
+
<text x="382.8" y="289" fill="#d0d0d0" xml:space="preserve">Sonnet 5.5 · medium</text>
|
|
106
|
+
<text x="531.0" y="289" fill="#7c7c7c" xml:space="preserve"> · </text>
|
|
107
|
+
<text x="570.0" y="289" fill="#d7af5f" xml:space="preserve">keeping model</text>
|
|
108
|
+
<text x="687.0" y="289" fill="#d0d0d0" xml:space="preserve">Router</text>
|
|
109
109
|
<text class="cap" x="20" y="328">Manual: /model chose the model; Auto resumes routing</text>
|
|
110
110
|
<rect x="12" y="336" width="897.6" height="29" rx="5" fill="#232323"/>
|
|
111
111
|
<text x="24.0" y="354" fill="#7c7c7c" xml:space="preserve">○ </text>
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 594 515" role="img" aria-labelledby="title desc">
|
|
2
|
+
<title id="title">Router pane, Tuning tab</title>
|
|
3
|
+
<desc id="desc">The classifier rows with the active one marked, a missing Jev API key with Set up, Undo after a switch, the deadline, health, the receiving host and the credentials each classifier needs, then the policy controls.</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="515" rx="8" fill="#1c1c1c"/>
|
|
9
|
+
<rect x="10" y="10" width="574" height="495" 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: keep /model ]</text>
|
|
14
|
+
<text x="24.0" y="72" fill="#d0d0d0" xml:space="preserve">[ Now ]</text>
|
|
15
|
+
<text x="86.4" y="72" fill="#d0d0d0" xml:space="preserve">[ Tiers ]</text>
|
|
16
|
+
<text x="164.4" y="72" fill="#87afff" font-weight="700" xml:space="preserve">[ Tuning ]</text>
|
|
17
|
+
<text x="250.2" y="72" fill="#d0d0d0" xml:space="preserve">[ Usage ]</text>
|
|
18
|
+
<text x="328.2" y="72" fill="#d0d0d0" xml:space="preserve">[ ? ]</text>
|
|
19
|
+
<text x="24.0" y="110" fill="#5fafd7" font-weight="700" xml:space="preserve">CLASSIFIER · asked once per new turn</text>
|
|
20
|
+
<text x="24.0" y="129" fill="#d0d0d0" xml:space="preserve">[ ○ Jev ]</text>
|
|
21
|
+
<text x="164.4" y="129" fill="#7c7c7c" xml:space="preserve">api.typesafe.ai</text>
|
|
22
|
+
<text x="320.4" y="129" fill="#d7af5f" xml:space="preserve">○ no API key </text>
|
|
23
|
+
<text x="429.6" y="129" fill="#d0d0d0" xml:space="preserve">[ Set up ]</text>
|
|
24
|
+
<text x="24.0" y="148" fill="#d0d0d0" xml:space="preserve">[ ○ Clef ]</text>
|
|
25
|
+
<text x="164.4" y="148" fill="#7c7c7c" xml:space="preserve">api.cloudflare.com</text>
|
|
26
|
+
<text x="320.4" y="148" fill="#87d787" xml:space="preserve">● ready</text>
|
|
27
|
+
<text x="24.0" y="167" fill="#87afff" font-weight="700" xml:space="preserve">[ ◉ Clef Flash ]</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="#d7af5f" xml:space="preserve">Switched from Clef: Clef Flash from the next turn </text>
|
|
31
|
+
<text x="421.8" y="186" fill="#d0d0d0" xml:space="preserve">[ Undo ]</text>
|
|
32
|
+
<text x="24.0" y="205" fill="#d0d0d0" xml:space="preserve">Deadline</text>
|
|
33
|
+
<text x="94.2" y="205" fill="#d0d0d0" xml:space="preserve">3000 ms ▾</text>
|
|
34
|
+
<text x="187.8" y="205" fill="#7c7c7c" xml:space="preserve">then keep the model</text>
|
|
35
|
+
<text x="24.0" y="224" fill="#d0d0d0" xml:space="preserve">Health active · 0 recent failures</text>
|
|
36
|
+
<text x="24.0" y="243" fill="#7c7c7c" xml:space="preserve">Sends prompt + 6 recent turns → api.cloudflare.com</text>
|
|
37
|
+
<text x="24.0" y="262" fill="#d0d0d0" xml:space="preserve">Credentials </text>
|
|
38
|
+
<text x="125.4" y="262" fill="#d0d0d0" xml:space="preserve">[ Edit ]</text>
|
|
39
|
+
<text x="187.8" y="262" fill="#7c7c7c" xml:space="preserve"> opens /plugin configure</text>
|
|
40
|
+
<text x="24.0" y="281" fill="#7c7c7c" xml:space="preserve"> Jev: API key · Clef, Clef Flash: API token, account ID</text>
|
|
41
|
+
<text x="24.0" y="319" fill="#5fafd7" font-weight="700" xml:space="preserve">POLICY · future turns</text>
|
|
42
|
+
<text x="24.0" y="338" fill="#d0d0d0" xml:space="preserve">Votes to go down</text>
|
|
43
|
+
<text x="180.0" y="338" fill="#d0d0d0" xml:space="preserve">2 ▾</text>
|
|
44
|
+
<text x="289.2" y="338" fill="#7c7c7c" xml:space="preserve">agreeing turns before cheaper</text>
|
|
45
|
+
<text x="24.0" y="357" fill="#d0d0d0" xml:space="preserve">Payback horizon</text>
|
|
46
|
+
<text x="180.0" y="357" fill="#d0d0d0" xml:space="preserve">5 turns ▾</text>
|
|
47
|
+
<text x="289.2" y="357" fill="#7c7c7c" xml:space="preserve">a switch repays its cache</text>
|
|
48
|
+
<text x="24.0" y="376" fill="#d0d0d0" xml:space="preserve">Credits cap</text>
|
|
49
|
+
<text x="180.0" y="376" fill="#d0d0d0" xml:space="preserve">$2.00 ▾</text>
|
|
50
|
+
<text x="289.2" y="376" fill="#7c7c7c" xml:space="preserve">max cold write on credits</text>
|
|
51
|
+
<text x="24.0" y="395" fill="#7c7c7c" xml:space="preserve">[ Save tuning ]</text>
|
|
52
|
+
<text x="148.8" y="395" fill="#7c7c7c" xml:space="preserve">[ Discard ]</text>
|
|
53
|
+
<text x="24.0" y="433" fill="#5fafd7" font-weight="700" xml:space="preserve">CONFIG</text>
|
|
54
|
+
<text x="24.0" y="452" fill="#d0d0d0" xml:space="preserve">File ~/.claude/router.json </text>
|
|
55
|
+
<text x="273.6" y="452" fill="#d0d0d0" xml:space="preserve">[ copy ]</text>
|
|
56
|
+
<text x="24.0" y="471" fill="#7c7c7c" xml:space="preserve">Main conversation only. Subagents keep their own model.</text>
|
|
57
|
+
<text x="24.0" y="490" fill="#d0d0d0" xml:space="preserve">[ Close ]</text>
|
|
58
|
+
</svg>
|