@alexeiled/claude-router 1.21.1 → 1.21.2

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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "router",
3
3
  "displayName": "Router",
4
- "version": "1.21.1",
4
+ "version": "1.21.2",
5
5
  "description": "Native model and effort routing within your provider. Anthropic, DeepSeek, z.ai, MiniMax, MiMo and Kimi defaults, custom provider profiles, classifier advice and one model per subagent.",
6
6
  "author": {
7
7
  "name": "Alexei Ledenev",
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.21.2 (2026-11-10)
4
+
5
+ ### Added
6
+
7
+ - Claude Fable 5.2 as the `fable` model alias: $8 / $40 per million tokens, $0.20 cache read, all five effort levels. No default route runs it; set it in `routes` or `activities`, for example `"high": { "model": "fable", "effort": "high" }`. See [configuration](docs/configuration.md#built-in-defaults) for when it costs less per task than Opus 5.5.
8
+ - An effort-only move on Fable 5.2 is priced as no cache write, as on the 5.5 models.
9
+ - `availableModels: ["fable"]` allows Fable models. A versioned entry such as `claude-fable-5-1` still admits only that version.
10
+
3
11
  ## 1.21.1 (2026-11-05)
4
12
 
5
13
  ### Changed
package/README.md CHANGED
@@ -20,7 +20,7 @@ With `CLAUDE_CONFIG_DIR`, put the file in that directory instead.
20
20
 
21
21
  | Built-in profile | Router file | Default models |
22
22
  | --- | --- | --- |
23
- | Anthropic, the default | `router.json` | Haiku 5.5, Sonnet 5.5, Opus 5.5 |
23
+ | Anthropic, the default | `router.json` | Haiku 5.5, Sonnet 5.5, Opus 5.5; Fable 5.2 for routes you set |
24
24
  | `deepseek` | `deepseek-router.json` | DeepSeek Flash, routed by effort |
25
25
  | `zai` | `zai-router.json` | GLM-5.3-Flash and GLM-5.3 |
26
26
  | `minimax` | `minimax-router.json` | MiniMax-M3.1-Flash, routed by effort |
@@ -172,7 +172,7 @@ Execution profile selection is fixed at session start by `CLAUDE_ROUTER_PROVIDER
172
172
 
173
173
  The explicit-cache rules below describe Anthropic. Automatic prefix-cache providers instead use observed hit/miss input rates, no write premium and no guaranteed TTL. Their future price bounds allow a full miss; counterfactual cache comparisons are omitted unless the observed route is identical. Same-model effort downgrades skip input-only payback, which cannot value generated thinking-token changes, but retain the vote, dwell and cold-input guards. Their cache observations remain effort-specific until sharing is established. `disabled` cache mode uses the uncached input rate throughout.
174
174
 
175
- Cache identity uses the response model ID with the `[1m]` context hint removed, plus the effective effort on models that keep one cache per effort. Opus 5.5, Sonnet 5.5, Haiku 5.5 and Fable 5.1 keep one cache across efforts with an API key or a Claude subscription (code.claude.com/docs/en/prompt-caching, "Changing effort level"), so an effort-only move costs no cache write there. The hook gives every effort its own cache when the session runs on Amazon Bedrock, Google Cloud, Microsoft Foundry, a custom `ANTHROPIC_BASE_URL`, or with `CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS` (`effortSplitsCache`). A HIPAA configuration is not visible to a Mod; there the router prices effort moves as free. The Haiku 4.5 dated snapshot has an explicit mapping; Haiku 5.5 has no dated ID. An unrecognized substituted model gets no cache credit for the requested route.
175
+ Cache identity uses the response model ID with the `[1m]` context hint removed, plus the effective effort on models that keep one cache per effort. Opus 5.5, Sonnet 5.5, Haiku 5.5, Fable 5.1 and Fable 5.2 keep one cache across efforts with an API key or a Claude subscription (code.claude.com/docs/en/prompt-caching, "Changing effort level"), so an effort-only move costs no cache write there. The hook gives every effort its own cache when the session runs on Amazon Bedrock, Google Cloud, Microsoft Foundry, a custom `ANTHROPIC_BASE_URL`, or with `CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS` (`effortSplitsCache`). A HIPAA configuration is not visible to a Mod; there the router prices effort moves as free. The Haiku 4.5 dated snapshot has an explicit mapping; Haiku 5.5 has no dated ID. An unrecognized substituted model gets no cache credit for the requested route.
176
176
 
177
177
  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.
178
178
 
@@ -127,10 +127,24 @@ To restore the 1.3 ladder, with Sonnet 5.5 at `low` on the session effort and Ha
127
127
  { "routes": { "low": { "model": "sonnet", "effort": null }, "micro": { "model": "haiku", "effort": "low" } } }
128
128
  ```
129
129
 
130
+ No default route runs Claude Fable 5.2 (`fable`). It costs twice Opus 5.5 per input and output token, with the same
131
+ $0.20 cache read. It costs less per task only against Opus at its top
132
+ efforts: on FrontierCode 2.0, Fable at `high` scored 45.3% at $6.72 per task and Opus at `max` 45.5% at $12.82
133
+ (Anthropic's system card, Cognition's runs). Artificial Analysis, with both at `max`, ranks Fable first (index 65 vs
134
+ 59) at $26.54 vs $10.04 and 44.6 vs 25.1 minutes per task. To run it where Opus would run at `xhigh` or `max`:
135
+
136
+ ```json
137
+ { "routes": { "high": { "model": "fable", "effort": "high" } } }
138
+ ```
139
+
140
+ Fable 5.2 requires 30-day data retention (no zero data retention) and has separate, lower rate limits than Opus 5.5.
141
+ A switch to or from it starts a new prompt cache, as any model switch does; its cache writes cost twice Opus's.
142
+
130
143
  Default model settings:
131
144
 
132
145
  | Alias | Input / output / cache read, USD per million tokens | Context window | Billing | Effort levels |
133
146
  | -------- | --------------------------------------------------- | -------------- | ------- | --------------------------------------- |
147
+ | `fable` | 8 / 40 / 0.2 | 1,000,000 | `plan` | `low`, `medium`, `high`, `xhigh`, `max` |
134
148
  | `opus` | 4 / 20 / 0.2 | 1,000,000 | `plan` | `low`, `medium`, `high`, `xhigh`, `max` |
135
149
  | `sonnet` | 2 / 10 / 0.1 | 1,000,000 | `plan` | `low`, `medium`, `high`, `xhigh`, `max` |
136
150
  | `haiku` | 0.1 / 0.5 / 0.01 | 1,000,000 | `plan` | `low`, `medium`, `high`, `xhigh`, `max` |
@@ -191,7 +205,7 @@ An override for a cell with no built-in names both fields, or inherits the missi
191
205
  - A cell cannot be `null`. To drop a built-in override, set it to the base route, for example `"ops": { "medium": { "model": "opus", "effort": "medium" } }`. The pane writes this for you when you press **Use tier model** on a built-in cell. The cell keeps that route if you later change the tier's route; drop it again then.
192
206
  - An override applies to whatever the tier's route is. If you move `routes.low` to Opus, the built-in `code` override at `low` still runs Sonnet. Set it to match, or remove it.
193
207
  - Unknown activities and tiers, unknown model aliases, and invalid efforts make the file invalid, like any other invalid setting. The pane refuses to save one and names it, such as `activities.code.low.model is not in models`.
194
- - The Routes tab counts the prompt caches the routes use: one per model on Opus 5.5, Sonnet 5.5, Haiku 5.5 and Fable 5.1, one per (model, effort) pair on a provider that caches each effort apart.
208
+ - The Routes tab counts the prompt caches the routes use: one per model on Opus 5.5, Sonnet 5.5, Haiku 5.5, Fable 5.1 and Fable 5.2, one per (model, effort) pair on a provider that caches each effort apart.
195
209
 
196
210
  `policy.activityMass` (default `0.6`) is the lowest probability at which an activity applies. The Policy tab sets it under **Activities**, from 50% to 80%. It has not been tuned on any classifier, and the probe results do not record probabilities, so there is no data to tune it on yet.
197
211
 
@@ -363,7 +377,7 @@ The pane writes a subset of these settings. The **Routes** and **Policy** tabs s
363
377
 
364
378
  A project can set the routing mode, and only that, in `.claude/router.json` in the directory Claude Code runs in: `{ "mode": "cost" }`. Any other content is ignored with a notice; it never makes routing unavailable. A session's `/router mode` beats it, and it beats the profile's `mode`. See [Routing modes](routing-modes.md).
365
379
 
366
- Opus 5.5, Sonnet 5.5, Haiku 5.5 and Fable 5.1 keep one prompt cache across effort levels, so the policy prices an effort-only move, such as Opus at `medium` to Opus at `high`, as no cache write. On Amazon Bedrock, Google Cloud, Microsoft Foundry, a custom `ANTHROPIC_BASE_URL`, or with `CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS`, each effort has its own cache and the move pays its write. A HIPAA configuration cannot be detected; the router then prices those moves as free.
380
+ Opus 5.5, Sonnet 5.5, Haiku 5.5, Fable 5.1 and Fable 5.2 keep one prompt cache across effort levels, so the policy prices an effort-only move, such as Opus at `medium` to Opus at `high`, as no cache write. On Amazon Bedrock, Google Cloud, Microsoft Foundry, a custom `ANTHROPIC_BASE_URL`, or with `CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS`, each effort has its own cache and the move pays its write. A HIPAA configuration cannot be detected; the router then prices those moves as free.
367
381
 
368
382
  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.
369
383
 
@@ -172,7 +172,7 @@ Limits:
172
172
  - Output length is held the same. A stronger model may write less, or finish in fewer tool steps; a cheaper one may need more. The readout cannot see either.
173
173
  - Answer quality is not measured. A saving bought with worse answers would read the same.
174
174
  - Your model's cache is simulated, and a five-minute session that the lifetime rule takes for one hour (a plan subscriber billed as overage) would read too much cache on your side.
175
- - A route that changes only the effort costs the same per token. On Opus 5.5, Sonnet 5.5, Haiku 5.5 and Fable 5.1 it shares your cache and reads $0.00; on a provider that caches each effort apart, it shows its cache writes.
175
+ - A route that changes only the effort costs the same per token. On Opus 5.5, Sonnet 5.5, Haiku 5.5, Fable 5.1 and Fable 5.2 it shares your cache and reads $0.00; on a provider that caches each effort apart, it shows its cache writes.
176
176
  - Classifier charges, replies with routing off, and the side calls the router does not see (titles, compaction, server-side tools) are not counted; Claude Code's `/cost` counts them. On a Claude plan the dollars stand for quota, not cash, and the pane marks them `≈`.
177
177
  - The usage records keep one record per session, by local calendar day, so sessions finishing turns at the same moment both count. A turn's switch counts on the day it ended, its replies on the days they arrived. Claude Code's store has no atomic update, which leaves these gaps: the same session open in two Claude Code processes at once can lose one's turn; a turn finishing in another process during **Delete history** can be lost; and a session's total from before a reset comes back if its first saved reply has the same millisecond as the reset, or if the system clock moved back across the reset. The router reads every session's record at session start and when the pane opens, so that read grows with the number of sessions kept. A session drops its days older than 400 days when it writes its record; on that read, another session's record with no day in the last 400 days is deleted, and past 1,000 records of other sessions those with the oldest last day go too. A record that does not read whole, such as one a later version wrote, counts toward the 1,000 but is never deleted. Totals kept before the dated usage records have no dates: All adds them, and the other periods leave them out.
178
178
 
package/lib/config.mjs CHANGED
@@ -75,7 +75,18 @@ export const DEFAULTS = {
75
75
  // `output` feeds the downgrade tax.
76
76
  // `efforts` lists what the model accepts; an empty list means no effort field and no adaptive thinking. A change
77
77
  // must also change test/fixtures/effort-support.json, from a new probe against the real API.
78
+ // Fable 5.2 is listed for routes you set; no default route runs it. At twice Opus 5.5's token price it costs less
79
+ // per task only against Opus at its top efforts: Fable at high matched Opus at max on FrontierCode 2.0 (45.3% vs
80
+ // 45.5%) at ~52% of the cost per task (Anthropic's system card). Artificial Analysis, both at max, puts it ahead
81
+ // (index 65 vs 59) at 2.6x the cost and 1.8x the time per task, so Opus 5.5 stays the default.
78
82
  models: {
83
+ fable: {
84
+ id: 'claude-fable-5-2',
85
+ ...listPrice('claude-fable-5-2'),
86
+ contextWindow: 1_000_000,
87
+ billing: 'plan',
88
+ efforts: EFFORTS,
89
+ },
79
90
  opus: {
80
91
  id: 'claude-opus-5-5',
81
92
  ...listPrice('claude-opus-5-5'),
package/lib/cost.mjs CHANGED
@@ -4,7 +4,13 @@ import { canonicalModel } from './providers.mjs';
4
4
  // Models that keep one prompt cache across effort levels with an API key or a Claude subscription
5
5
  // (code.claude.com/docs/en/prompt-caching, "Changing effort level"). A dated snapshot or a `[1m]` suffix is the same
6
6
  // model. `config.effortSplitsCache`, set by the hook from the session's provider, gives every effort its own cache.
7
- const EFFORT_SHARED_CACHE = ['claude-opus-5-5', 'claude-sonnet-5-5', 'claude-haiku-5-5', 'claude-fable-5-1'];
7
+ const EFFORT_SHARED_CACHE = [
8
+ 'claude-opus-5-5',
9
+ 'claude-sonnet-5-5',
10
+ 'claude-haiku-5-5',
11
+ 'claude-fable-5-1',
12
+ 'claude-fable-5-2',
13
+ ];
8
14
 
9
15
  export function effortSharesCache(config, modelId) {
10
16
  if (typeof modelId !== 'string' || config.cache.mode === 'disabled') return false;
package/lib/prices.mjs CHANGED
@@ -6,7 +6,7 @@
6
6
  export const PRICE_SOURCES = {
7
7
  anthropic: {
8
8
  url: 'https://platform.claude.com/docs/en/about-claude/pricing.md',
9
- checked: '2026-11-04',
9
+ checked: '2026-11-10',
10
10
  },
11
11
  deepseek: {
12
12
  url: 'https://api-docs.deepseek.com/quick_start/pricing.md',
@@ -32,6 +32,12 @@ export const PRICE_SOURCES = {
32
32
  };
33
33
 
34
34
  export const PRICES = {
35
+ 'claude-fable-5-2': {
36
+ source: 'anthropic',
37
+ input: 8,
38
+ output: 40,
39
+ cacheRead: 0.2,
40
+ },
35
41
  'claude-opus-5-5': {
36
42
  source: 'anthropic',
37
43
  input: 4,
package/lib/route.mjs CHANGED
@@ -130,7 +130,7 @@ export function isModelAllowed(requested, allowed, native) {
130
130
  const nativeModel = canonicalModel(native);
131
131
  const available = allowed.map(canonicalModel);
132
132
  if (available.includes('default') && id === nativeModel) return true;
133
- const family = /^claude-(opus|sonnet|haiku)-/.exec(id)?.[1];
133
+ const family = /^claude-(fable|opus|sonnet|haiku)-/.exec(id)?.[1];
134
134
  const specific = available.filter((v) => family && v.startsWith(`claude-${family}-`));
135
135
  if (specific.length) return specific.some((v) => id === v || id.startsWith(`${v}-`));
136
136
  return available.some(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alexeiled/claude-router",
3
- "version": "1.21.1",
3
+ "version": "1.21.2",
4
4
  "description": "Native Claude Code model and effort routing with Anthropic, DeepSeek, z.ai, MiniMax, MiMo and Kimi defaults, custom provider profiles, and classifier advice.",
5
5
  "license": "MIT",
6
6
  "author": "Alexei Ledenev",