@alexeiled/claude-router 1.10.5 → 1.11.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 +1 -1
- package/CHANGELOG.md +11 -0
- package/README.md +2 -1
- package/docs/architecture.md +4 -4
- package/docs/configuration.md +3 -2
- package/docs/evaluation.md +1 -1
- package/docs/native-router.md +2 -2
- package/docs/router-pane-classifier.svg +49 -43
- package/docs/user-guide.md +14 -11
- package/lib/config.mjs +8 -0
- package/package.json +2 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "router",
|
|
3
3
|
"displayName": "Router",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.11.0",
|
|
5
5
|
"description": "Model and effort routing for the main conversation by task difficulty and activity, advised by a prompt classifier (Jev, Clef, Clef Flash, OpenAI or local Ollama). Subagents get one model at spawn: every agent that does not pin one.",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Alexei Ledenev",
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.11.0 (2026-10-13)
|
|
4
|
+
|
|
5
|
+
Clef Omni joins Clef and Clef Flash as a third Cloudflare classifier. It costs less than Clef, and in Cloudflare's benchmarks it leads the Clef family on intent classification.
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- Clef Omni (`clef-omni`), Cloudflare's 30B mixture-of-experts model (3B active) on Workers AI, as a built-in classifier. Select its row on the Classifier tab, or set `"classifier": "clef-omni"`. It takes the same `system-one` request and the same Cloudflare API token and account ID as Clef, with a 3,000 ms deadline. Cloudflare's list price is $0.15 per million input tokens, between Clef Flash ($0.038) and Clef ($0.24); output is free.
|
|
10
|
+
- The user guide compares the three Clef models on price and on Cloudflare's published benchmarks. No model wins every task.
|
|
11
|
+
|
|
12
|
+
Router sends Clef Omni text only, not images, audio or video. Clef Omni has no activity probe yet, so its Classifier tab row shows no accuracy or p95 latency. Router has not measured its routing quality, and its probabilities have not been compared with Jev's.
|
|
13
|
+
|
|
3
14
|
## 1.10.5 (2026-10-11)
|
|
4
15
|
|
|
5
16
|
The route now follows the task while it runs, for the tier and the activity, in both directions. Before, a turn was
|
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: Jev
|
|
6
|
+
**A Claude Code Mod that chooses a model and effort for each main-conversation turn, advised by a prompt classifier: Jev; Cloudflare's Clef, Clef Flash or Clef Omni; OpenAI; or a local Ollama model.**
|
|
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; an Ollama classifier calls an Ollama server that you run. Subagents get one model each when they start, chosen the same way: every agent whose definition names no model, says `model: inherit`, or sets `modelRouting: auto`. Their steps are never re-routed. See [Subagent routing](docs/configuration.md#subagent-routing).
|
|
9
9
|
|
|
@@ -16,6 +16,7 @@ The active classifier is asked at the start of each logical turn, for the tier a
|
|
|
16
16
|
| Jev | [typesafe.ai](https://typesafe.ai) | Jev API key | typesafe.ai | A third `choice` question in the same request |
|
|
17
17
|
| Clef | Cloudflare Workers AI, 27B | Cloudflare API token and account ID | Cloudflare | The same |
|
|
18
18
|
| Clef Flash | Cloudflare Workers AI, 9B | Cloudflare API token and account ID | Cloudflare | The same |
|
|
19
|
+
| Clef Omni | Cloudflare Workers AI, 30B MoE | Cloudflare API token and account ID | Cloudflare | The same |
|
|
19
20
|
| OpenAI | OpenAI, `gpt-6-luna` (public beta) | OpenAI API key | OpenAI (`api.openai.com`) | A second `choice` in `questions`, in the same request |
|
|
20
21
|
| Ollama | A local [Ollama](https://ollama.com) model | None | Stays on this machine | A second request: letters A to H, one token, if 300 ms or more remain |
|
|
21
22
|
|
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 the active classifier (Jev by default; Cloudflare's Clef or Clef
|
|
3
|
+
Claude Code owns the model request. The router Mod asks the active classifier (Jev by default; Cloudflare's Clef, Clef Flash or Clef Omni; OpenAI; or a local Ollama model) for tier advice and, unless `activityRouting` is `off`, the turn's activity, applies local routing policy, and changes only the next main-conversation step's model and effort. Subagent steps pass through unchanged; `subagentRouting` may choose a subagent's model once, at `agent.spawn` (see [Subagents](#subagents)).
|
|
4
4
|
|
|
5
5
|
## Request flow
|
|
6
6
|
|
|
@@ -30,9 +30,9 @@ 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. The Ollama classifier calls an Ollama server that you run; the Mod starts none.
|
|
32
32
|
|
|
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
|
|
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, Clef Flash and Clef Omni to Cloudflare Workers AI, OpenAI to api.openai.com. Ollama runs on this machine, so the text stays here. The Jev, Cloudflare, and OpenAI keys are sensitive plugin options; the Cloudflare account ID is a plain one that fills the endpoint. Ollama takes no key. The Mod does not receive Claude's Anthropic credentials.
|
|
34
34
|
|
|
35
|
-
Each classifier names its wire protocol, `api`, and `classifier-apis.mjs` holds one adapter per protocol. `system-one` (Jev, Clef, Clef Flash) sends the typed `state` and `questions` request and reads `answers.route`; Cloudflare's REST API wraps that answer in `{ result, success, errors }`, which the parser unwraps. `openai-decisions` (OpenAI) sends the state as `input` text and reads a `choice` answer plus a `predicate` for the continuation. `ollama` asks for one letter with thinking off and reads the log-probability of each letter from the top 20 candidates. A letter's probability is its share of the letters found there; a letter missing from the list counts as zero. The Ollama adapter asks no continuation question, so `continuation` is null there. Every adapter returns the same advice shape, so the routing policy is unchanged.
|
|
35
|
+
Each classifier names its wire protocol, `api`, and `classifier-apis.mjs` holds one adapter per protocol. `system-one` (Jev, Clef, Clef Flash, Clef Omni) sends the typed `state` and `questions` request and reads `answers.route`; Cloudflare's REST API wraps that answer in `{ result, success, errors }`, which the parser unwraps. `openai-decisions` (OpenAI) sends the state as `input` text and reads a `choice` answer plus a `predicate` for the continuation. `ollama` asks for one letter with thinking off and reads the log-probability of each letter from the top 20 candidates. A letter's probability is its share of the letters found there; a letter missing from the list counts as zero. The Ollama adapter asks no continuation question, so `continuation` is null there. Every adapter returns the same advice shape, so the routing policy is unchanged.
|
|
36
36
|
|
|
37
37
|
The advice also carries `activity`: `{ choice, probabilities }` over the seven activities and `uncertain`, or null. Each protocol asks for it differently:
|
|
38
38
|
|
|
@@ -135,7 +135,7 @@ Every spawn in `on` gets a record keyed by `agentId`, from `next(e)`'s answer. I
|
|
|
135
135
|
|
|
136
136
|
## Classifier deadline and failure handling
|
|
137
137
|
|
|
138
|
-
Each advice attempt has a total deadline, including any transient retry: 1,500 ms for Jev, 3,000 ms for Clef, Clef Flash and OpenAI, and 5,000 ms for Ollama by default. Ollama's first call after its model unloads can exceed that while the model loads. 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. The Ollama activity request is a second call inside the same deadline and the same in-flight slot. It is sent only when the route answer parsed and at least 300 ms remain, gets one attempt and no retry, and a timeout or error there returns the route advice with `activity: null`. It counts as no failure and never opens a pause. 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.
|
|
138
|
+
Each advice attempt has a total deadline, including any transient retry: 1,500 ms for Jev, 3,000 ms for Clef, Clef Flash, Clef Omni and OpenAI, and 5,000 ms for Ollama by default. Ollama's first call after its model unloads can exceed that while the model loads. 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. The Ollama activity request is a second call inside the same deadline and the same in-flight slot. It is sent only when the route answer parsed and at least 300 ms remain, gets one attempt and no retry, and a timeout or error there returns the route advice with `activity: null`. It counts as no failure and never opens a pause. 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.
|
|
139
139
|
|
|
140
140
|
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.
|
|
141
141
|
|
package/docs/configuration.md
CHANGED
|
@@ -7,7 +7,7 @@ The router works with its built-in defaults. Configure the key of the active cla
|
|
|
7
7
|
| Item | Where it lives | How to change it |
|
|
8
8
|
| ---------------------------------- | ----------------------------------------------- | ----------------------------------------------------------------------------------------------- |
|
|
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
|
-
| Cloudflare API token | Sensitive plugin option `cloudflare_api_token` | The same dialog. Used by Clef and Clef
|
|
10
|
+
| Cloudflare API token | Sensitive plugin option `cloudflare_api_token` | The same dialog. Used by Clef, Clef Flash and Clef Omni. |
|
|
11
11
|
| Cloudflare account ID | Plugin option `cloudflare_account_id` | The same dialog, or the config menu row. Not a secret. |
|
|
12
12
|
| OpenAI API key | Sensitive plugin option `openai_api_key` | The same dialog. Used only by the OpenAI classifier. Ollama needs no key. |
|
|
13
13
|
| Router settings and classifier | `router.json` in the active Claude Code profile | Edit the file directly, or use the pane's Routes, Policy and Classifier tabs. |
|
|
@@ -125,13 +125,14 @@ Switch the mode with `/router activities off|on`, or with the **Activity routing
|
|
|
125
125
|
|
|
126
126
|
## Classifiers
|
|
127
127
|
|
|
128
|
-
`classifier` names the active entry of `classifiers`. Each entry names its wire protocol in `api`: `system-one` for Jev, Clef and Clef
|
|
128
|
+
`classifier` names the active entry of `classifiers`. Each entry names its wire protocol in `api`: `system-one` for Jev, Clef, Clef Flash and Clef Omni, `openai-decisions` for OpenAI, and `ollama` for a local Ollama server. Every protocol is converted to the same advice, so the routing policy does not change with the classifier. Unless `activityRouting` is `off`, each one is also asked for the turn's [activity](#activity-routing); the answer is optional, and a missing or malformed one keeps the activity already running. Cloudflare wraps the System One answer in `{ result, success, errors }`; Router reads both forms.
|
|
129
129
|
|
|
130
130
|
| `classifier` | Endpoint | Request `model` | Key option | `timeoutMs` |
|
|
131
131
|
| ------------ | -------------------------------------------------------------------------------------------------------- | --------------- | ---------------------- | ----------: |
|
|
132
132
|
| `jev` | `https://api.typesafe.ai/v1/systemone` | `jev-1.13.0` | `typesafe_api_key` | `1500` |
|
|
133
133
|
| `clef` | `https://api.cloudflare.com/client/v4/accounts/{cloudflare_account_id}/ai/run/@cf/cloudflare/clef` | `clef` | `cloudflare_api_token` | `3000` |
|
|
134
134
|
| `clef-flash` | `https://api.cloudflare.com/client/v4/accounts/{cloudflare_account_id}/ai/run/@cf/cloudflare/clef-flash` | `clef-flash` | `cloudflare_api_token` | `3000` |
|
|
135
|
+
| `clef-omni` | `https://api.cloudflare.com/client/v4/accounts/{cloudflare_account_id}/ai/run/@cf/cloudflare/clef-omni` | `clef-omni` | `cloudflare_api_token` | `3000` |
|
|
135
136
|
| `openai` | `https://api.openai.com/v1/decisions` | `gpt-6-luna` | `openai_api_key` | `3000` |
|
|
136
137
|
| `ollama` | `http://127.0.0.1:11434/api/chat` | `qwen3.5:9b` | none | `5000` |
|
|
137
138
|
|
package/docs/evaluation.md
CHANGED
|
@@ -106,7 +106,7 @@ Five probe results are checked in, run on 2026-10-09 and 2026-10-10 (UTC) with t
|
|
|
106
106
|
| Clef Flash | 69 of 70 | 470 ms | 874 ms | [`activity-probe-clef-flash.json`](../experiments/mod-router/results/activity-probe-clef-flash.json) |
|
|
107
107
|
| Ollama | 66 of 70 | 2986 ms | 3483 ms | [`activity-probe-ollama.json`](../experiments/mod-router/results/activity-probe-ollama.json) |
|
|
108
108
|
|
|
109
|
-
Ollama's latency covers both requests and stays inside its 5000 ms deadline; on slower hardware the activity step is skipped when less than 300 ms remain. They measure the label on synthetic prompts, not routing quality or savings. The activity question costs little time: 30 alternating pairs of the same prompts, with and without it, gave Jev p50 259 ms both ways and p95 300 ms without, 306 ms with; OpenAI p50 163 ms and 162 ms, p95 296 ms and 349 ms. OpenAI's first request of a run took about 2.3 s of its 3000 ms deadline. The Classifier tab shows each result under its classifier, such as `activity probe 70/70 · p95 299 ms · Oct 10` (UTC date), when the classifier runs the probed model. The script regenerates `lib/probe-results.mjs` from the result files after each run; `npm run probe:results` does it alone, and a test fails when the two disagree. A run without a single activity answer (an activity or `uncertain`) or without a p95 latency, such as one with a revoked key or a model whose answers all lack the activity, exits with an error and writes neither file. `policy.activityMass` was not tuned on any classifier; run the probe before you trust it with a new one.
|
|
109
|
+
Ollama's latency covers both requests and stays inside its 5000 ms deadline; on slower hardware the activity step is skipped when less than 300 ms remain. They measure the label on synthetic prompts, not routing quality or savings. The activity question costs little time: 30 alternating pairs of the same prompts, with and without it, gave Jev p50 259 ms both ways and p95 300 ms without, 306 ms with; OpenAI p50 163 ms and 162 ms, p95 296 ms and 349 ms. OpenAI's first request of a run took about 2.3 s of its 3000 ms deadline. The Classifier tab shows each result under its classifier, such as `activity probe 70/70 · p95 299 ms · Oct 10` (UTC date), when the classifier runs the probed model. The script regenerates `lib/probe-results.mjs` from the result files after each run; `npm run probe:results` does it alone, and a test fails when the two disagree. A run without a single activity answer (an activity or `uncertain`) or without a p95 latency, such as one with a revoked key or a model whose answers all lack the activity, exits with an error and writes neither file. `policy.activityMass` was not tuned on any classifier; run the probe before you trust it with a new one. Clef Omni has no probe result yet, so its Classifier tab row shows none.
|
|
110
110
|
|
|
111
111
|
## Routing vs your model
|
|
112
112
|
|
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 the active classifier (Jev, Clef, Clef Flash, OpenAI, or Ollama) for a tier, and for the turn's activity unless `activityRouting` is `off`. It applies local policy and saves the route. Tool continuations reuse that route, except that a turn whose tool calls edit code moves up to the `code` route, and every `policy.reviewEveryRequests` requests a background classifier review may move it either way ([Changes during a task](user-guide.md#changes-during-a-task)). 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, Clef Flash, Clef Omni, OpenAI, or Ollama) for a tier, and for the turn's activity unless `activityRouting` is `off`. It applies local policy and saves the route. Tool continuations reuse that route, except that a turn whose tool calls edit code moves up to the `code` route, and every `policy.reviewEveryRequests` requests a background classifier review may move it either way ([Changes during a task](user-guide.md#changes-during-a-task)). 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
|
-
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. Jev, Clef, Clef Flash, and OpenAI receive the text on their services; Ollama receives it on this machine. [Configuration](configuration.md#classifiers) lists each host.
|
|
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. Jev, Clef, Clef Flash, Clef Omni, and OpenAI receive the text on their services; Ollama receives it on this machine. [Configuration](configuration.md#classifiers) lists each host.
|
|
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
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 672
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 672 610" role="img" aria-labelledby="title desc">
|
|
2
2
|
<title id="title">Router pane, Classifier tab</title>
|
|
3
3
|
<desc id="desc">One row per classifier to compare: where the prompt goes, its activity probe, its p95 wait and whether its credentials are complete, with Set up for a missing Jev API key; the active classifier’s deadline against its wait, the host that receives the prompt, health and credentials; the agreement with tools across sessions; and Undo after a switch.</desc>
|
|
4
4
|
<style>
|
|
5
5
|
text { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace; font-size: 13px; }
|
|
6
6
|
.cap { font-family: system-ui, -apple-system, 'Segoe UI', sans-serif; font-size: 12px; fill: #9a988f; }
|
|
7
7
|
</style>
|
|
8
|
-
<rect width="672" height="
|
|
9
|
-
<rect x="10" y="10" width="652" height="
|
|
8
|
+
<rect width="672" height="610" rx="8" fill="#1c1c1c"/>
|
|
9
|
+
<rect x="10" y="10" width="652" height="590" rx="6" fill="none" stroke="#3f5f8f"/>
|
|
10
10
|
<text x="24.0" y="34" fill="#5fafd7" font-weight="700" xml:space="preserve">ROUTING</text>
|
|
11
11
|
<rect x="94.2" y="20" width="62.4" height="18" rx="4" fill="#87afff"/>
|
|
12
12
|
<text x="94.2" y="34" fill="#0d1016" font-weight="700" xml:space="preserve">[ ◉ on ]</text>
|
|
@@ -49,45 +49,51 @@
|
|
|
49
49
|
<text x="382.8" y="167" fill="#d0d0d0" xml:space="preserve">874 ms</text>
|
|
50
50
|
<text x="460.8" y="167" fill="#87d787" xml:space="preserve">● ready</text>
|
|
51
51
|
<rect x="24.0" y="172" width="124.8" height="18" rx="4" fill="#2e3340"/>
|
|
52
|
-
<text x="24.0" y="186" fill="#d0d0d0" xml:space="preserve">[ ○
|
|
53
|
-
<text x="156.6" y="186" fill="#7c7c7c" xml:space="preserve">api.
|
|
54
|
-
<text x="320.4" y="186" fill="#
|
|
55
|
-
<text x="382.8" y="186" fill="#
|
|
56
|
-
<text x="460.8" y="186" fill="#
|
|
57
|
-
<rect x="570.0" y="172" width="78.0" height="18" rx="4" fill="#2e3340"/>
|
|
58
|
-
<text x="570.0" y="186" fill="#d0d0d0" xml:space="preserve">[ Set up ]</text>
|
|
52
|
+
<text x="24.0" y="186" fill="#d0d0d0" xml:space="preserve">[ ○ Clef Omni ]</text>
|
|
53
|
+
<text x="156.6" y="186" fill="#7c7c7c" xml:space="preserve">api.cloudflare.com</text>
|
|
54
|
+
<text x="320.4" y="186" fill="#7c7c7c" xml:space="preserve">—</text>
|
|
55
|
+
<text x="382.8" y="186" fill="#7c7c7c" xml:space="preserve">—</text>
|
|
56
|
+
<text x="460.8" y="186" fill="#87d787" xml:space="preserve">● ready</text>
|
|
59
57
|
<rect x="24.0" y="191" width="124.8" height="18" rx="4" fill="#2e3340"/>
|
|
60
|
-
<text x="24.0" y="205" fill="#d0d0d0" xml:space="preserve">[ ○
|
|
61
|
-
<text x="156.6" y="205" fill="#
|
|
62
|
-
<text x="320.4" y="205" fill="#d0d0d0" xml:space="preserve">
|
|
63
|
-
<text x="382.8" y="205" fill="#d0d0d0" xml:space="preserve">
|
|
64
|
-
<text x="460.8" y="205" fill="#
|
|
65
|
-
<
|
|
66
|
-
<text x="
|
|
67
|
-
<
|
|
68
|
-
<text x="24.0" y="
|
|
69
|
-
<text x="
|
|
70
|
-
<text x="
|
|
71
|
-
<text x="
|
|
72
|
-
<text x="
|
|
73
|
-
<text x="
|
|
74
|
-
<text x="24.0" y="
|
|
75
|
-
<text x="
|
|
76
|
-
<text x="
|
|
77
|
-
<text x="
|
|
78
|
-
<
|
|
79
|
-
<text x="
|
|
80
|
-
<text x="
|
|
81
|
-
<text x="
|
|
82
|
-
<text x="24.0" y="
|
|
83
|
-
<text x="
|
|
84
|
-
<text x="
|
|
85
|
-
<text x="24.0" y="
|
|
86
|
-
<
|
|
87
|
-
<text x="
|
|
88
|
-
<text x="
|
|
89
|
-
<
|
|
90
|
-
<text x="
|
|
91
|
-
<
|
|
92
|
-
<text x="24.0" y="
|
|
58
|
+
<text x="24.0" y="205" fill="#d0d0d0" xml:space="preserve">[ ○ OpenAI ]</text>
|
|
59
|
+
<text x="156.6" y="205" fill="#7c7c7c" xml:space="preserve">api.openai.com</text>
|
|
60
|
+
<text x="320.4" y="205" fill="#d0d0d0" xml:space="preserve">70/70</text>
|
|
61
|
+
<text x="382.8" y="205" fill="#d0d0d0" xml:space="preserve">286 ms</text>
|
|
62
|
+
<text x="460.8" y="205" fill="#d7af5f" xml:space="preserve">○ no API key </text>
|
|
63
|
+
<rect x="570.0" y="191" width="78.0" height="18" rx="4" fill="#2e3340"/>
|
|
64
|
+
<text x="570.0" y="205" fill="#d0d0d0" xml:space="preserve">[ Set up ]</text>
|
|
65
|
+
<rect x="24.0" y="210" width="124.8" height="18" rx="4" fill="#2e3340"/>
|
|
66
|
+
<text x="24.0" y="224" fill="#d0d0d0" xml:space="preserve">[ ○ Ollama ]</text>
|
|
67
|
+
<text x="156.6" y="224" fill="#87d787" xml:space="preserve">this machine</text>
|
|
68
|
+
<text x="320.4" y="224" fill="#d0d0d0" xml:space="preserve">66/70</text>
|
|
69
|
+
<text x="382.8" y="224" fill="#d0d0d0" xml:space="preserve">3483 ms</text>
|
|
70
|
+
<text x="460.8" y="224" fill="#87d787" xml:space="preserve">● ready</text>
|
|
71
|
+
<text x="24.0" y="243" fill="#7c7c7c" xml:space="preserve"> probe: test prompts with a known activity it answered right, and its p95 wait</text>
|
|
72
|
+
<text x="24.0" y="281" fill="#5fafd7" font-weight="700" xml:space="preserve">CLEF FLASH</text>
|
|
73
|
+
<text x="102.0" y="281" fill="#7c7c7c" xml:space="preserve"> · active</text>
|
|
74
|
+
<text x="24.0" y="300" fill="#d0d0d0" xml:space="preserve">Deadline</text>
|
|
75
|
+
<text x="117.6" y="300" fill="#d0d0d0" xml:space="preserve">3000 ms ▾</text>
|
|
76
|
+
<text x="211.2" y="300" fill="#7c7c7c" xml:space="preserve">p95 874 ms in its probe</text>
|
|
77
|
+
<text x="24.0" y="319" fill="#7c7c7c" xml:space="preserve"> past the deadline the turn keeps its model</text>
|
|
78
|
+
<text x="24.0" y="338" fill="#d0d0d0" xml:space="preserve">Sends</text>
|
|
79
|
+
<text x="117.6" y="338" fill="#d0d0d0" xml:space="preserve">prompt + 6 recent turns → api.cloudflare.com</text>
|
|
80
|
+
<text x="24.0" y="357" fill="#d0d0d0" xml:space="preserve">Health</text>
|
|
81
|
+
<text x="117.6" y="357" fill="#d0d0d0" xml:space="preserve">not paused</text>
|
|
82
|
+
<text x="195.6" y="357" fill="#d0d0d0" xml:space="preserve"> · 0 recent failures</text>
|
|
83
|
+
<text x="24.0" y="376" fill="#d0d0d0" xml:space="preserve">Credentials</text>
|
|
84
|
+
<rect x="117.6" y="362" width="62.4" height="18" rx="4" fill="#2e3340"/>
|
|
85
|
+
<text x="117.6" y="376" fill="#d0d0d0" xml:space="preserve">[ Edit ]</text>
|
|
86
|
+
<text x="180.0" y="376" fill="#7c7c7c" xml:space="preserve"> opens /plugin configure</text>
|
|
87
|
+
<text x="24.0" y="414" fill="#5fafd7" font-weight="700" xml:space="preserve">ACROSS SESSIONS · since the last reset</text>
|
|
88
|
+
<text x="24.0" y="433" fill="#d0d0d0" xml:space="preserve">Labelled 83 turns</text>
|
|
89
|
+
<text x="24.0" y="452" fill="#d0d0d0" xml:space="preserve">Agreement classifier vs tools: 78 of 83 turns (94%)</text>
|
|
90
|
+
<text x="24.0" y="471" fill="#d0d0d0" xml:space="preserve">Code/ops/explore classifier vs tools: 78 of 83 turns (94%)</text>
|
|
91
|
+
<text x="24.0" y="490" fill="#d0d0d0" xml:space="preserve">Mismatch code → read 4 · ops → code 1</text>
|
|
92
|
+
<text x="24.0" y="509" fill="#d0d0d0" xml:space="preserve">Activity moves 9 taken · 4 refused</text>
|
|
93
|
+
<text x="24.0" y="528" fill="#d0d0d0" xml:space="preserve">Escalations after a cheaper activity move: 0 in 7 moves</text>
|
|
94
|
+
<text x="24.0" y="566" fill="#87d787" xml:space="preserve">Saved: classifier Clef → Clef Flash. Applies from the next turn. </text>
|
|
95
|
+
<rect x="538.8" y="552" width="62.4" height="18" rx="4" fill="#2e3340"/>
|
|
96
|
+
<text x="538.8" y="566" fill="#d0d0d0" xml:space="preserve">[ Undo ]</text>
|
|
97
|
+
<rect x="24.0" y="571" width="70.2" height="18" rx="4" fill="#2e3340"/>
|
|
98
|
+
<text x="24.0" y="585" fill="#d0d0d0" xml:space="preserve">[ Close ]</text>
|
|
93
99
|
</svg>
|
package/docs/user-guide.md
CHANGED
|
@@ -20,7 +20,7 @@ In Claude Code:
|
|
|
20
20
|
1. Run `/plugin configure router`.
|
|
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
|
-
- **Clef** or **Clef
|
|
23
|
+
- **Clef**, **Clef Flash** or **Clef Omni** on Cloudflare Workers AI: the Cloudflare API token and the Cloudflare account ID. One token covers all three models.
|
|
24
24
|
- **OpenAI**: an OpenAI API key. The prompt text goes to OpenAI.
|
|
25
25
|
- **Ollama**: no credential. Run `ollama serve` and pull the model; the prompt text stays on this machine.
|
|
26
26
|
3. To use another classifier, open the pane's **Classifier** tab and select its row. See [Choose the classifier](#choose-the-classifier).
|
|
@@ -241,15 +241,18 @@ The **Policy** tab writes each control inside the sentence it completes, and nam
|
|
|
241
241
|
|
|
242
242
|
## Choose the classifier
|
|
243
243
|
|
|
244
|
-
Router asks one classifier per turn.
|
|
244
|
+
Router asks one classifier per turn. Six are built in:
|
|
245
245
|
|
|
246
|
-
| Classifier | Service
|
|
247
|
-
| ---------- |
|
|
248
|
-
| Jev | typesafe.ai
|
|
249
|
-
| Clef | Cloudflare Workers AI, 27B
|
|
250
|
-
| Clef Flash | Cloudflare Workers AI, 9B
|
|
251
|
-
|
|
|
252
|
-
|
|
|
246
|
+
| Classifier | Service | Credentials | Deadline |
|
|
247
|
+
| ---------- | ------------------------------ | ---------------------------------------------- | -------: |
|
|
248
|
+
| Jev | typesafe.ai | Jev API key | 1,500 ms |
|
|
249
|
+
| Clef | Cloudflare Workers AI, 27B | Cloudflare API token and Cloudflare account ID | 3,000 ms |
|
|
250
|
+
| Clef Flash | Cloudflare Workers AI, 9B | Cloudflare API token and Cloudflare account ID | 3,000 ms |
|
|
251
|
+
| Clef Omni | Cloudflare Workers AI, 30B MoE | Cloudflare API token and Cloudflare account ID | 3,000 ms |
|
|
252
|
+
| OpenAI | OpenAI, `gpt-6-luna` | OpenAI API key | 3,000 ms |
|
|
253
|
+
| Ollama | Local Ollama, `qwen3.5:9b` | None | 5,000 ms |
|
|
254
|
+
|
|
255
|
+
The three Clef models take the same request and the same Cloudflare credentials, so a switch between them changes only cost, speed and answers. Cloudflare bills input tokens only, per million: Clef Flash $0.038, Clef Omni $0.15, Clef $0.24 (list prices on 2026-10-13). A routing request is a few thousand tokens. In Cloudflare's own benchmarks no one model wins every task: Clef Omni leads on intent classification (BANKING77, CLINC150 with out-of-scope prompts), Clef on most of TypeSafe's workflow evals, and Clef Flash on tool-call tasks. Router has not measured Clef Omni on its own prompts yet. Clef Omni also reads images, audio and video; Router sends it text only.
|
|
253
256
|
|
|
254
257
|

|
|
255
258
|
|
|
@@ -263,7 +266,7 @@ Under the rows, a block for the active classifier:
|
|
|
263
266
|
- **Sends** names the service that receives prompt text. **Health** shows a pause, recent failures, and the last wait.
|
|
264
267
|
- **Credentials**: **Edit** opens Claude Code's secure plugin configuration, where you enter them.
|
|
265
268
|
|
|
266
|
-
With activity routing `on`, the activity question goes in the same request as the tier question (Ollama makes a second call), with the same text and nothing more. **Sends** names the service that receives the prompt and recent dialogue. With Clef or Clef
|
|
269
|
+
With activity routing `on`, the activity question goes in the same request as the tier question (Ollama makes a second call), with the same text and nothing more. **Sends** names the service that receives the prompt and recent dialogue. With Clef, Clef Flash or Clef Omni that is Cloudflare, not typesafe.ai; with OpenAI it is OpenAI; with Ollama it stays on this machine. Give the Cloudflare token Workers AI permissions only.
|
|
267
270
|
|
|
268
271
|
The routing policy thresholds were tuned against Jev's probabilities. Clef's, OpenAI's, and Ollama's probabilities have not been compared with Jev's, so the same prompt can switch tiers at a different point. Watch **Classifier support** for a few sessions before you rely on a new classifier.
|
|
269
272
|
|
|
@@ -299,7 +302,7 @@ To stop routing for a session, run `/router off`. To keep tier routing but stop
|
|
|
299
302
|
| Symptom | Cause | Fix |
|
|
300
303
|
| ------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
301
304
|
| Status says `no API key` or `no API token` | The active classifier's plugin option is unset or unavailable to this process. | Select **Set up** in the pane, or run `/plugin configure router`. Save the option and start a new turn. |
|
|
302
|
-
| Status says `no account ID` | Clef or Clef
|
|
305
|
+
| Status says `no account ID` | Clef, Clef Flash or Clef Omni is active without the Cloudflare account ID. | Run `/plugin configure router` and save the Cloudflare account ID. |
|
|
303
306
|
| Route stays on the current model | The classifier timed out, failed, is paused, or network policy refused it. | Read the status band and the pane header. Network policy refusal is not bypassed. |
|
|
304
307
|
| `/model` changed but routing stopped | Choosing a model turns routing off. | Run `/router auto` to turn routing back on. |
|
|
305
308
|
| Router reports invalid configuration | `router.json` is invalid, or project/local settings redirect the router profile. | Inspect `router.json`, remove project/local `HOME` or `CLAUDE_CONFIG_DIR` overrides, or run the [migration command](configuration.md#convert-an-older-routerjson). |
|
package/lib/config.mjs
CHANGED
|
@@ -159,6 +159,14 @@ export const DEFAULTS = {
|
|
|
159
159
|
keyOption: 'cloudflare_api_token',
|
|
160
160
|
timeoutMs: 3000,
|
|
161
161
|
},
|
|
162
|
+
'clef-omni': {
|
|
163
|
+
label: 'Clef Omni',
|
|
164
|
+
api: 'system-one',
|
|
165
|
+
endpoint: 'https://api.cloudflare.com/client/v4/accounts/{cloudflare_account_id}/ai/run/@cf/cloudflare/clef-omni',
|
|
166
|
+
model: 'clef-omni',
|
|
167
|
+
keyOption: 'cloudflare_api_token',
|
|
168
|
+
timeoutMs: 3000,
|
|
169
|
+
},
|
|
162
170
|
openai: {
|
|
163
171
|
label: 'OpenAI',
|
|
164
172
|
api: 'openai-decisions',
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alexeiled/claude-router",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "Native Claude Code Mod: model and effort routing for the main conversation, advised by Jev, Clef, Clef Flash, OpenAI or Ollama.",
|
|
3
|
+
"version": "1.11.0",
|
|
4
|
+
"description": "Native Claude Code Mod: model and effort routing for the main conversation, advised by Jev, Clef, Clef Flash, Clef Omni, OpenAI or Ollama.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Alexei Ledenev",
|
|
7
7
|
"repository": {
|