@alexeiled/claude-router 0.7.2 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +1 -1
- package/CHANGELOG.md +24 -0
- package/README.md +9 -9
- package/docs/architecture.md +8 -3
- package/docs/configuration.md +11 -11
- package/docs/user-guide.md +2 -2
- package/lib/config.mjs +7 -5
- package/lib/cost.mjs +1 -1
- package/lib/gateway.mjs +1 -1
- package/package.json +1 -1
- package/scripts/git-hooks/pre-commit +17 -3
- package/skills/medium/SKILL.md +3 -3
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "router",
|
|
3
3
|
"displayName": "jev-router",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.8.0",
|
|
5
5
|
"description": "Auto-picks the right Claude model for each turn — small models for quick edits, mid-tier for code, frontier for hard problems. Uses Jev to classify each request.",
|
|
6
6
|
"author": { "name": "Alexei Ledenev", "url": "https://github.com/alexei-led" },
|
|
7
7
|
"repository": "https://github.com/alexei-led/claude-router",
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.8.0 (2026-10-01)
|
|
4
|
+
|
|
5
|
+
### Changed
|
|
6
|
+
|
|
7
|
+
- **Sonnet 5.5 replaces Sonnet 5.** The `sonnet` model is now
|
|
8
|
+
`claude-sonnet-5-5`, at the same prices. A live probe through Claude Code
|
|
9
|
+
2.1.286 shows it takes all five effort levels and all three request
|
|
10
|
+
features, so the gateway no longer adapts its history.
|
|
11
|
+
- **`medium` runs on Sonnet 5.5 at `xhigh`**, not on Opus 5.5 at `high`.
|
|
12
|
+
`/router:medium` changes with it. `high` stays Opus 5.5 at `xhigh`. From
|
|
13
|
+
2026-09-23 to 2026-10-01, 15 of 16 escalations from Sonnet moved the
|
|
14
|
+
session onto Opus for good, at about $31.6 of cold cache writes; most were
|
|
15
|
+
triggered by environment or hook errors, not by the model. An escalation
|
|
16
|
+
from `low` now stays on Sonnet.
|
|
17
|
+
|
|
18
|
+
### Upgrade
|
|
19
|
+
|
|
20
|
+
- If your `router.json` sets `models.sonnet.id` to `claude-sonnet-5`, also
|
|
21
|
+
set `"features": ["mid-conversation-system"]`. The new default lists all
|
|
22
|
+
three features, and Sonnet 5 answers the other two with 400.
|
|
23
|
+
- To keep the old `medium`, set
|
|
24
|
+
`"routes": { "medium": { "model": "opus", "effort": "high" } }` and change
|
|
25
|
+
`skills/medium/SKILL.md` to match.
|
|
26
|
+
|
|
3
27
|
## 0.7.2 (2026-09-25)
|
|
4
28
|
|
|
5
29
|
### Fixed
|
package/README.md
CHANGED
|
@@ -54,9 +54,9 @@ flowchart LR
|
|
|
54
54
|
|
|
55
55
|
A local gateway receives each request from Claude Code. It changes the model,
|
|
56
56
|
the effort and the thinking setting. For Haiku, it also limits the output
|
|
57
|
-
size. It does not change your prompt or your tools.
|
|
58
|
-
|
|
59
|
-
|
|
57
|
+
size. It does not change your prompt or your tools. Haiku does not accept all
|
|
58
|
+
the request features that Claude Code uses for Opus, so the gateway adapts
|
|
59
|
+
those parts of the history for it, as Claude Code itself does. Prompt
|
|
60
60
|
caching and a claude.ai login work as usual.
|
|
61
61
|
|
|
62
62
|
## How Jev selects a tier
|
|
@@ -76,12 +76,12 @@ flowchart LR
|
|
|
76
76
|
class R out
|
|
77
77
|
```
|
|
78
78
|
|
|
79
|
-
| Tier | Model and effort
|
|
80
|
-
| -------- |
|
|
81
|
-
| `micro` | Haiku 4.5, no thinking
|
|
82
|
-
| `low` | Sonnet 5, your effort
|
|
83
|
-
| `medium` |
|
|
84
|
-
| `high` | Opus 5.5, `xhigh` effort
|
|
79
|
+
| Tier | Model and effort | Jev selects it for |
|
|
80
|
+
| -------- | -------------------------- | --------------------------------------------------------------------- |
|
|
81
|
+
| `micro` | Haiku 4.5, no thinking | Lookups, trivial edits, one-step mechanical work |
|
|
82
|
+
| `low` | Sonnet 5.5, your effort | Clear, low-risk coding steps with one obvious approach |
|
|
83
|
+
| `medium` | Sonnet 5.5, `xhigh` effort | Features, bug fixes and refactors with interacting constraints |
|
|
84
|
+
| `high` | Opus 5.5, `xhigh` effort | Architecture, unclear bugs, security, work where correctness is vital |
|
|
85
85
|
|
|
86
86
|
The router tells Jev to put correctness before cost, and not to judge by prompt
|
|
87
87
|
length, language or single topic words. The router then keeps the choice
|
package/docs/architecture.md
CHANGED
|
@@ -61,9 +61,9 @@ flowchart TB
|
|
|
61
61
|
- Claude Code builds each request for the model that the alias behaves as
|
|
62
62
|
(Opus). A model without one of its [request features](configuration.md#models)
|
|
63
63
|
gets the request without it, the way Claude Code retries after a 400:
|
|
64
|
-
- no `mid-conversation-tool-changes` (
|
|
64
|
+
- no `mid-conversation-tool-changes` (Haiku): `tool_addition` and
|
|
65
65
|
`tool_removal` blocks go; their cache breakpoint moves to the block before;
|
|
66
|
-
- no `per-turn-control` (
|
|
66
|
+
- no `per-turn-control` (Haiku): the beta header and the
|
|
67
67
|
`output_config` on messages (the effort of each turn) go;
|
|
68
68
|
- no `mid-conversation-system` (Haiku): each `system` message becomes a
|
|
69
69
|
`<system-reminder>` text in the user message next to it.
|
|
@@ -427,7 +427,7 @@ To work on the code:
|
|
|
427
427
|
|
|
428
428
|
```sh
|
|
429
429
|
npm install
|
|
430
|
-
git config --local core.hooksPath scripts/git-hooks # Biome, tests and Gitleaks before commit and push
|
|
430
|
+
git config --local core.hooksPath scripts/git-hooks # Biome, ShellCheck, tests and Gitleaks before commit and push
|
|
431
431
|
npm test && npm run check # node:test, Biome
|
|
432
432
|
claude --plugin-dir . --model jev-router # with ANTHROPIC_BASE_URL and TYPESAFE_API_KEY
|
|
433
433
|
```
|
|
@@ -443,5 +443,10 @@ claude --plugin-dir . --model jev-router # with ANTHROPIC_BASE_URL
|
|
|
443
443
|
- `x-claude-code-agent-type` goes to the log only.
|
|
444
444
|
- The shadow estimate and the downgrade tax use the last output size for
|
|
445
445
|
both routes, but effort changes how much a model writes.
|
|
446
|
+
- Opus 5.5 and Sonnet 5.5 bind thinking blocks to the model and the
|
|
447
|
+
conversation. Anthropic answers a replay after a prefix change with 400 for
|
|
448
|
+
accounts created on or after 2026-08-31. A switch between the two, with
|
|
449
|
+
thinking blocks in the history, passed on one older account (2026-10-01);
|
|
450
|
+
no newer account was tested.
|
|
446
451
|
|
|
447
452
|
A day of real usage is in [Evaluation](evaluation.md).
|
package/docs/configuration.md
CHANGED
|
@@ -95,12 +95,12 @@ For example, to run `low` on Sonnet at `high` effort and give Jev more time:
|
|
|
95
95
|
|
|
96
96
|
### routes
|
|
97
97
|
|
|
98
|
-
| Tier | Default
|
|
99
|
-
| -------- |
|
|
100
|
-
| `high` | `{ "model": "opus", "effort": "xhigh" }`
|
|
101
|
-
| `medium` | `{ "model": "
|
|
102
|
-
| `low` | `{ "model": "sonnet" }`
|
|
103
|
-
| `micro` | `{ "model": "haiku" }`
|
|
98
|
+
| Tier | Default |
|
|
99
|
+
| -------- | ------------------------------------------ |
|
|
100
|
+
| `high` | `{ "model": "opus", "effort": "xhigh" }` |
|
|
101
|
+
| `medium` | `{ "model": "sonnet", "effort": "xhigh" }` |
|
|
102
|
+
| `low` | `{ "model": "sonnet" }` |
|
|
103
|
+
| `micro` | `{ "model": "haiku" }` |
|
|
104
104
|
|
|
105
105
|
`model` is a key of `models`. `effort` is `low`, `medium`, `high`, `xhigh` or
|
|
106
106
|
`max`. Without `effort`, the gateway keeps the effort that Claude Code sent.
|
|
@@ -109,11 +109,11 @@ A test makes sure that they agree.
|
|
|
109
109
|
|
|
110
110
|
### models
|
|
111
111
|
|
|
112
|
-
| Alias | `id`
|
|
113
|
-
| -------- |
|
|
114
|
-
| `opus` | `claude-opus-5-5`
|
|
115
|
-
| `sonnet` | `claude-sonnet-5`
|
|
116
|
-
| `haiku` | `claude-haiku-4-5`
|
|
112
|
+
| Alias | `id` | `input` | `output` | `cacheRead` | `contextWindow` | `maxOutput` | `billing` | `efforts` | `features` |
|
|
113
|
+
| -------- | ------------------- | ------- | -------- | ----------- | --------------- | ----------- | --------- | --------- | ---------- |
|
|
114
|
+
| `opus` | `claude-opus-5-5` | 4 | 20 | 0.2 | 1,000,000 | — | `plan` | all five | all three |
|
|
115
|
+
| `sonnet` | `claude-sonnet-5-5` | 2 | 10 | 0.2 | 1,000,000 | — | `plan` | all five | all three |
|
|
116
|
+
| `haiku` | `claude-haiku-4-5` | 1 | 5 | 0.1 | 200,000 | 64,000 | `plan` | none | none |
|
|
117
117
|
|
|
118
118
|
| Field | Meaning |
|
|
119
119
|
| ------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
package/docs/user-guide.md
CHANGED
|
@@ -18,7 +18,7 @@ to read what it does, and how to control it.
|
|
|
18
18
|
|
|
19
19
|
1. Start Claude Code. `/model` shows `Jev Router (auto)` as the model.
|
|
20
20
|
2. Send a prompt. If setup added the status line, it shows the route, for
|
|
21
|
-
example `jev-router ▸ sonnet-5 · high · same-tier`.
|
|
21
|
+
example `jev-router ▸ sonnet-5-5 · high · same-tier`.
|
|
22
22
|
3. Run `/router:status`. It shows `Jev routing: active.`
|
|
23
23
|
|
|
24
24
|
If a step fails, read [Troubleshooting](#troubleshooting).
|
|
@@ -101,7 +101,7 @@ Router v0.7.0, gateway: http://127.0.0.1:43170, alias `jev-router`.
|
|
|
101
101
|
Jev routing: active.
|
|
102
102
|
Default tier: low.
|
|
103
103
|
…
|
|
104
|
-
Last turn: low → claude-sonnet-5 at high, reason upgrade-pending, context 84210 tokens, cache reads 83904.
|
|
104
|
+
Last turn: low → claude-sonnet-5-5 at high, reason upgrade-pending, context 84210 tokens, cache reads 83904.
|
|
105
105
|
Why: Jev asked for a higher tier; the route stays until the votes and the mass are enough.
|
|
106
106
|
Estimate: upgrade mass 0.78 against a bar of 0.84, switching tax $0.66 at list prices, 1 vote(s) in a row, cache: candidate unknown, current warm.
|
|
107
107
|
```
|
package/lib/config.mjs
CHANGED
|
@@ -14,11 +14,13 @@ export const DEFAULTS = {
|
|
|
14
14
|
// the hooks start it again before the next prompt. Two hours outlast /loop wakeups and Monitor waits (up to one
|
|
15
15
|
// hour), which reach the gateway without a prompt. 0 keeps it running.
|
|
16
16
|
gateway: { port: 43170, alias: 'jev-router', baselineTier: 'low', auxiliaryTier: 'low', idleShutdownMs: 7_200_000 },
|
|
17
|
-
//
|
|
18
|
-
//
|
|
17
|
+
// Sonnet 5.5 is the worker: `low` at the effort the user picked, `medium` at xhigh, so an escalation from `low`
|
|
18
|
+
// stays on Sonnet's cache instead of a cold write to Opus. `high` is Opus 5.5 at xhigh, the strongest setting this
|
|
19
|
+
// router asks for: Anthropic keeps Opus for open-ended, long-horizon work. xhigh on Sonnet is not yet measured
|
|
20
|
+
// against Opus at high; the `observed` lines in decisions.jsonl are the input for that.
|
|
19
21
|
routes: {
|
|
20
22
|
high: { model: 'opus', effort: 'xhigh' },
|
|
21
|
-
medium: { model: '
|
|
23
|
+
medium: { model: 'sonnet', effort: 'xhigh' },
|
|
22
24
|
low: { model: 'sonnet' },
|
|
23
25
|
micro: { model: 'haiku' },
|
|
24
26
|
},
|
|
@@ -42,14 +44,14 @@ export const DEFAULTS = {
|
|
|
42
44
|
features: FEATURES,
|
|
43
45
|
},
|
|
44
46
|
sonnet: {
|
|
45
|
-
id: 'claude-sonnet-5',
|
|
47
|
+
id: 'claude-sonnet-5-5',
|
|
46
48
|
input: 2,
|
|
47
49
|
output: 10,
|
|
48
50
|
cacheRead: 0.2,
|
|
49
51
|
contextWindow: 1_000_000,
|
|
50
52
|
billing: 'plan',
|
|
51
53
|
efforts: EFFORTS,
|
|
52
|
-
features:
|
|
54
|
+
features: FEATURES,
|
|
53
55
|
},
|
|
54
56
|
// `maxOutput` caps `max_tokens`: Claude Code asks for 128K, Haiku 4.5 answers more than 64K with 400.
|
|
55
57
|
haiku: {
|
package/lib/cost.mjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { clampEffort } from './rewrite.mjs';
|
|
3
3
|
|
|
4
4
|
// The prompt cache belongs to a model, and its messages part to the effort too: a top-level effort change rewrites
|
|
5
|
-
// the messages cache.
|
|
5
|
+
// the messages cache. Sonnet at `high` and Sonnet at `xhigh` are two caches, not one.
|
|
6
6
|
export function cacheKey(modelId, effort) {
|
|
7
7
|
return effort ? `${modelId}@${effort}` : modelId;
|
|
8
8
|
}
|
package/lib/gateway.mjs
CHANGED
|
@@ -214,7 +214,7 @@ function errorBody(type, message) {
|
|
|
214
214
|
return { type: 'error', error: { type, message } };
|
|
215
215
|
}
|
|
216
216
|
|
|
217
|
-
// "Picks claude-opus-5-5 / claude-sonnet-5 / claude-haiku-4-5 and the effort for each turn"
|
|
217
|
+
// "Picks claude-opus-5-5 / claude-sonnet-5-5 / claude-haiku-4-5 and the effort for each turn"
|
|
218
218
|
export function routesDescription(config) {
|
|
219
219
|
const ids = [...new Set(Object.values(config.routes).map((r) => config.models[r.model].id))];
|
|
220
220
|
return `Picks ${ids.join(' / ')} and the effort for each turn`;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
|
-
# Staged-only checks: Biome on staged .mjs/.json,
|
|
3
|
-
# Full check/test/pack runs in pre-push.
|
|
2
|
+
# Staged-only checks: Biome on staged .mjs/.json, ShellCheck on staged shell
|
|
3
|
+
# scripts, Gitleaks on the staged diff. Full check/test/pack runs in pre-push.
|
|
4
4
|
set -euo pipefail
|
|
5
5
|
|
|
6
6
|
cd "$(git rev-parse --show-toplevel)"
|
|
@@ -16,12 +16,26 @@ command -v gitleaks >/dev/null || {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
files=()
|
|
19
|
+
shell_files=()
|
|
19
20
|
while IFS= read -r -d '' f; do
|
|
20
|
-
case "$f" in
|
|
21
|
+
case "$f" in
|
|
22
|
+
*.mjs | *.json) files+=("$f") ;;
|
|
23
|
+
*.sh | scripts/git-hooks/*) shell_files+=("$f") ;;
|
|
24
|
+
esac
|
|
21
25
|
done < <(git diff --cached --name-only -z --diff-filter=ACMR)
|
|
22
26
|
|
|
23
27
|
if [ "${#files[@]}" -gt 0 ]; then
|
|
24
28
|
"$biome" check --no-errors-on-unmatched -- "${files[@]}"
|
|
25
29
|
fi
|
|
26
30
|
|
|
31
|
+
# Checked only when shell files are staged, so contributors who never touch
|
|
32
|
+
# them don't need shellcheck installed.
|
|
33
|
+
if [ "${#shell_files[@]}" -gt 0 ]; then
|
|
34
|
+
command -v shellcheck >/dev/null || {
|
|
35
|
+
echo "pre-commit: shellcheck missing; run 'brew install shellcheck'" >&2
|
|
36
|
+
exit 1
|
|
37
|
+
}
|
|
38
|
+
shellcheck -- "${shell_files[@]}"
|
|
39
|
+
fi
|
|
40
|
+
|
|
27
41
|
gitleaks git --pre-commit --staged --redact --verbose --no-banner
|
package/skills/medium/SKILL.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: medium
|
|
3
3
|
disable-model-invocation: true
|
|
4
|
-
description: Manual pin: run this turn on
|
|
5
|
-
model:
|
|
6
|
-
effort:
|
|
4
|
+
description: Manual pin: run this turn on sonnet at xhigh effort. Use as /router:medium <prompt>.
|
|
5
|
+
model: sonnet
|
|
6
|
+
effort: xhigh
|
|
7
7
|
---
|
|
8
8
|
Routing tier applied. Continue with the user's request as written. Do not mention the router.
|