Skip to content

Make Codex and Claude Code subscriptions go further: a local model router that gives routine agent work to economical models and keeps your strongest model for the hard parts.

docs: make the routing cache-cost article easier to follow (#128)

澄潭c3c239f18c48
diff --git a/apps/website/public/media/hiroute-cache-en-poster.jpg b/apps/website/public/media/hiroute-cache-en-poster.jpg
new file mode 100644
index 00000000..3961e1a1
Binary files /dev/null and b/apps/website/public/media/hiroute-cache-en-poster.jpg differ
diff --git a/apps/website/public/media/hiroute-cache-en.mp4 b/apps/website/public/media/hiroute-cache-en.mp4
new file mode 100644
index 00000000..077e88ec
Binary files /dev/null and b/apps/website/public/media/hiroute-cache-en.mp4 differ
diff --git a/apps/website/src/styles/site.css b/apps/website/src/styles/site.css
index 7ae50e28..bcd71694 100644
--- a/apps/website/src/styles/site.css
+++ b/apps/website/src/styles/site.css
@@ -489,6 +489,7 @@ html:lang(en) .section-title>p{flex:0 1 335px}
.news-article{max-width:860px;margin:24px auto}.news-article header{margin-bottom:32px}.news-shell time{font-size:14px;color:#606a7d}.news-prose{font-size:17px;line-height:1.85;overflow-wrap:anywhere}
.news-prose h2{font-size:27px;line-height:1.4;margin:48px 0 18px}.news-prose p,.news-prose ul,.news-prose ol{margin:20px 0}.news-prose ul,.news-prose ol{padding-left:26px}.news-prose li{margin:8px 0}
.news-prose img{display:block;width:100%;max-width:100%;height:auto;border-radius:14px;margin:30px auto}.news-prose a{color:#4055ce;text-decoration:underline;text-underline-offset:3px}
+.news-prose .article-video{margin:30px 0}.news-prose .article-video video{display:block;width:100%;height:auto;aspect-ratio:16/9;border-radius:14px;background:#0b1020}.news-prose .article-video figcaption{margin-top:10px;font-size:14px;line-height:1.6;color:#606a7d;text-align:center}
.news-prose table{display:block;overflow-x:auto;border-collapse:collapse;width:100%;font-size:14px;line-height:1.6;margin:28px 0}.news-prose th,.news-prose td{border:1px solid #dce1eb;padding:12px;min-width:100px;text-align:left}.news-prose th{background:#eef1f8}
.news-prose pre{overflow-x:auto;background:#172034;color:#e6edf8;padding:20px;border-radius:12px;font-size:14px;line-height:1.65}.news-prose code{font-size:.9em}.news-list{display:grid;gap:24px;margin:36px 0}.news-card{border:1px solid #dce1eb;border-radius:18px;padding:28px;background:white}.news-card h2{font-size:25px;line-height:1.4}.news-card p{line-height:1.75;color:#535d72}
@media(max-width:700px){.news-shell{padding-top:32px}.news-prose{font-size:16px}.news-card{padding:20px}.news-prose h2{font-size:23px}.news-prose th,.news-prose td{padding:8px}}
diff --git a/experiments/README.md b/experiments/README.md
index f3154f97..9067f12c 100644
--- a/experiments/README.md
+++ b/experiments/README.md
@@ -75,8 +75,9 @@ python3 experiments/cache_cost_analysis.py
The calculator verifies the frozen evidence before using its prices, fixed FX,
all-attempt usage and recorded delivery bounds. It preserves all three paired
-acceptance outcomes and computes an idealized all-input-cached Astra reference
-with each run's observed outputs held fixed. Prefix-loss examples are conditional
+acceptance outcomes and computes two idealized all-input-cached references with
+each run's observed outputs held fixed: mixed routing, to bound how much any cache
+loss can change its savings, and all-Astra, for the price-cut comparison. Prefix-loss examples are conditional
calculations, not measured cache-hit rates. This analysis adds no model calls and
changes neither the historical evidence nor its acceptance rules. Read the article
in [English](../news/2026-10-14-routing-cache-cost.en.md) or
@@ -89,6 +90,12 @@ evidence, distinguishing the whole native turn from its final stable Astra segme
The calculator includes the writing source hash and keeps decision reuse distinct
from cache hits.
+It also reports a hypothetical uniform Astra price-cut sensitivity: the whole-task
+break-even price for each pair, with Qwen prices, usage and outcomes held as
+recorded. The article's
+cache-cost figures are rebuilt with the other figures by
+`python3 experiments/render_figures.py`.
+
## Add an experiment
Create `cases/<name>/` with a README, task inputs, parameter/provenance record,
diff --git a/experiments/cache_cost_analysis.py b/experiments/cache_cost_analysis.py
index 12deb5d1..694616dc 100644
--- a/experiments/cache_cost_analysis.py
+++ b/experiments/cache_cost_analysis.py
@@ -92,15 +92,29 @@ def analyze():
decisions = sum((Decimal(c['accounting']['jev_reported_usd']) for c in strong['components']), Decimal(0))
ideal = (inputs * primary['cache_read'] + outputs * primary['output']) / million + decisions
mixed_upper = Decimal(mixed['usd']['upper'])
- headroom = ideal - mixed_upper
+ strong_lower = Decimal(strong['usd']['lower'])
+ mixed_attempts = [a for c in mixed['components'] for a in c['accounting']['attempts']]
+ require({a['model'] for a in mixed_attempts} == {'gpt-6-astra', 'qwen3.8-flash'}, 'mixed arm models changed')
+ mixed_decisions = sum((Decimal(c['accounting']['jev_reported_usd']) for c in mixed['components']), Decimal(0))
+ mixed_output = sum((a['usage']['output_tokens'] * rates[a['model']]['output'] for a in mixed_attempts), Decimal(0)) / million
+ # Mixed routing as if every input had hit the cache, with observed outputs and routing decisions fixed.
+ mixed_cached = sum((a['usage']['input_tokens'] * rates[a['model']]['cache_read'] for a in mixed_attempts), Decimal(0)) / million + mixed_output + mixed_decisions
+ mixed_astra = sum((Decimal(a['cost']['usd_upper']) for a in mixed_attempts if a['model'] == 'gpt-6-astra'), Decimal(0))
+ # Scale every Astra tariff by one factor; Qwen attempts and Jev decisions keep their recorded cost.
+ astra_break_even_scale = (mixed_upper - mixed_astra - decisions) / (ideal - decisions - mixed_astra)
pairs.append({
'pair': pair['pair'], 'both_deliveries_accepted': pair['accepted'],
'observed_savings_percent_floor': pair['conservative_savings_percent'],
'mixed_usd_upper': mixed_upper, 'astra_input_tokens': inputs, 'astra_output_tokens': outputs,
'astra_all_input_cached_hypothetical_usd': ideal,
'hypothetical_savings_percent_floor': ((1 - mixed_upper / ideal) * 100).quantize(Decimal('.01'), rounding=ROUND_FLOOR),
- 'additional_cost_break_even_usd': headroom,
- 'extra_astra_cache_write_tokens_at_break_even': headroom * million / (primary['cache_write'] - primary['cache_read']),
+ 'mixed_all_input_cached_hypothetical_usd': mixed_cached,
+ 'mixed_all_input_cached_savings_percent_floor': ((1 - mixed_cached / strong_lower) * 100).quantize(Decimal('.01'), rounding=ROUND_FLOOR),
+ 'mixed_output_usd': mixed_output,
+ 'mixed_astra_usd_upper': mixed_astra, 'strong_decisions_usd': decisions,
+ 'mixed_qwen_output_tokens': sum(a['usage']['output_tokens'] for a in mixed_attempts if a['model'] == 'qwen3.8-flash'),
+ 'mixed_qwen_cache_read_tokens': sum(a['usage']['cache_read_tokens'] or 0 for a in mixed_attempts if a['model'] == 'qwen3.8-flash'),
+ 'astra_price_break_even_percent_of_frozen': astra_break_even_scale * 100,
})
return {
'basis': 'Historical API-equivalent prices checked 2026-10-03; fixed 2026-09-30 FX, not current billing.',
@@ -134,6 +148,7 @@ def analyze():
'uncached_tokens_added_per_continuation': continuation_growth,
'hit_rate_examples': new_turn_examples, 'prefix_cost_by_direction': directions,
},
+ 'astra_price_sensitivity': 'Per-pair break-even assumes a uniform Astra price change; Qwen prices, usage and outcomes held fixed.',
'original_three_pair_gate_passed': assessment['original_three_pair_gate_passed'],
'paid_model_calls': 0,
}
diff --git a/experiments/render_figures.py b/experiments/render_figures.py
index 9742df21..afe19d9b 100644
--- a/experiments/render_figures.py
+++ b/experiments/render_figures.py
@@ -46,6 +46,133 @@ def render_handoffs(out, result):
(out / f'unattended-handoff-{lang}.svg').write_text(''.join(svg) + '\n')
+def _svg_frame(title, subtitle, height):
+ return [f'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 {height}" role="img">',
+ f'<title>{escape(title)}</title><rect width="1000" height="{height}" rx="20" fill="#eef2fa"/>',
+ '<g font-family="system-ui,sans-serif" fill="#192439">',
+ f'<text x="32" y="46" font-size="24" font-weight="700">{escape(title)}</text>',
+ f'<text x="32" y="76" font-size="15" fill="#536079">{escape(subtitle)}</text>']
+
+
+def _svg_text(x, y, value, size=14, anchor='start', weight=400, fill='#192439'):
+ return f'<text x="{x:.1f}" y="{y:.1f}" font-size="{size}" font-weight="{weight}" text-anchor="{anchor}" fill="{fill}">{escape(value)}</text>'
+
+
+def _write_svg(path, parts):
+ path.write_text(''.join(parts + ['</g></svg>']) + '\n')
+
+
+def render_cache_cost(out):
+ """Cache-cost article figures, drawn from the same calculator that verifies the article's numbers."""
+ import math
+ from cache_cost_analysis import analyze
+ data = analyze()
+ scenario = data['new_user_turn_scenario']
+ prefix, new_input, growth = (scenario[k] for k in ('old_reusable_prefix_tokens', 'new_uncached_input_tokens', 'uncached_tokens_added_per_continuation'))
+ pair = next(p for p in data['pairs'] if p['pair'] == 3) # the accepted pair with the smaller margin
+ if not pair['both_deliveries_accepted']:
+ raise ValueError('The conservative figure pair must meet the delivery standard in both arms.')
+ deliveries = json.loads((RESULTS / 'deliveries.json').read_text())['rows']
+ strong_lower = float(next(r for r in deliveries if r['id'] == 'formal-draft98-v1-p03-strong')['usd']['lower'])
+ ideal, mixed = float(pair['astra_all_input_cached_hypothetical_usd']), float(pair['mixed_usd_upper'])
+ mixed_astra = float(pair['mixed_astra_usd_upper'])
+ mixed_cached, mixed_output = float(pair['mixed_all_input_cached_hypothetical_usd']), float(pair['mixed_output_usd'])
+ saved = float(pair['observed_savings_percent_floor'])
+ saved_cached = float(pair['mixed_all_input_cached_savings_percent_floor'])
+ break_even = float(pair['astra_price_break_even_percent_of_frozen']) / 100
+ for lang in ['zh', 'en']:
+ zh = lang == 'zh'
+ # 1. One cold switch spread across the turn.
+ parts = _svg_frame('切换一次,损失会被后续调用摊薄' if zh else 'One switch, spread across the turn',
+ '示例:10 万 token 旧对话 + 新消息,切换后第一次请求完全没有缓存' if zh else
+ 'Example: a 100,000-token conversation, a new message, and a fully cold first request', 500)
+ x0, x1, y0, y1 = 96, 950, 110, 390
+ px = lambda n: x0 + (n - 1) / 19 * (x1 - x0)
+ py = lambda v: y1 - v / 100 * (y1 - y0)
+ rows = []
+ for n in range(1, 21):
+ total = n * (prefix + new_input) + growth * n * (n - 1) // 2
+ uncached = new_input + (n - 1) * growth
+ rows.append((n, (total - uncached) / total * 100, (total - uncached - prefix) / total * 100))
+ for v in (0, 25, 50, 75, 100):
+ parts.append(f'<path d="M {x0} {py(v):.1f} H {x1}" stroke="#d3d9e8"/>')
+ parts.append(_svg_text(x0 - 10, py(v) + 5, f'{v}%', 13, 'end', fill='#536079'))
+ for n in (1, 5, 10, 14, 20):
+ parts.append(_svg_text(px(n), y1 + 24, str(n), 13, 'middle', fill='#536079'))
+ parts.append(_svg_text((x0 + x1) / 2, y1 + 46, '这一轮的调用次数' if zh else 'Calls in the turn', 14, 'middle', fill='#536079'))
+ gap = ' '.join(f'{px(n):.1f},{py(a):.1f}' for n, a, _ in rows) + ' ' + ' '.join(f'{px(n):.1f},{py(b):.1f}' for n, _, b in reversed(rows))
+ parts.append(f'<polygon points="{gap}" fill="#f4c7a5" opacity=".55"/>')
+ for index, color in ((1, '#5564bd'), (2, '#d0652a')):
+ line = ' '.join(f'{px(r[0]):.1f},{py(r[index]):.1f}' for r in rows)
+ parts.append(f'<polyline points="{line}" fill="none" stroke="{color}" stroke-width="3"/>')
+ for n, a, b in rows:
+ if n in (1, 5, 14, 20):
+ parts.append(f'<circle cx="{px(n):.1f}" cy="{py(b):.1f}" r="5" fill="#d0652a"/>')
+ label = (f'差 {a - b:.1f} 个百分点' if zh else f'{a - b:.1f} points lower')
+ dy = -12 if n == 1 else 22
+ parts.append(_svg_text(px(n) + (12 if n < 20 else -12), py(b) + dy, label, 13, 'start' if n < 20 else 'end', 700, '#9c4317'))
+ for index, (name, color) in enumerate([('不切换' if zh else 'No switch', '#5564bd'), ('切换一次' if zh else 'One switch', '#d0652a')]):
+ lx = x1 - 250 + index * 130
+ parts.append(f'<path d="M {lx} 96 h 24" stroke="{color}" stroke-width="3"/>')
+ parts.append(_svg_text(lx + 32, 101, name, 14, weight=700, fill=color))
+ parts.append(_svg_text(32, 484, '整轮命中率 = 命中缓存的输入 ÷ 全部输入。规律:一轮调用 n 次,切换一次最多让命中率下降 1/n。' if zh else
+ 'Turn hit rate = cached input ÷ all input. Rule: with n calls, one switch lowers it by at most 1/n.', 13, fill='#536079'))
+ _write_svg(out / f'cache-amortization-{lang}.svg', parts)
+
+ # 2. The same mixed run with and without a perfect cache, next to all-Astra.
+ points = round(saved_cached - saved)
+ parts = _svg_frame(f'缓存全命中,也只多省约 {points} 个百分点' if zh else f'A perfect cache would add only about {points} points of savings',
+ 'Astra × Qwen 实验第 3 组(两组达标运行中缓存影响较大的一组),美元/单' if zh else
+ 'Astra × Qwen experiment, pair 3 (the accepted pair where caching matters more), USD per task', 330)
+ x0, x1, scale = 380, 860, 2.2
+ bx = lambda v: x0 + v / scale * (x1 - x0)
+ bars = [('全用 Astra(实际记录)' if zh else 'All Astra (recorded)', strong_lower, '#5564bd', None),
+ ('HiRoute 混合(实际记录,Qwen 零缓存命中)' if zh else 'HiRoute mixed (recorded, no Qwen cache hits)', mixed, '#078677', saved),
+ ('HiRoute 混合(假设输入全部命中缓存)' if zh else 'HiRoute mixed, if every input hit the cache', mixed_cached, '#5fb8a9', saved_cached)]
+ y = 110
+ for label, value, color, percent in bars:
+ parts.append(_svg_text(x0 - 12, y + 21, label, 14, 'end'))
+ parts.append(f'<rect x="{x0}" y="{y + 4}" width="{bx(value) - x0:.1f}" height="26" rx="4" fill="{color}"/>')
+ parts.append(_svg_text(bx(value) + 8, y + 22, f'${value:.3f}', 14, weight=700))
+ if percent is not None:
+ parts.append(_svg_text(bx(max(mixed, mixed_cached)) + 84, y + 22, (f'省 {percent:.0f}%' if zh else f'{percent:.0f}% saved'), 15, weight=700, fill='#056356'))
+ y += 52
+ parts.append(_svg_text(32, y + 30, f'缓存只给输入打折。即使输入全部命中,混合路由剩下的 ${mixed_cached:.3f} 里仍有 ${mixed_output:.3f} 是输出费用。' if zh else
+ f'Caching only discounts input. Even fully cached, ${mixed_output:.3f} of the remaining ${mixed_cached:.3f} is output.', 13, fill='#536079'))
+ _write_svg(out / f'cache-impact-{lang}.svg', parts)
+
+ # 3. Hypothetical Astra price cuts: all-Astra cost as a multiple of mixed routing.
+ parts = _svg_frame('Astra 要降价约 95%,两种方案才打平' if zh else 'Astra would need a ~95% price cut to break even',
+ '假设 Astra 各项单价同比例下调,Qwen 价格、用量和交付结果不变;全用 Astra 仍按输入全命中缓存计算' if zh else
+ 'Uniform Astra price cuts; Qwen prices, usage and outcomes fixed; all-Astra still has every input cached', 505)
+ x0, x1, y0, y1 = 96, 930, 110, 400
+ low = .02
+ sx = lambda s: x0 + (math.log(s) - math.log(low)) / -math.log(low) * (x1 - x0)
+ sy = lambda r: y1 - r / 12 * (y1 - y0)
+ ratio = lambda s: ideal * s / (mixed_astra * s + mixed - mixed_astra)
+ parts.append(f'<rect x="{x0}" y="{sy(1):.1f}" width="{x1 - x0}" height="{y1 - sy(1):.1f}" fill="#f6dccb" opacity=".7"/>')
+ parts.append(_svg_text(x1 - 10, y1 - 7, '低于 1×:全用 Astra 更便宜' if zh else 'Below 1×: all Astra is cheaper', 13, 'end', fill='#9c4317'))
+ for r in (0, 1, 3, 6, 9, 12):
+ parts.append(f'<path d="M {x0} {sy(r):.1f} H {x1}" stroke="#d3d9e8"/>')
+ if r:
+ parts.append(_svg_text(x0 - 10, sy(r) + 5, f'{r}×', 13, 'end', fill='#536079'))
+ for s in (.02, .05, .1, .2, .5, 1):
+ parts.append(_svg_text(sx(s), y1 + 24, f'{s * 100:.0f}%', 13, 'middle', fill='#536079'))
+ parts.append(_svg_text((x0 + x1) / 2, y1 + 50, 'Astra 价格(今天 = 100%,对数刻度)' if zh else 'Astra price (today = 100%, log scale)', 14, 'middle', fill='#536079'))
+ parts.append(_svg_text(x0, 100, '全用 Astra 的花费 ÷ 混合路由的花费' if zh else 'All-Astra cost ÷ mixed-routing cost', 13, fill='#536079'))
+ steps = 160
+ curve = ' '.join(f'{sx(low ** (1 - i / steps)):.1f},{sy(ratio(low ** (1 - i / steps))):.1f}' for i in range(steps + 1))
+ parts.append(f'<polyline points="{curve}" fill="none" stroke="#5564bd" stroke-width="3"/>')
+ for s in (1, .5, .2, .1):
+ parts.append(f'<circle cx="{sx(s):.1f}" cy="{sy(ratio(s)):.1f}" r="5" fill="#5564bd"/>')
+ parts.append(_svg_text(sx(s), sy(ratio(s)) - 12, (f'{ratio(s):.1f} 倍' if zh else f'{ratio(s):.1f}×'), 14, 'middle', 700, '#3a4796'))
+ parts.append(f'<circle cx="{sx(break_even):.1f}" cy="{sy(1):.1f}" r="6" fill="#d0652a"/>')
+ parts.append(_svg_text(sx(break_even) - 12, sy(1) - 14, (f'打平:约今天的 {break_even * 100:.1f}%' if zh else f'Break-even: about {break_even * 100:.1f}% of today'), 14, 'end', 700, '#9c4317'))
+ parts.append(_svg_text(32, 488, '第 3 组数据;混合方案取成本上限,其中 Qwen 输入全部按未命中缓存计费。' if zh else
+ 'Pair 3; mixed routing uses its cost upper bound, with every Qwen input billed as uncached.', 13, fill='#536079'))
+ _write_svg(out / f'cache-price-break-even-{lang}.svg', parts)
+
+
def render():
result = report()
out = ROOT.parent / 'news/assets'
@@ -85,6 +212,7 @@ def render():
target.write_text('\n'.join(line.rstrip() for line in target.read_text().splitlines()) + '\n')
plt.close(fig)
render_handoffs(out, result)
+ render_cache_cost(out)
if __name__=='__main__':render()
diff --git a/news/2026-10-14-routing-cache-cost.en.md b/news/2026-10-14-routing-cache-cost.en.md
index 1fed2892..2ded4665 100644
--- a/news/2026-10-14-routing-cache-cost.en.md
+++ b/news/2026-10-14-routing-cache-cost.en.md
@@ -1,168 +1,101 @@
-# Model Switching Cache Effects and Smart Routing Costs
+# Switching Models Loses Cache, Not the Savings
-Smart routing assigns work to different models. A natural concern follows: could the cache lost in a model switch consume the money saved?
+Smart routing gives different work to different models. A natural question follows: once the model changes, the cache built up so far is no longer usable. Could that loss eat the money routing saves?
-HiRoute reduces that overhead in two ways: **keep the model stable through consecutive tool calls within a turn, and reassess at context-rebuild boundaries where less reusable history may be lost.** For switches that do occur, cache rebuilding belongs in the whole-task bill.
+**Short answer: some cache is lost, but nowhere near enough to cancel the savings.**
-We explain the protections first, then use observed call counts and the Astra × Qwen experiment to calculate cache effects and total costs separately.
+- **Switches are rare to begin with.** HiRoute keeps the same model through consecutive tool calls within a turn, and only reconsiders at points such as a new user message or context compaction. In one 40-request coding run, 35 requests simply kept the existing choice.
+- **The loss happens once and gets spread out.** Only the first request after a switch misses the cache; later calls use the cache again.
+- **Switching to a cheaper model can even lower the cost of old context.** A cheap model processing it from scratch often costs less than an expensive model reading its cache.
+- **Caching moves the saving by only a few points.** In the Astra × Qwen experiment, mixed routing saved about 91% even though its Qwen calls hit no cache at all. Had every input hit the cache, the saving would have been about 94%.
-## How HiRoute protects cache reuse
+HiRoute decides when switches happen, so you do not need to work out the math before turning on Smart saving. The sections below explain each point.
-KV Cache stores context states already computed by a model. Keeping the model and context prefix stable lets later requests read cached history and process new content. A destination without that cache must process the old prefix again, but subsequent calls can reuse the cache it builds.
+<figure class="article-video"><video controls playsinline preload="none" poster="/media/hiroute-cache-en-poster.jpg" aria-label="Three-minute video: switching models loses cache, not the savings"><source src="/media/hiroute-cache-en.mp4" type="video/mp4"></video><figcaption>Three-minute video version: English narration, English and Chinese subtitles</figcaption></figure>
-HiRoute's context-hold mechanism, ContextHold, recognizes session and history continuity and retains valid execution preferences:
+## First: what does caching save?
-| Execution boundary | HiRoute behavior | Effect on caching |
-| --- | --- | --- |
-| Consecutive tool calls within a turn | When the turn is recognizable, history is continuous, and the decision is valid, reuse it and prefer the eligible current model in the selected group | Avoid selecting a model afresh on every tool round-trip; reuse the growing prefix |
-| New user message | Reassess the task, keeping or changing the model | Keeping the model can retain the old cache; switching requires accounting for the full reusable prefix lost |
-| Compaction or history rebuild | Keep a reusable decision; otherwise reassess | Some history already needs rebuilding, so additional losses may shrink to the remaining reusable prefix |
-
-Actual hits depend on upstream cache rules and lifetime; an unavailable candidate can still trigger failover. HiRoute uses continuity to reduce unnecessary switches. See the [model-routing guide](https://hiroute.ai/en/docs/model-routing/) for selection rules.
-
-## Spreading the loss from a new-user-message switch
-
-A new user message usually appends to history, leaving the old prefix reusable. Switching to a completely cold model can lose that cache on the first request. Keeping subsequent tool calls stable spreads the loss across the turn.
-
-The calculations use a token-weighted input hit rate. To isolate one switch, assume identical input sequences on both paths, a valid original cache, a fully cold destination on the first call, and normal prefix reuse afterward with no further switches, compaction, or expiration. Define:
-
-- `P`: old prefix tokens that would have hit.
-- `U`: the new user message and other uncached input tokens.
-- `n`: model calls in the turn, including the first call.
-- `g`: uncached tokens added by each tool continuation, held constant in this example.
-
-On the first request, staying with the model gives a hit rate of `P / (P + U)`; a cold switch gives zero. With a 100,000-token prefix and 1,000 new tokens, the request drops from **99.01% to 0%**.
-
-Input on call `i` is `P + U + (i − 1)g`, so:
-
-**Total turn input T = n(P + U) + g × n(n − 1) / 2.**
-
-Without switching, uncached input totals `U + (n − 1)g`. A first-call cold switch adds one loss of `P` tokens. Therefore:
-
-**Turn hit-rate reduction = P / T ≤ 1 / n.**
-
-The bound follows from every input containing `P`, so `T ≥ nP`. Under these conditions, fourteen consecutive calls bound the reduction at approximately **7.14 percentage points**, and twenty at **5 percentage points**.
-
-With `P = 100,000`, `U = 1,000`, and `g = 2,000`, the example becomes:
-
-| Calls in the turn | Total input T | No-switch hit rate | First-call cold-switch hit rate | Reduction |
-| --- | ---: | ---: | ---: | ---: |
-| 1 | 101,000 | 99.01% | 0.00% | 99.01 percentage points |
-| 5 | 525,000 | 98.29% | 79.24% | 19.05 percentage points |
-| 14 | 1,596,000 | 98.31% | 92.04% | 6.27 percentage points |
-| 20 | 2,400,000 | 98.38% | 94.21% | 4.17 percentage points |
-
-**Continuous execution spreads a large first-request loss across the execution stage.** Frequent switches between short turns with long histories remain costly. If the destination has a partially valid prefix, count only the difference; keeping the original model causes no switching loss. Multiple switches require summing their losses rather than applying the single-switch bound.
+Each time an agent calls a model, it resends the whole conversation: system instructions, tool definitions, earlier messages and tool results. The longer the conversation, the more content is repeated on every call.
-### How many calls occurred in real experiments
+KV Cache lets the model remember the beginning it has already processed, called the "prefix" below. When the next request starts the same way, the model reads the cache and charges the cache-read price, typically around a tenth of the ordinary input price.
-A turn runs from one user instruction to the end of that native Agent turn. A call is a business-model request: one response can contain several tool invocations, and routing-decision requests are counted separately.
+Caches belong to a model. A model that has never seen this history must process it from scratch; only later requests can read its own cache. So the cache loss from a switch is this: **a prefix that could have been read at the cache price is processed once at full price on the new model.** It is a one-time cost, not one repeated on every later call.
-| Observed workload | Model calls |
-| --- | --- |
-| Drafting, reviewing, revising, and final review | 310 requests across 42 normally completed turns; 3–19 per turn, median 5.5, mean 7.38 |
-| Unattended Astra/Qwen HTTPX coding | One initial instruction generated 40 requests: 25 Qwen and 15 Astra |
-| The final stable Astra segment of that HTTPX task | 14 consecutive requests, all accepted; the first reassessed and 13 inherited the decision |
+## How HiRoute reduces switching
-Writing counts come from the [per-turn structured records](../experiments/results/decision-routing-20261006/results.json) for Qwen 3.8 Max and GLM 5.3. All 48 registered turns are retained, with 51 requests in the other six interrupted turns reported separately. The [HTTPX experiment](../experiments/cases/unattended-engineering/README.md) included two compactions, 30 accepted requests, and 10 cancellations; its final stable stretch of 14 calls supplies the continuous-execution example.
+HiRoute's context-hold mechanism, ContextHold, follows the rhythm of the conversation to decide when a model change is allowed:
-Across HTTPX, **35/40 requests inherited the decision, or 87.5%**. This shows the protection in operation: most tool round-trips reused an existing choice. The 87.5% measures decision reuse; the earlier 6.27-point gap is a calculation using the observed count of 14 with assumed input sizes. Neither is a measured cache-hit rate. That stable segment began after compaction and illustrates execution length, rather than providing a controlled new-user-message switch.
-
-These samples give a practical sense of scale: writing turns often contain several requests, while long coding work can contain over a dozen consecutive requests. Different workloads offer different room to spread a switching loss.
-
-## Why switching after compaction can lose less
-
-Compaction replaces some history with a summary. Even the original model must process that new content, while unchanged system instructions or tool definitions may still hit. For example, Claude's [compaction and caching documentation](https://platform.claude.com/docs/en/build-with-claude/compaction-threshold#maximizing-cache-hits-with-system-prompts) describes retaining a system-prompt cache after compaction.
-
-When comparing staying versus switching after compaction, count only **the prefix that would still hit but is unavailable on the destination** as the additional loss `R`. Both paths must process the summary and new messages.
-
-Under the same single-switch model, **stage hit-rate reduction = R / T**. At one million total input tokens, losing a 100,000-token prefix reduces the rate by 10 percentage points; losing 10,000 reduces it by one point. This comparison fixes the denominator; real compaction also changes `T`.
-
-The protections address different terms: **continuous execution reduces the number of losses, while a rebuild boundary can reduce the prefix lost each time.** Long retained system instructions and tools still contribute to `R`. The additional impact becomes negligible when `R / T` is sufficiently small.
-
-## What the cache loss costs
+| When | What HiRoute does | Effect on caching |
+| --- | --- | --- |
+| Consecutive tool calls within a turn | Reuse the choice already made for the turn and keep the current model | No switch; the cache keeps growing with the conversation |
+| A new user message | Reassess the task; keep or change the model | Keeping it loses nothing; changing it loses the old prefix once |
+| After compaction or a history rebuild | Keep the choice if it still applies; otherwise reassess | Part of the history must be rebuilt anyway, so switching adds less |
-The calculations use the experiment's **API-equivalent prices frozen on October 3, 2026**, its **fixed September 30 exchange rate**, and the standard context tier. These are historical analytical references, not current quotes or subscription bills.
+Most calls in a turn are tool round-trips, and these do not change models. In one unattended coding run of 40 requests, routing decided only at the start and around two compactions; the other 35 requests reused an existing choice directly, or 87.5%.
-| Per million tokens | Astra USD | Qwen 3.8 Flash CNY | Qwen equivalent USD |
-| --- | ---: | ---: | ---: |
-| Ordinary input | 10 | 0.8 | 0.119322 |
-| Cache read | 1 | 0.1 | 0.014915 |
-| Cache write | 12.5 | 1.25 | 0.186441 |
-| Output | 50 | 2.7 | 0.402712 |
+Whether a request actually hits the cache also depends on the provider's caching rules and lifetime, and an unavailable model can still fail over to a backup. See the [model-routing guide](https://hiroute.ai/en/docs/model-routing/) for the rules.
-The conversion is `1.1355 / 7.6130` USD per CNY, calculated at full precision. Original records are under `evidence.json → frozen_cost_basis` in the [frozen evidence archive](https://github.com/higress-group/HiRoute/releases/tag/experiment-evidence-2026-10-04).
+## One switch, spread across later calls
-First isolate caching by comparing a warm and cold execution on the same destination model. Let `p` be the first-processing price and `r` the cache-read price, both in USD per million tokens:
+Picture this: your conversation with an agent has reached 100,000 tokens, you send a new message, and routing decides to change models.
-**Additional cache cost K = R × (p − r) / 1,000,000.**
+- **The first request after the switch:** all 100,000 tokens must be processed again, so this request's hit rate falls from 99% to 0. Seen in isolation, the loss looks large.
+- **The tool calls that follow:** the new model now has this conversation cached, matching the no-switch case.
-Whether first processing uses the ordinary input or cache-write price depends on the provider. These are alternative billing cases, not two full prices to add together.
+[![After one switch, the turn's hit rate recovers with more calls: 99 points lower after one call, only 4.2 points lower after twenty](assets/cache-amortization-en.svg)](assets/cache-amortization-en.svg)
-| Destination and lost prefix | Premium at ordinary input price | Premium at cache-write price |
-| --- | ---: | ---: |
-| Astra, 100,000 tokens | $0.900 | $1.150 |
-| Astra, 10,000 tokens | $0.090 | $0.115 |
-| Qwen, 100,000 tokens | About $0.010441 | About $0.017153 |
-| Qwen, 10,000 tokens | About $0.001044 | About $0.001715 |
+The more calls in a turn, the thinner the loss is spread: **with n calls in a turn, one switch lowers the turn's hit rate by at most 1/n.** In the experiment records, drafting and reviewing turns averaged about 7 calls, and long coding work ran a dozen or more in a row.
-Astra losing a reusable 10,000-token prefix adds $0.115 under the write-price case. Spread across twenty consecutive calls, that is $0.00575 per call. The total remains $0.115, while losing a full 100,000-token prefix can add $1.15. Preserving long-prefix reuse has real value.
+The case to watch is a long conversation with only one or two calls per turn and frequent model changes, where the loss has nothing to spread across. HiRoute reconsiders only at new messages and compaction precisely to avoid that kind of back-and-forth.
-### Switching direction also changes the bill
+## Switching after compaction loses less
-A cross-model comparison must include the price change. When a new user message arrives, the old-prefix portion changes by:
+When context grows too long, the agent compresses early history into a summary. After that, even the original model must process the summary and what follows. What can still hit the cache is usually only the unchanged part, such as system instructions and tool definitions (see Claude's [compaction and caching documentation](https://platform.claude.com/docs/en/build-with-claude/compaction-threshold#maximizing-cache-hits-with-system-prompts)).
-**Old-prefix cost change = P × (destination first-processing price − original cache-read price) / 1,000,000.**
+Switching at that point therefore loses only this remaining prefix, not the whole history. **Continuous execution reduces how often you switch, and switching at compaction reduces how much each switch loses.**
-For `P = 100,000`, with destination processing charged at the cache-write price:
+## Switching to the cheaper model improves the bill
-| Direction | Read old prefix on original model | Rebuild on destination | Cost change |
-| --- | ---: | ---: | ---: |
-| Astra → Qwen | $0.100000 | About $0.018644 | About $0.081356 less |
-| Qwen → Astra | About $0.001492 | $1.250000 | About $1.248508 more |
+A real switch also involves the price difference between models. In the Astra × Qwen experiment's frozen prices, Qwen 3.8 Flash costs roughly 1% of Astra per token. For the same 100,000-token old prefix:
-**Even with a cache loss, processing the old prefix on Qwen can cost less; upgrading to Astra pays for stronger capability.** This table includes the cross-model price difference, so the preceding cache premium must not be added again. New input, outputs, routing decisions, and rework still belong in the whole-task bill.
+| Direction | No switch: original model reads cache | Switch: new model processes again | Result |
+| --- | ---: | ---: | --- |
+| Astra → Qwen | $0.10 | About $0.019 | **About $0.08 saved** |
+| Qwen → Astra | About $0.0015 | $1.25 | About $1.25 more |
-## Put cache overhead back into the whole-task cost
+**Smart routing saves money mainly by moving work to the cheaper model, and in that direction the cache loss is close to negligible; moving up to Astra pays for stronger capability.**
-The [Astra × Qwen experiment](https://hiroute.ai/en/news/astra-qwen-smart-routing/) assigned six source-verification components to Qwen and a critical decision to Astra. Two of three paired runs met the original whole-delivery standard in both arms. The mixed delivery that missed the first pair's gate and all results remain in the [experiment record](../experiments/cases/research-cost-quality/README.md). This component-routing comparison establishes a cost margin for the workload.
+## Back to the whole task: caching changes the savings by a few points
-Whole-task costs include all subject attempts, structural retries, and reported Jev decisions. Unreported cache-write quantities produce cost intervals, so the comparison uses the mixed upper bound against the all-Astra lower bound. Ordinary input, cache reads, and cache writes do not overlap; billed reasoning tokens are already included in output.
+What ultimately matters is the bill for the whole task. In the [Astra × Qwen experiment](https://hiroute.ai/en/news/astra-qwen-smart-routing/), Qwen handled six source-verification components and Astra handled the critical decision, compared against using only Astra. In two of three paired runs, both approaches met the acceptance standard; the remaining pair's results are kept in full in the [experiment record](../experiments/cases/research-cost-quality/README.md).
-| Pair accepted in both arms | Mixed upper bound | All-Astra lower bound | Conservative saving |
+| Run where both met the standard | Mixed routing | All Astra | Saving |
| --- | ---: | ---: | ---: |
-| Pair 2 | $0.146806 | $1.838882 | 92.01% |
-| Pair 3 | $0.177957 | $2.067170 | 91.39% |
-
-### Even if every all-Astra input token hits
+| Pair 2 | About $0.147 | About $1.84 | 92% |
+| Pair 3 | About $0.178 | About $2.07 | 91% |
-Give all-Astra an ideal cache: charge every input token at the cache-read price, keeping observed output usage, while mixed routing stays at its recorded upper bound. This fixed-usage sensitivity calculation checks whether the cache discount changes the conclusion.
+These mixed-routing bills include no Qwen cache discount at all: every Qwen call recorded zero cache hits. What if mixed routing had never lost a single cache hit?
-Each all-Astra run used 116,383 input tokens, with 34,214 and 34,310 output tokens respectively:
+[![The same mixed run with and without a perfect cache: all Astra $2.067, mixed routing $0.178 (91% saved), mixed routing with every input cached $0.124 (94% saved)](assets/cache-impact-en.svg)](assets/cache-impact-en.svg)
-`Pair 2: (116,383 × 1 + 34,214 × 50) / 1,000,000 = $1.827083`
-
-`Pair 3: (116,383 × 1 + 34,310 × 50) / 1,000,000 = $1.831883`
-
-| Pair | Hypothetical all-input-cached Astra | Mixed upper bound | Remaining saving |
-| --- | ---: | ---: | ---: |
-| Pair 2 | $1.827083 | $0.146806 | 91.96% |
-| Pair 3 | $1.831883 | $0.177957 | 90.28% |
+Pair 3 would fall from $0.178 to $0.124, and the saving would rise from 91% to 94%; pair 2 would go from 92% to 93%. **In this experiment, however much cache mixed routing keeps or loses, the saving stays above 90%.** The reason is simple: caching only discounts input, and most of a cheap model's bill is output.
-The advantage survives for both tasks: input caching does not eliminate output charges, and Qwen's ordinary input price is below Astra's cache-read price at these rates. Calculations retain each model's different observed output volume, with savings calculated at full precision and rounded down to two percentage decimals.
+## What if the primary model gets cheaper?
-### Room for additional overhead
+[![All-Astra cost as a multiple of mixed routing as Astra's price falls: about 10.3× today, about 3.4× at 20%, and break-even at about 5.1%](assets/cache-price-break-even-en.svg)](assets/cache-price-break-even-en.svg)
-Against the idealized all-Astra cost `C_A*` and mixed upper bound `C_M`, the break-even condition is:
+Suppose every Astra price falls by the same proportion. Even calculated in the way most favorable to all-Astra, with every one of its inputs hitting the cache, **Astra would need a price cut of about 95% before the two cost the same.**
-**New overhead X < C_A* − C_M.**
+## Bottom line: keep the economy model working, upgrade when needed
-The margins are approximately **$1.680277** and **$1.653926**. One extra $0.115 Astra prefix-write loss would not offset the savings in this example. `X` includes only cache rebuilding, decisions, or rework added beyond the recorded bill, avoiding double counting.
+HiRoute aims to let an economy model keep handling the work it suits, and bring in a primary model when stronger capability is needed. Complex work can start on the primary model, and weak economy-model performance can trigger an upgrade, avoiding repeated rework just to save on individual calls.
-Reproduce the call counts, costs, and hypothetical comparisons with the [offline calculator](../experiments/cache_cost_analysis.py), following the [reproduction instructions](../experiments/README.md). The records support these specific workloads; a real task should be assessed using its own context, call volume, and delivery quality.
+- **Keep the model stable within a stage** to accumulate cache benefits.
+- **Reassess at rebuild points such as compaction** to avoid unnecessary cache losses.
+- **Upgrade when needed** to protect the delivery standard.
-## Keep suitable work on economy and upgrade when needed
+Cache losses are one-time, bounded costs, and HiRoute controls when switches happen. **Moving suitable work to a clearly cheaper model saves far more than cache rebuilding, routing decisions, and rework cost.** In the experiment above, the gap is about an order of magnitude.
-HiRoute aims to let an economy model continue handling work suited to it, bringing in a primary model when stronger capability is needed. Complex work can start on primary, and insufficient economy-model performance can trigger an upgrade, avoiding repeated rework just to save on individual calls.
+## Try it
-Keep the model stable within a stage to accumulate cache benefits. Reassess at rebuild boundaries to reduce avoidable cache losses. Upgrade when needed to protect the delivery standard. **Smart routing has a total-cost advantage when savings from suitable economy-model work exceed additional cache rebuilding, routing decisions, and rework.**
+Choose **Smart saving** on the Smart routing page, then add your **Economy models** and **Primary models**. After a task runs, open **Run record** from its session to see each request's cache hits, actual model and estimated cost. See the [model-routing guide](https://hiroute.ai/en/docs/model-routing/) for details.
diff --git a/news/2026-10-14-routing-cache-cost.zh-CN.md b/news/2026-10-14-routing-cache-cost.zh-CN.md
index dd11b170..0b21c655 100644
--- a/news/2026-10-14-routing-cache-cost.zh-CN.md
+++ b/news/2026-10-14-routing-cache-cost.zh-CN.md
@@ -1,168 +1,101 @@
-# 模型切换的缓存影响与智能路由成本分析
+# 切换模型会丢缓存,但省下的钱丢不掉
-智能路由能把工作分给不同模型,但用户也会关心:切换模型损失的缓存,会不会把省下的钱又花回去?
+智能路由会把不同的工作交给不同的模型。很多人随之会问:模型一换,之前积累的缓存就用不上了,这笔损失会不会把省下的钱又花回去?
-HiRoute 从两个环节减少这笔开销:**同一轮连续工具调用保持模型稳定,让上下文持续复用缓存;上下文压缩或重建后重新选模,有机会减少仍可复用的旧前缀损失。** 对于确实发生的切换,还要把缓存重建费用计入整单,判断最终是否划算。
+**简短回答:会损失一些,但远远抵不掉省下的钱。**
-下面先解释保护机制,再用真实调用次数和 Astra × Qwen 实验的费用数据,把缓存影响与总成本分别算清楚。
+- **切换本来就不多。** HiRoute 在同一轮任务的连续工具调用中不换模型,只在用户发来新消息、上下文压缩这类节点重新选择。在一次 40 次请求的编码任务中,有 35 次直接沿用了已有选择。
+- **损失只有一次,会被摊薄。** 缓存损失只发生在切换后的第一次请求,后续调用又能用上缓存。
+- **往便宜的模型切,旧上下文反而更省钱。** 便宜模型从头处理一遍,常常比贵模型读缓存还便宜。
+- **缓存只让省钱比例变化几个百分点。** 在 Astra × Qwen 实验中,混合路由里的 Qwen 一次缓存都没命中,仍然省下约 91%;就算输入全部命中缓存,也只是变成约 94%。
-## HiRoute 如何保护缓存
+什么时候切换由 HiRoute 决定,开启智能省钱不需要自己先算一遍账。下面逐条说明。
-KV Cache 保存模型已经计算过的上下文状态。保持模型和上下文前缀稳定,后续请求就有机会读取旧缓存,只处理新增内容。换到没有对应缓存的模型时,需要重新处理旧前缀;新缓存建立后,又可以被接下来的调用复用。
+<figure class="article-video"><video controls playsinline preload="none" poster="/media/hiroute-cache-en-poster.jpg" aria-label="三分钟视频:切换模型会丢缓存,但省下的钱丢不掉"><source src="/media/hiroute-cache-en.mp4" type="video/mp4"></video><figcaption>三分钟视频版:英文旁白,中英双语字幕</figcaption></figure>
-HiRoute 的上下文保持机制(ContextHold)识别会话与历史连续性,并保留有效的执行偏好:
+## 先弄清楚:缓存省的是什么钱
-| 执行节点 | HiRoute 的处理 | 对缓存的作用 |
-| --- | --- | --- |
-| 同一轮连续工具调用 | 同轮可识别、历史连续且决策有效时,沿用决策,优先保持所选组内合格的当前模型 | 避免每次工具往返都重新选模,持续复用增长中的前缀 |
-| 新用户消息 | 重新判断任务,可以继续原模型,也可以切换 | 继续原模型时可保留旧缓存;发生切换时,要计算完整可复用前缀的损失 |
-| 上下文压缩或重建 | 原决策仍可续用则保持,否则重新判断 | 部分历史本来就需要重建,额外损失可能缩小到剩余可复用前缀 |
-
-实际命中由上游的缓存规则和有效期决定,当前模型不可用时也可能故障接力。HiRoute 通过连续性减少不必要的切换;具体路由规则见[模型路由指南](https://hiroute.ai/docs/model-routing/)。
-
-## 新用户消息触发切换时 如何摊薄损失
-
-新用户消息通常只是追加历史,旧前缀仍可命中。若这时切到完全冷的模型,首次请求可能损失整段缓存;后续工具调用保持稳定,才能逐步摊薄这次损失。
-
-以下计算用 token 加权的输入命中率。为单独观察一次切换,假设两条路径有相同的输入序列,原缓存有效,目标模型首次完全冷启动,后续前缀正常复用且不再切换、压缩或过期。设:
-
-- `P`:原本可命中的旧前缀 token 数。
-- `U`:新用户消息及其他尚未缓存的输入 token 数。
-- `n`:本轮模型调用次数,包含首次调用。
-- `g`:每次工具续接新增的未缓存 token 数,本例按固定值计算。
-
-首次请求不切换时的命中率为 `P / (P + U)`,冷切换后为零。例如,旧前缀 100,000 token、新输入 1,000 token,当次命中率会从 **99.01% 降至 0%**。
-
-把后续调用一起计入,第 `i` 次输入是 `P + U + (i − 1)g`,因此:
-
-**本轮累计输入 T = n(P + U) + g × n(n − 1) / 2。**
-
-不切换时,累计未命中量为 `U + (n − 1)g`;仅首次冷切换时,多出一次 `P` 的未命中量。所以:
-
-**本轮命中率下降 = P / T ≤ 1 / n。**
-
-最后的不等式来自每次输入都包含前缀 `P`,即 `T ≥ nP`。在这些条件下,14 次连续调用的下降上界约为 **7.14 个百分点**,20 次为 **5 个百分点**。
-
-取 `P = 100,000`、`U = 1,000`、`g = 2,000`,得到更具体的例子:
-
-| 本轮调用次数 | 累计输入 T | 不切换命中率 | 仅首次冷切换命中率 | 下降幅度 |
-| --- | ---: | ---: | ---: | ---: |
-| 1 | 101,000 | 99.01% | 0.00% | 99.01 个百分点 |
-| 5 | 525,000 | 98.29% | 79.24% | 19.05 个百分点 |
-| 14 | 1,596,000 | 98.31% | 92.04% | 6.27 个百分点 |
-| 20 | 2,400,000 | 98.38% | 94.21% | 4.17 个百分点 |
-
-**保持连续调用,能把首次请求的明显损失摊薄到整个执行阶段。** 短轮次、长历史的频繁切换仍需谨慎。若目标模型已有部分有效前缀缓存,只计算两者之差;若继续原模型,切换损失为零。多次切换则累计各次损失,不能继续沿用“一次冷切换”的上界。
+Agent 每次调用模型,都要把整段对话历史重新发一遍,包括系统提示词、工具定义、之前的消息和工具结果。对话越长,每次重复发送的内容就越多。
-### 真实实验里 一轮有多少次调用
+KV Cache 让模型记住已经处理过的开头部分,下文称为“前缀”。下一次请求的开头相同,就可以直接读取缓存,按缓存读取价计费,通常只有普通输入价的十分之一左右。
-这里“一轮”指一条用户指令到原生 Agent 本轮结束,“一次调用”指一次业务模型请求。一次模型响应可以包含多个工具调用,路由判断请求另行计数。
+缓存是跟着模型走的。换到一个没处理过这段历史的模型,它只能从头处理一遍,之后的请求才能读取它自己的缓存。所以切换的缓存损失是:**本来能按缓存价读取的那段前缀,在新模型上要按全价重新处理一次。** 这是一次性费用,不会在之后每次调用中重复发生。
-| 真实实验样本 | 观察到的调用次数 |
-| --- | --- |
-| 写稿、审稿、修订与终审 | 正常完成的 42 轮共 310 次;每轮 3–19 次,中位数 5.5 次,平均 7.38 次 |
-| Astra/Qwen 无人值守 HTTPX 编码 | 一条初始任务指令共 40 次请求:Qwen 25 次、Astra 15 次 |
-| 同一 HTTPX 任务最后的稳定 Astra 执行段 | 连续 14 次请求全部接受,首次重新判断后,13 次继承已有决策 |
+## HiRoute 怎么减少切换
-写作数据来自[逐轮结构化记录](../experiments/results/decision-routing-20261006/results.json),涉及 Qwen 3.8 Max 与 GLM 5.3;全部登记 48 轮,另 6 个中断轮次的 51 次请求单独保留。HTTPX 来自[已有编码实验](../experiments/cases/unattended-engineering/README.md),整轮含两次压缩、30 次接受和 10 次取消,因此采用最后稳定的 14 次调用作连续执行示例。
+HiRoute 的上下文保持机制(ContextHold)按照对话的节奏决定何时可以换模型:
-HTTPX 全部请求中,**35/40 继承决策,占 87.5%**。这展示了保护机制的实际作用:多数工具往返复用已有选择。87.5% 是决策复用率;前表的 6.27 个百分点则是将真实观察到的 14 次调用代入假设输入规模后的推算,两者都不是实测缓存命中率。该稳定片段始于压缩后的重选,用来说明连续调用的长度,不是新用户消息切换的直接对照。
-
-这些样本给出的体感是:写作一轮往往有数次请求,长编码任务可以有十几次连续请求。任务类型不同,摊薄空间也不同。
-
-## 压缩后切换 为什么额外损失可能更小
-
-压缩会把部分历史替换成摘要。继续原模型也需要处理这份新内容,但系统提示词、工具定义等未变前缀可能仍可命中。例如,Claude 的[压缩与缓存说明](https://platform.claude.com/docs/en/build-with-claude/compaction-threshold#maximizing-cache-hits-with-system-prompts)介绍了压缩后继续复用系统提示词缓存的方式。
-
-因此,比较压缩后“保持原模型”和“切换模型”,只应把**原本还能命中、目标模型却没有的前缀**记作额外损失 `R`。摘要和新增消息是两条路径都需要处理的内容。
-
-沿用前面的单次切换模型,**阶段命中率下降 = R / T**。若阶段累计输入为 100 万 token,损失 10 万 token 前缀对应下降 10 个百分点,损失 1 万则对应 1 个百分点。这里固定总输入作对照;实际压缩也会改变 `T`。
-
-这就是两个保护环节的分工:**连续执行减少损失发生的次数,压缩边界有机会减小每次损失的前缀。** 保留的系统提示词和工具很长时,仍应按实际 `R` 计算;当 `R / T` 足够小,额外影响才可以近乎忽略。
-
-## 缓存损失具体值多少钱
+| 什么时候 | HiRoute 怎么做 | 对缓存的影响 |
+| --- | --- | --- |
+| 同一轮里连续的工具调用 | 沿用本轮已经做出的选择,继续使用当前模型 | 不切换,缓存随对话增长持续复用 |
+| 用户发来新消息 | 重新判断任务,可能继续,也可能更换 | 继续就没有损失;更换则损失一次旧前缀 |
+| 上下文压缩或重建后 | 原选择仍适用就保持,否则重新判断 | 历史本来就要部分重建,换模型的额外损失更小 |
-下面使用实验在 **2026 年 10 月 3 日冻结的 API 等价价格**和 **9 月 30 日固定汇率**,按标准上下文档位计算。这是历史分析口径,不是当前报价或订阅账单。
+一轮任务中的大多数调用是工具往返,这部分不会换模型。在一次 40 次请求的无人值守编码实验中,路由只在开头和两次上下文压缩前后做了决策,其余 35 次直接沿用了已有选择,占 87.5%。
-| 每百万 token | Astra(美元) | Qwen 3.8 Flash(人民币) | Qwen 折合美元 |
-| --- | ---: | ---: | ---: |
-| 普通输入 | 10 | 0.8 | 0.119322 |
-| 缓存读取 | 1 | 0.1 | 0.014915 |
-| 缓存写入 | 12.5 | 1.25 | 0.186441 |
-| 输出 | 50 | 2.7 | 0.402712 |
+实际能否命中缓存,还取决于模型服务商的缓存规则和有效期;当前模型不可用时,也会自动接力到备用模型。具体规则见[模型路由指南](https://hiroute.ai/docs/model-routing/)。
-换算系数为 `1.1355 / 7.6130` 美元/人民币,计算使用完整精度;原始记录见[冻结证据包](https://github.com/higress-group/HiRoute/releases/tag/experiment-evidence-2026-10-04)的 `evidence.json → frozen_cost_basis`。
+## 切换一次,损失会被后续调用摊薄
-先隔离缓存因素,比较同一目标模型有缓存和冷启动的差异。首次处理单价记为 `p`,缓存读取单价为 `r`,均按美元/百万 token:
+设想这样一个场景:你和 Agent 的对话已经积累了 10 万 token,这时你发了一条新消息,路由决定换一个模型。
-**额外缓存成本 K = R × (p − r) / 1,000,000。**
+- **切换后的第一次请求:** 10 万 token 都要重新处理,这次请求的缓存命中率从 99% 降到 0。单看这一次,损失很大。
+- **之后的工具调用:** 新模型已经缓存了这段对话,命中情况和不切换时一样。
-首次处理按普通输入还是缓存写入收费,取决于服务方;两种价格是替代计费情形,不重复相加。
+[![切换一次后,整轮命中率随调用次数回升:1 次调用相差 99 个百分点,20 次调用只差 4.2 个百分点](assets/cache-amortization-zh.svg)](assets/cache-amortization-zh.svg)
-| 目标模型与损失前缀 | 按普通输入处理的额外费用 | 按缓存写入处理的额外费用 |
-| --- | ---: | ---: |
-| Astra,100,000 token | $0.900 | $1.150 |
-| Astra,10,000 token | $0.090 | $0.115 |
-| Qwen,100,000 token | 约 $0.010441 | 约 $0.017153 |
-| Qwen,10,000 token | 约 $0.001044 | 约 $0.001715 |
+一轮调用越多,这次损失摊得越薄:**一轮调用 n 次,切换一次造成的整轮命中率下降不超过 1/n。** 从实验记录看,写稿、审稿类任务一轮平均约 7 次调用,长时间编码任务可以连续十几次。
-损失 1 万 token 前缀的 Astra 切换,按写入价多花 $0.115;分摊到 20 次连续调用,平均每次 $0.00575。总开销仍是 $0.115,而完整 10 万 token 前缀的损失可达 $1.15。这说明保持长前缀的复用有实际价值。
+需要留意的是对话很长、每轮只有一两次调用、又频繁换模型的情况,这时损失摊不开。HiRoute 只在新消息和压缩等节点重新选择,正是为了避免这种来回切换。
-### 切换方向也会改变费用
+## 压缩之后再切换,损失更小
-跨模型比较还要计入模型单价变化。新用户消息到来时,旧前缀这部分的费用变化为:
+上下文太长时,Agent 会把早期历史压缩成摘要。压缩之后,即使不换模型,摘要和后续内容也要重新处理。还能继续命中缓存的,通常只剩系统提示词、工具定义这类没有变化的部分(参见 Claude 的[压缩与缓存说明](https://platform.claude.com/docs/en/build-with-claude/compaction-threshold#maximizing-cache-hits-with-system-prompts))。
-**旧前缀费用变化 = P ×(目标模型首次处理价 − 原模型缓存读取价)/ 1,000,000。**
+所以在压缩节点换模型,额外损失的只是这段剩余前缀,而不是整段历史。**连续执行减少切换的次数,在压缩节点切换则减少每次损失的大小。**
-取 `P = 100,000`,目标模型首次处理按缓存写入价计费:
+## 往便宜的模型切,账反而更好看
-| 切换方向 | 继续原模型读取旧前缀 | 切换后重建旧前缀 | 费用变化 |
-| --- | ---: | ---: | ---: |
-| Astra → Qwen | $0.100000 | 约 $0.018644 | 减少约 $0.081356 |
-| Qwen → Astra | 约 $0.001492 | $1.250000 | 增加约 $1.248508 |
+真正换模型时,还要算上两个模型本身的价差。按 Astra × Qwen 实验冻结的价格,Qwen 3.8 Flash 每 token 的价格大约只有 Astra 的 1%。同样是 10 万 token 的旧前缀:
-**同样损失缓存,转到 Qwen 的旧前缀处理费仍可能更低;升级 Astra 则为更强能力付费。** 这张表包含跨模型价格差,不能再叠加前表的缓存损失。新输入、输出、路由判断和返工还需进入整单计算。
+| 切换方向 | 不切换:原模型读缓存 | 切换:新模型重新处理 | 结果 |
+| --- | ---: | ---: | --- |
+| Astra → Qwen | 0.10 美元 | 约 0.019 美元 | **反而省下约 0.08 美元** |
+| Qwen → Astra | 约 0.0015 美元 | 1.25 美元 | 多花约 1.25 美元 |
-## 把缓存开销放回整单成本
+**智能路由省钱,主要靠把工作交给便宜模型,而在这个方向上,缓存损失几乎可以忽略;升级到 Astra,则是为更强的能力付费。**
-[Astra × Qwen 实验](https://hiroute.ai/news/astra-qwen-smart-routing/)让 Qwen 完成六份资料核验,Astra 处理关键决策。三个配对运行中,两对双方均达到原定整单验收标准;第一对未达标的混合结果和全部记录保留在[实验说明](../experiments/cases/research-cost-quality/README.md)。这是分任务成本对照,用于检验费用余量。
+## 放回整单:缓存只影响几个百分点
-整单金额包含全部受试尝试、结构性重试与已报告的 Jev 判断费用。未报告的缓存写入量按区间处理,所以采用混合成本上界对比全 Astra 下界;普通输入、缓存读取、缓存写入互不重复,输出已包含计费的推理 token。
+最终要看的是整个任务的总账。在 [Astra × Qwen 实验](https://hiroute.ai/news/astra-qwen-smart-routing/)中,Qwen 负责六份资料核验,Astra 负责关键决策,并与全程只用 Astra 的方案对比。三组配对运行中,有两组的两种方案都达到了验收标准;另一组未达标的结果也完整保留在[实验说明](../experiments/cases/research-cost-quality/README.md)中。
-| 双方均达标的运行 | 混合成本上界 | 全 Astra 成本下界 | 保守降幅 |
+| 两种方案都达标的运行 | 混合路由 | 全用 Astra | 节省 |
| --- | ---: | ---: | ---: |
-| 第 2 对 | $0.146806 | $1.838882 | 92.01% |
-| 第 3 对 | $0.177957 | $2.067170 | 91.39% |
-
-### 即使全 Astra 的输入全部命中缓存
+| 第 2 组 | 约 0.147 美元 | 约 1.84 美元 | 92% |
+| 第 3 组 | 约 0.178 美元 | 约 2.07 美元 | 91% |
-进一步给全 Astra 一个理想条件:所有输入按缓存读取价计费,输出保留实际用量;混合模式仍取已记录的成本上界。这是固定用量后的敏感性分析,检验缓存折扣能否改变结论。
+这里混合路由的账单没有享受任何 Qwen 缓存折扣:每次 Qwen 调用记录的缓存命中都是 0。假如混合路由一次缓存都没丢,会怎样?
-全 Astra 两次均有 116,383 个输入 token,输出分别为 34,214 和 34,310 个。因此:
+[![同一次混合运行有无缓存的对比:全用 Astra 2.067 美元;混合路由 0.178 美元,省 91%;混合路由输入全部命中缓存 0.124 美元,省 94%](assets/cache-impact-zh.svg)](assets/cache-impact-zh.svg)
-`第 2 对:(116,383 × 1 + 34,214 × 50) / 1,000,000 = $1.827083`
-
-`第 3 对:(116,383 × 1 + 34,310 × 50) / 1,000,000 = $1.831883`
-
-| 运行 | 全 Astra 全输入命中的假设成本 | 混合成本上界 | 仍节省 |
-| --- | ---: | ---: | ---: |
-| 第 2 对 | $1.827083 | $0.146806 | 91.96% |
-| 第 3 对 | $1.831883 | $0.177957 | 90.28% |
+第 3 组会从 0.178 美元降到 0.124 美元,节省比例从 91% 变成 94%;第 2 组从 92% 变成 93%。**在这个实验里,混合路由无论保住还是丢掉缓存,都能省下 90% 以上。** 原因很简单:缓存只给输入打折,而便宜模型的账单大头是输出。
-两次任务的成本优势仍然存在:输入缓存不会免除输出费用,而冻结价格下 Qwen 的普通输入价也低于 Astra 的缓存读取价。计算保留各模型实际的不同输出用量,降幅使用完整精度并向下截取至两位百分数。
+## 主力模型降价了,还划算吗?
-### 还能容纳多少新增开销
+[![Astra 降价后,全用 Astra 的花费是混合路由的几倍:今天约 10.3 倍,降到 20% 时约 3.4 倍,降到约 5.1% 时打平](assets/cache-price-break-even-zh.svg)](assets/cache-price-break-even-zh.svg)
-以上述理想化的全 Astra 成本 `C_A*` 对比混合上界 `C_M`,额外开销的盈亏平衡条件是:
+假设 Astra 的各项单价按同一比例下调。即使按对全用 Astra 最有利的方式计算,也就是它的输入全部命中缓存,**Astra 也要降价约 95%,两种方案才打平。**
-**新增开销 X < C_A* − C_M。**
+## 结论:便宜模型持续干活,需要时再升级
-两次运行分别还有约 **$1.680277** 和 **$1.653926** 的余量。额外增加一次 $0.115 的 Astra 前缀写入损失,仍不足以抵消本例的收益。`X` 只计原账目之外新增的缓存重建、判断或返工费用,避免重复扣除。
+HiRoute 的目标,是让适合经济模型的工作尽量由经济模型持续完成,任务需要更强能力时再交给主力模型。复杂任务可以一开始就用主力模型;经济模型表现不足时也可以升级,避免为了省单次调用的费用而反复返工。
-调用次数、费用和假设比较均可通过[离线计算入口](../experiments/cache_cost_analysis.py)复算,步骤见[实验复算说明](../experiments/README.md)。记录支持这些具体任务的结论;实际任务仍需用自己的上下文、调用量与交付质量核算。
+- **阶段内保持模型稳定**,持续积累缓存收益;
+- **在压缩等重建节点重新判断**,减少可以避免的缓存损失;
+- **必要时升级能力**,守住交付标准。
-## 经济模型持续执行 在需要时升级主力
+缓存损失是一次性的、有上限的小额开销,切换节点也由 HiRoute 控制。**把适合的工作交给明显更便宜的模型,省下的钱远多于缓存重建、路由判断和返工的开销。** 在上面的实验中,这个差距大约是一个数量级。
-HiRoute 的目标,是让适合经济模型的工作尽可能由经济模型持续完成,在任务需要更强能力时交给主力模型。任务复杂时可以从一开始就使用主力,经济模型表现不足时也可以升级,避免为了省单次调用费用而反复返工。
+## 动手试试
-阶段内保持模型稳定,持续积累缓存收益;重建边界重新判断,减少可避免的缓存损失;必要时升级能力,守住交付标准。**只要经济模型承担工作所节省的费用,超过额外缓存重建、路由判断与返工开销,智能路由就有总成本优势。**
+在“智能路由”页面选择**智能省钱**,再添加**省钱模型**和**主力模型**。任务运行后,在对应会话中打开**运行记录**,就能看到每次请求的缓存命中、实际模型和预估费用。详细说明见[模型路由指南](https://hiroute.ai/docs/model-routing/)。
diff --git a/news/README.md b/news/README.md
index 1311daa4..9ff9fc69 100644
--- a/news/README.md
+++ b/news/README.md
@@ -2,7 +2,7 @@
| Date | English | 简体中文 |
| --- | --- | --- |
-| 2026-10-14 | [Model switching, caching, and costs](2026-10-14-routing-cache-cost.en.md) | [模型切换的缓存影响与成本分析](2026-10-14-routing-cache-cost.zh-CN.md) |
+| 2026-10-14 | [Switching models loses cache, not the savings](2026-10-14-routing-cache-cost.en.md) | [切换模型会丢缓存,但省下的钱丢不掉](2026-10-14-routing-cache-cost.zh-CN.md) |
| 2026-10-04 | [Smart routing: Astra × Qwen](2026-10-04-astra-qwen.en.md) | [智能路由省钱实战](2026-10-04-astra-qwen.zh-CN.md) |
| — | [HiRoute is open source](hiroute-open-source.en.md) | [HiRoute 正式开源](hiroute-open-source.zh-CN.md) |
diff --git a/news/assets/cache-amortization-en.svg b/news/assets/cache-amortization-en.svg
new file mode 100644
index 00000000..f7bab54f
--- /dev/null
+++ b/news/assets/cache-amortization-en.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 500" role="img"><title>One switch, spread across the turn</title><rect width="1000" height="500" rx="20" fill="#eef2fa"/><g font-family="system-ui,sans-serif" fill="#192439"><text x="32" y="46" font-size="24" font-weight="700">One switch, spread across the turn</text><text x="32" y="76" font-size="15" fill="#536079">Example: a 100,000-token conversation, a new message, and a fully cold first request</text><path d="M 96 390.0 H 950" stroke="#d3d9e8"/><text x="86.0" y="395.0" font-size="13" font-weight="400" text-anchor="end" fill="#536079">0%</text><path d="M 96 320.0 H 950" stroke="#d3d9e8"/><text x="86.0" y="325.0" font-size="13" font-weight="400" text-anchor="end" fill="#536079">25%</text><path d="M 96 250.0 H 950" stroke="#d3d9e8"/><text x="86.0" y="255.0" font-size="13" font-weight="400" text-anchor="end" fill="#536079">50%</text><path d="M 96 180.0 H 950" stroke="#d3d9e8"/><text x="86.0" y="185.0" font-size="13" font-weight="400" text-anchor="end" fill="#536079">75%</text><path d="M 96 110.0 H 950" stroke="#d3d9e8"/><text x="86.0" y="115.0" font-size="13" font-weight="400" text-anchor="end" fill="#536079">100%</text><text x="96.0" y="414.0" font-size="13" font-weight="400" text-anchor="middle" fill="#536079">1</text><text x="275.8" y="414.0" font-size="13" font-weight="400" text-anchor="middle" fill="#536079">5</text><text x="500.5" y="414.0" font-size="13" font-weight="400" text-anchor="middle" fill="#536079">10</text><text x="680.3" y="414.0" font-size="13" font-weight="400" text-anchor="middle" fill="#536079">14</text><text x="950.0" y="414.0" font-size="13" font-weight="400" text-anchor="middle" fill="#536079">20</text><text x="523.0" y="436.0" font-size="14" font-weight="400" text-anchor="middle" fill="#536079">Calls in the turn</text><polygon points="96.0,112.8 140.9,114.1 185.9,114.5 230.8,114.7 275.8,114.8 320.7,114.8 365.7,114.9 410.6,114.9 455.6,114.9 500.5,114.8 545.5,114.8 590.4,114.8 635.4,114.8 680.3,114.7 725.3,114.7 770.2,114.7 815.2,114.6 860.1,114.6 905.1,114.6 950.0,114.6 950.0,126.2 905.1,127.0 860.1,127.8 815.2,128.7 770.2,129.8 725.3,130.9 680.3,132.3 635.4,133.8 590.4,135.6 545.5,137.7 500.5,140.3 455.6,143.4 410.6,147.3 365.7,152.2 320.7,158.9 275.8,168.1 230.8,182.0 185.9,205.1 140.9,251.4 96.0,390.0" fill="#f4c7a5" opacity=".55"/><polyline points="96.0,112.8 140.9,114.1 185.9,114.5 230.8,114.7 275.8,114.8 320.7,114.8 365.7,114.9 410.6,114.9 455.6,114.9 500.5,114.8 545.5,114.8 590.4,114.8 635.4,114.8 680.3,114.7 725.3,114.7 770.2,114.7 815.2,114.6 860.1,114.6 905.1,114.6 950.0,114.6" fill="none" stroke="#5564bd" stroke-width="3"/><polyline points="96.0,390.0 140.9,251.4 185.9,205.1 230.8,182.0 275.8,168.1 320.7,158.9 365.7,152.2 410.6,147.3 455.6,143.4 500.5,140.3 545.5,137.7 590.4,135.6 635.4,133.8 680.3,132.3 725.3,130.9 770.2,129.8 815.2,128.7 860.1,127.8 905.1,127.0 950.0,126.2" fill="none" stroke="#d0652a" stroke-width="3"/><circle cx="96.0" cy="390.0" r="5" fill="#d0652a"/><text x="108.0" y="378.0" font-size="13" font-weight="700" text-anchor="start" fill="#9c4317">99.0 points lower</text><circle cx="275.8" cy="168.1" r="5" fill="#d0652a"/><text x="287.8" y="190.1" font-size="13" font-weight="700" text-anchor="start" fill="#9c4317">19.0 points lower</text><circle cx="680.3" cy="132.3" r="5" fill="#d0652a"/><text x="692.3" y="154.3" font-size="13" font-weight="700" text-anchor="start" fill="#9c4317">6.3 points lower</text><circle cx="950.0" cy="126.2" r="5" fill="#d0652a"/><text x="938.0" y="148.2" font-size="13" font-weight="700" text-anchor="end" fill="#9c4317">4.2 points lower</text><path d="M 700 96 h 24" stroke="#5564bd" stroke-width="3"/><text x="732.0" y="101.0" font-size="14" font-weight="700" text-anchor="start" fill="#5564bd">No switch</text><path d="M 830 96 h 24" stroke="#d0652a" stroke-width="3"/><text x="862.0" y="101.0" font-size="14" font-weight="700" text-anchor="start" fill="#d0652a">One switch</text><text x="32.0" y="484.0" font-size="13" font-weight="400" text-anchor="start" fill="#536079">Turn hit rate = cached input ÷ all input. Rule: with n calls, one switch lowers it by at most 1/n.</text></g></svg>
diff --git a/news/assets/cache-amortization-zh.svg b/news/assets/cache-amortization-zh.svg
new file mode 100644
index 00000000..856fb480
--- /dev/null
+++ b/news/assets/cache-amortization-zh.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 500" role="img"><title>切换一次,损失会被后续调用摊薄</title><rect width="1000" height="500" rx="20" fill="#eef2fa"/><g font-family="system-ui,sans-serif" fill="#192439"><text x="32" y="46" font-size="24" font-weight="700">切换一次,损失会被后续调用摊薄</text><text x="32" y="76" font-size="15" fill="#536079">示例:10 万 token 旧对话 + 新消息,切换后第一次请求完全没有缓存</text><path d="M 96 390.0 H 950" stroke="#d3d9e8"/><text x="86.0" y="395.0" font-size="13" font-weight="400" text-anchor="end" fill="#536079">0%</text><path d="M 96 320.0 H 950" stroke="#d3d9e8"/><text x="86.0" y="325.0" font-size="13" font-weight="400" text-anchor="end" fill="#536079">25%</text><path d="M 96 250.0 H 950" stroke="#d3d9e8"/><text x="86.0" y="255.0" font-size="13" font-weight="400" text-anchor="end" fill="#536079">50%</text><path d="M 96 180.0 H 950" stroke="#d3d9e8"/><text x="86.0" y="185.0" font-size="13" font-weight="400" text-anchor="end" fill="#536079">75%</text><path d="M 96 110.0 H 950" stroke="#d3d9e8"/><text x="86.0" y="115.0" font-size="13" font-weight="400" text-anchor="end" fill="#536079">100%</text><text x="96.0" y="414.0" font-size="13" font-weight="400" text-anchor="middle" fill="#536079">1</text><text x="275.8" y="414.0" font-size="13" font-weight="400" text-anchor="middle" fill="#536079">5</text><text x="500.5" y="414.0" font-size="13" font-weight="400" text-anchor="middle" fill="#536079">10</text><text x="680.3" y="414.0" font-size="13" font-weight="400" text-anchor="middle" fill="#536079">14</text><text x="950.0" y="414.0" font-size="13" font-weight="400" text-anchor="middle" fill="#536079">20</text><text x="523.0" y="436.0" font-size="14" font-weight="400" text-anchor="middle" fill="#536079">这一轮的调用次数</text><polygon points="96.0,112.8 140.9,114.1 185.9,114.5 230.8,114.7 275.8,114.8 320.7,114.8 365.7,114.9 410.6,114.9 455.6,114.9 500.5,114.8 545.5,114.8 590.4,114.8 635.4,114.8 680.3,114.7 725.3,114.7 770.2,114.7 815.2,114.6 860.1,114.6 905.1,114.6 950.0,114.6 950.0,126.2 905.1,127.0 860.1,127.8 815.2,128.7 770.2,129.8 725.3,130.9 680.3,132.3 635.4,133.8 590.4,135.6 545.5,137.7 500.5,140.3 455.6,143.4 410.6,147.3 365.7,152.2 320.7,158.9 275.8,168.1 230.8,182.0 185.9,205.1 140.9,251.4 96.0,390.0" fill="#f4c7a5" opacity=".55"/><polyline points="96.0,112.8 140.9,114.1 185.9,114.5 230.8,114.7 275.8,114.8 320.7,114.8 365.7,114.9 410.6,114.9 455.6,114.9 500.5,114.8 545.5,114.8 590.4,114.8 635.4,114.8 680.3,114.7 725.3,114.7 770.2,114.7 815.2,114.6 860.1,114.6 905.1,114.6 950.0,114.6" fill="none" stroke="#5564bd" stroke-width="3"/><polyline points="96.0,390.0 140.9,251.4 185.9,205.1 230.8,182.0 275.8,168.1 320.7,158.9 365.7,152.2 410.6,147.3 455.6,143.4 500.5,140.3 545.5,137.7 590.4,135.6 635.4,133.8 680.3,132.3 725.3,130.9 770.2,129.8 815.2,128.7 860.1,127.8 905.1,127.0 950.0,126.2" fill="none" stroke="#d0652a" stroke-width="3"/><circle cx="96.0" cy="390.0" r="5" fill="#d0652a"/><text x="108.0" y="378.0" font-size="13" font-weight="700" text-anchor="start" fill="#9c4317">差 99.0 个百分点</text><circle cx="275.8" cy="168.1" r="5" fill="#d0652a"/><text x="287.8" y="190.1" font-size="13" font-weight="700" text-anchor="start" fill="#9c4317">差 19.0 个百分点</text><circle cx="680.3" cy="132.3" r="5" fill="#d0652a"/><text x="692.3" y="154.3" font-size="13" font-weight="700" text-anchor="start" fill="#9c4317">差 6.3 个百分点</text><circle cx="950.0" cy="126.2" r="5" fill="#d0652a"/><text x="938.0" y="148.2" font-size="13" font-weight="700" text-anchor="end" fill="#9c4317">差 4.2 个百分点</text><path d="M 700 96 h 24" stroke="#5564bd" stroke-width="3"/><text x="732.0" y="101.0" font-size="14" font-weight="700" text-anchor="start" fill="#5564bd">不切换</text><path d="M 830 96 h 24" stroke="#d0652a" stroke-width="3"/><text x="862.0" y="101.0" font-size="14" font-weight="700" text-anchor="start" fill="#d0652a">切换一次</text><text x="32.0" y="484.0" font-size="13" font-weight="400" text-anchor="start" fill="#536079">整轮命中率 = 命中缓存的输入 ÷ 全部输入。规律:一轮调用 n 次,切换一次最多让命中率下降 1/n。</text></g></svg>
diff --git a/news/assets/cache-impact-en.svg b/news/assets/cache-impact-en.svg
new file mode 100644
index 00000000..06105cf3
--- /dev/null
+++ b/news/assets/cache-impact-en.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 330" role="img"><title>A perfect cache would add only about 3 points of savings</title><rect width="1000" height="330" rx="20" fill="#eef2fa"/><g font-family="system-ui,sans-serif" fill="#192439"><text x="32" y="46" font-size="24" font-weight="700">A perfect cache would add only about 3 points of savings</text><text x="32" y="76" font-size="15" fill="#536079">Astra × Qwen experiment, pair 3 (the accepted pair where caching matters more), USD per task</text><text x="368.0" y="131.0" font-size="14" font-weight="400" text-anchor="end" fill="#192439">All Astra (recorded)</text><rect x="380" y="114" width="451.0" height="26" rx="4" fill="#5564bd"/><text x="839.0" y="132.0" font-size="14" font-weight="700" text-anchor="start" fill="#192439">$2.067</text><text x="368.0" y="183.0" font-size="14" font-weight="400" text-anchor="end" fill="#192439">HiRoute mixed (recorded, no Qwen cache hits)</text><rect x="380" y="166" width="38.8" height="26" rx="4" fill="#078677"/><text x="426.8" y="184.0" font-size="14" font-weight="700" text-anchor="start" fill="#192439">$0.178</text><text x="502.8" y="184.0" font-size="15" font-weight="700" text-anchor="start" fill="#056356">91% saved</text><text x="368.0" y="235.0" font-size="14" font-weight="400" text-anchor="end" fill="#192439">HiRoute mixed, if every input hit the cache</text><rect x="380" y="218" width="27.0" height="26" rx="4" fill="#5fb8a9"/><text x="415.0" y="236.0" font-size="14" font-weight="700" text-anchor="start" fill="#192439">$0.124</text><text x="502.8" y="236.0" font-size="15" font-weight="700" text-anchor="start" fill="#056356">94% saved</text><text x="32.0" y="296.0" font-size="13" font-weight="400" text-anchor="start" fill="#536079">Caching only discounts input. Even fully cached, $0.117 of the remaining $0.124 is output.</text></g></svg>
diff --git a/news/assets/cache-impact-zh.svg b/news/assets/cache-impact-zh.svg
new file mode 100644
index 00000000..2636981c
--- /dev/null
+++ b/news/assets/cache-impact-zh.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 330" role="img"><title>缓存全命中,也只多省约 3 个百分点</title><rect width="1000" height="330" rx="20" fill="#eef2fa"/><g font-family="system-ui,sans-serif" fill="#192439"><text x="32" y="46" font-size="24" font-weight="700">缓存全命中,也只多省约 3 个百分点</text><text x="32" y="76" font-size="15" fill="#536079">Astra × Qwen 实验第 3 组(两组达标运行中缓存影响较大的一组),美元/单</text><text x="368.0" y="131.0" font-size="14" font-weight="400" text-anchor="end" fill="#192439">全用 Astra(实际记录)</text><rect x="380" y="114" width="451.0" height="26" rx="4" fill="#5564bd"/><text x="839.0" y="132.0" font-size="14" font-weight="700" text-anchor="start" fill="#192439">$2.067</text><text x="368.0" y="183.0" font-size="14" font-weight="400" text-anchor="end" fill="#192439">HiRoute 混合(实际记录,Qwen 零缓存命中)</text><rect x="380" y="166" width="38.8" height="26" rx="4" fill="#078677"/><text x="426.8" y="184.0" font-size="14" font-weight="700" text-anchor="start" fill="#192439">$0.178</text><text x="502.8" y="184.0" font-size="15" font-weight="700" text-anchor="start" fill="#056356">省 91%</text><text x="368.0" y="235.0" font-size="14" font-weight="400" text-anchor="end" fill="#192439">HiRoute 混合(假设输入全部命中缓存)</text><rect x="380" y="218" width="27.0" height="26" rx="4" fill="#5fb8a9"/><text x="415.0" y="236.0" font-size="14" font-weight="700" text-anchor="start" fill="#192439">$0.124</text><text x="502.8" y="236.0" font-size="15" font-weight="700" text-anchor="start" fill="#056356">省 94%</text><text x="32.0" y="296.0" font-size="13" font-weight="400" text-anchor="start" fill="#536079">缓存只给输入打折。即使输入全部命中,混合路由剩下的 $0.124 里仍有 $0.117 是输出费用。</text></g></svg>
diff --git a/news/assets/cache-price-break-even-en.svg b/news/assets/cache-price-break-even-en.svg
new file mode 100644
index 00000000..95b42bce
--- /dev/null
+++ b/news/assets/cache-price-break-even-en.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 505" role="img"><title>Astra would need a ~95% price cut to break even</title><rect width="1000" height="505" rx="20" fill="#eef2fa"/><g font-family="system-ui,sans-serif" fill="#192439"><text x="32" y="46" font-size="24" font-weight="700">Astra would need a ~95% price cut to break even</text><text x="32" y="76" font-size="15" fill="#536079">Uniform Astra price cuts; Qwen prices, usage and outcomes fixed; all-Astra still has every input cached</text><rect x="96" y="375.8" width="834" height="24.2" fill="#f6dccb" opacity=".7"/><text x="920.0" y="393.0" font-size="13" font-weight="400" text-anchor="end" fill="#9c4317">Below 1×: all Astra is cheaper</text><path d="M 96 400.0 H 930" stroke="#d3d9e8"/><path d="M 96 375.8 H 930" stroke="#d3d9e8"/><text x="86.0" y="380.8" font-size="13" font-weight="400" text-anchor="end" fill="#536079">1×</text><path d="M 96 327.5 H 930" stroke="#d3d9e8"/><text x="86.0" y="332.5" font-size="13" font-weight="400" text-anchor="end" fill="#536079">3×</text><path d="M 96 255.0 H 930" stroke="#d3d9e8"/><text x="86.0" y="260.0" font-size="13" font-weight="400" text-anchor="end" fill="#536079">6×</text><path d="M 96 182.5 H 930" stroke="#d3d9e8"/><text x="86.0" y="187.5" font-size="13" font-weight="400" text-anchor="end" fill="#536079">9×</text><path d="M 96 110.0 H 930" stroke="#d3d9e8"/><text x="86.0" y="115.0" font-size="13" font-weight="400" text-anchor="end" fill="#536079">12×</text><text x="96.0" y="424.0" font-size="13" font-weight="400" text-anchor="middle" fill="#536079">2%</text><text x="291.3" y="424.0" font-size="13" font-weight="400" text-anchor="middle" fill="#536079">5%</text><text x="439.1" y="424.0" font-size="13" font-weight="400" text-anchor="middle" fill="#536079">10%</text><text x="586.9" y="424.0" font-size="13" font-weight="400" text-anchor="middle" fill="#536079">20%</text><text x="782.2" y="424.0" font-size="13" font-weight="400" text-anchor="middle" fill="#536079">50%</text><text x="930.0" y="424.0" font-size="13" font-weight="400" text-anchor="middle" fill="#536079">100%</text><text x="513.0" y="450.0" font-size="14" font-weight="400" text-anchor="middle" fill="#536079">Astra price (today = 100%, log scale)</text><text x="96.0" y="100.0" font-size="13" font-weight="400" text-anchor="start" fill="#536079">All-Astra cost ÷ mixed-routing cost</text><polyline points="96.0,390.3 101.2,390.1 106.4,389.9 111.6,389.6 116.9,389.4 122.1,389.1 127.3,388.8 132.5,388.6 137.7,388.3 142.9,388.0 148.1,387.7 153.3,387.4 158.5,387.1 163.8,386.8 169.0,386.5 174.2,386.2 179.4,385.8 184.6,385.5 189.8,385.1 195.0,384.8 200.3,384.4 205.5,384.0 210.7,383.7 215.9,383.3 221.1,382.9 226.3,382.5 231.5,382.0 236.7,381.6 241.9,381.2 247.2,380.7 252.4,380.3 257.6,379.8 262.8,379.3 268.0,378.8 273.2,378.3 278.4,377.8 283.6,377.3 288.9,376.8 294.1,376.2 299.3,375.6 304.5,375.1 309.7,374.5 314.9,373.9 320.1,373.3 325.3,372.7 330.6,372.0 335.8,371.4 341.0,370.7 346.2,370.0 351.4,369.3 356.6,368.6 361.8,367.9 367.0,367.1 372.3,366.4 377.5,365.6 382.7,364.8 387.9,364.0 393.1,363.2 398.3,362.3 403.5,361.5 408.8,360.6 414.0,359.7 419.2,358.8 424.4,357.8 429.6,356.9 434.8,355.9 440.0,354.9 445.2,353.9 450.5,352.9 455.7,351.8 460.9,350.7 466.1,349.6 471.3,348.5 476.5,347.4 481.7,346.2 486.9,345.0 492.2,343.8 497.4,342.6 502.6,341.3 507.8,340.1 513.0,338.8 518.2,337.4 523.4,336.1 528.6,334.7 533.9,333.3 539.1,331.9 544.3,330.4 549.5,329.0 554.7,327.4 559.9,325.9 565.1,324.4 570.3,322.8 575.5,321.2 580.8,319.5 586.0,317.9 591.2,316.2 596.4,314.4 601.6,312.7 606.8,310.9 612.0,309.1 617.2,307.3 622.5,305.4 627.7,303.5 632.9,301.6 638.1,299.7 643.3,297.7 648.5,295.7 653.7,293.6 659.0,291.6 664.2,289.5 669.4,287.4 674.6,285.2 679.8,283.0 685.0,280.8 690.2,278.6 695.4,276.3 700.7,274.0 705.9,271.7 711.1,269.4 716.3,267.0 721.5,264.6 726.7,262.1 731.9,259.7 737.1,257.2 742.4,254.7 747.6,252.2 752.8,249.6 758.0,247.0 763.2,244.4 768.4,241.7 773.6,239.1 778.8,236.4 784.0,233.7 789.3,231.0 794.5,228.2 799.7,225.4 804.9,222.6 810.1,219.8 815.3,217.0 820.5,214.1 825.8,211.3 831.0,208.4 836.2,205.5 841.4,202.6 846.6,199.6 851.8,196.7 857.0,193.7 862.2,190.7 867.5,187.7 872.7,184.7 877.9,181.7 883.1,178.7 888.3,175.7 893.5,172.6 898.7,169.6 903.9,166.5 909.1,163.5 914.4,160.4 919.6,157.4 924.8,154.3 930.0,151.2" fill="none" stroke="#5564bd" stroke-width="3"/><circle cx="930.0" cy="151.2" r="5" fill="#5564bd"/><text x="930.0" y="139.2" font-size="14" font-weight="700" text-anchor="middle" fill="#3a4796">10.3×</text><circle cx="782.2" cy="234.6" r="5" fill="#5564bd"/><text x="782.2" y="222.6" font-size="14" font-weight="700" text-anchor="middle" fill="#3a4796">6.8×</text><circle cx="586.9" cy="317.6" r="5" fill="#5564bd"/><text x="586.9" y="305.6" font-size="14" font-weight="700" text-anchor="middle" fill="#3a4796">3.4×</text><circle cx="439.1" cy="355.1" r="5" fill="#5564bd"/><text x="439.1" y="343.1" font-size="14" font-weight="700" text-anchor="middle" fill="#3a4796">1.9×</text><circle cx="297.6" cy="375.8" r="6" fill="#d0652a"/><text x="285.6" y="361.8" font-size="14" font-weight="700" text-anchor="end" fill="#9c4317">Break-even: about 5.1% of today</text><text x="32.0" y="488.0" font-size="13" font-weight="400" text-anchor="start" fill="#536079">Pair 3; mixed routing uses its cost upper bound, with every Qwen input billed as uncached.</text></g></svg>
diff --git a/news/assets/cache-price-break-even-zh.svg b/news/assets/cache-price-break-even-zh.svg
new file mode 100644
index 00000000..3a4ef713
--- /dev/null
+++ b/news/assets/cache-price-break-even-zh.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 505" role="img"><title>Astra 要降价约 95%,两种方案才打平</title><rect width="1000" height="505" rx="20" fill="#eef2fa"/><g font-family="system-ui,sans-serif" fill="#192439"><text x="32" y="46" font-size="24" font-weight="700">Astra 要降价约 95%,两种方案才打平</text><text x="32" y="76" font-size="15" fill="#536079">假设 Astra 各项单价同比例下调,Qwen 价格、用量和交付结果不变;全用 Astra 仍按输入全命中缓存计算</text><rect x="96" y="375.8" width="834" height="24.2" fill="#f6dccb" opacity=".7"/><text x="920.0" y="393.0" font-size="13" font-weight="400" text-anchor="end" fill="#9c4317">低于 1×:全用 Astra 更便宜</text><path d="M 96 400.0 H 930" stroke="#d3d9e8"/><path d="M 96 375.8 H 930" stroke="#d3d9e8"/><text x="86.0" y="380.8" font-size="13" font-weight="400" text-anchor="end" fill="#536079">1×</text><path d="M 96 327.5 H 930" stroke="#d3d9e8"/><text x="86.0" y="332.5" font-size="13" font-weight="400" text-anchor="end" fill="#536079">3×</text><path d="M 96 255.0 H 930" stroke="#d3d9e8"/><text x="86.0" y="260.0" font-size="13" font-weight="400" text-anchor="end" fill="#536079">6×</text><path d="M 96 182.5 H 930" stroke="#d3d9e8"/><text x="86.0" y="187.5" font-size="13" font-weight="400" text-anchor="end" fill="#536079">9×</text><path d="M 96 110.0 H 930" stroke="#d3d9e8"/><text x="86.0" y="115.0" font-size="13" font-weight="400" text-anchor="end" fill="#536079">12×</text><text x="96.0" y="424.0" font-size="13" font-weight="400" text-anchor="middle" fill="#536079">2%</text><text x="291.3" y="424.0" font-size="13" font-weight="400" text-anchor="middle" fill="#536079">5%</text><text x="439.1" y="424.0" font-size="13" font-weight="400" text-anchor="middle" fill="#536079">10%</text><text x="586.9" y="424.0" font-size="13" font-weight="400" text-anchor="middle" fill="#536079">20%</text><text x="782.2" y="424.0" font-size="13" font-weight="400" text-anchor="middle" fill="#536079">50%</text><text x="930.0" y="424.0" font-size="13" font-weight="400" text-anchor="middle" fill="#536079">100%</text><text x="513.0" y="450.0" font-size="14" font-weight="400" text-anchor="middle" fill="#536079">Astra 价格(今天 = 100%,对数刻度)</text><text x="96.0" y="100.0" font-size="13" font-weight="400" text-anchor="start" fill="#536079">全用 Astra 的花费 ÷ 混合路由的花费</text><polyline points="96.0,390.3 101.2,390.1 106.4,389.9 111.6,389.6 116.9,389.4 122.1,389.1 127.3,388.8 132.5,388.6 137.7,388.3 142.9,388.0 148.1,387.7 153.3,387.4 158.5,387.1 163.8,386.8 169.0,386.5 174.2,386.2 179.4,385.8 184.6,385.5 189.8,385.1 195.0,384.8 200.3,384.4 205.5,384.0 210.7,383.7 215.9,383.3 221.1,382.9 226.3,382.5 231.5,382.0 236.7,381.6 241.9,381.2 247.2,380.7 252.4,380.3 257.6,379.8 262.8,379.3 268.0,378.8 273.2,378.3 278.4,377.8 283.6,377.3 288.9,376.8 294.1,376.2 299.3,375.6 304.5,375.1 309.7,374.5 314.9,373.9 320.1,373.3 325.3,372.7 330.6,372.0 335.8,371.4 341.0,370.7 346.2,370.0 351.4,369.3 356.6,368.6 361.8,367.9 367.0,367.1 372.3,366.4 377.5,365.6 382.7,364.8 387.9,364.0 393.1,363.2 398.3,362.3 403.5,361.5 408.8,360.6 414.0,359.7 419.2,358.8 424.4,357.8 429.6,356.9 434.8,355.9 440.0,354.9 445.2,353.9 450.5,352.9 455.7,351.8 460.9,350.7 466.1,349.6 471.3,348.5 476.5,347.4 481.7,346.2 486.9,345.0 492.2,343.8 497.4,342.6 502.6,341.3 507.8,340.1 513.0,338.8 518.2,337.4 523.4,336.1 528.6,334.7 533.9,333.3 539.1,331.9 544.3,330.4 549.5,329.0 554.7,327.4 559.9,325.9 565.1,324.4 570.3,322.8 575.5,321.2 580.8,319.5 586.0,317.9 591.2,316.2 596.4,314.4 601.6,312.7 606.8,310.9 612.0,309.1 617.2,307.3 622.5,305.4 627.7,303.5 632.9,301.6 638.1,299.7 643.3,297.7 648.5,295.7 653.7,293.6 659.0,291.6 664.2,289.5 669.4,287.4 674.6,285.2 679.8,283.0 685.0,280.8 690.2,278.6 695.4,276.3 700.7,274.0 705.9,271.7 711.1,269.4 716.3,267.0 721.5,264.6 726.7,262.1 731.9,259.7 737.1,257.2 742.4,254.7 747.6,252.2 752.8,249.6 758.0,247.0 763.2,244.4 768.4,241.7 773.6,239.1 778.8,236.4 784.0,233.7 789.3,231.0 794.5,228.2 799.7,225.4 804.9,222.6 810.1,219.8 815.3,217.0 820.5,214.1 825.8,211.3 831.0,208.4 836.2,205.5 841.4,202.6 846.6,199.6 851.8,196.7 857.0,193.7 862.2,190.7 867.5,187.7 872.7,184.7 877.9,181.7 883.1,178.7 888.3,175.7 893.5,172.6 898.7,169.6 903.9,166.5 909.1,163.5 914.4,160.4 919.6,157.4 924.8,154.3 930.0,151.2" fill="none" stroke="#5564bd" stroke-width="3"/><circle cx="930.0" cy="151.2" r="5" fill="#5564bd"/><text x="930.0" y="139.2" font-size="14" font-weight="700" text-anchor="middle" fill="#3a4796">10.3 倍</text><circle cx="782.2" cy="234.6" r="5" fill="#5564bd"/><text x="782.2" y="222.6" font-size="14" font-weight="700" text-anchor="middle" fill="#3a4796">6.8 倍</text><circle cx="586.9" cy="317.6" r="5" fill="#5564bd"/><text x="586.9" y="305.6" font-size="14" font-weight="700" text-anchor="middle" fill="#3a4796">3.4 倍</text><circle cx="439.1" cy="355.1" r="5" fill="#5564bd"/><text x="439.1" y="343.1" font-size="14" font-weight="700" text-anchor="middle" fill="#3a4796">1.9 倍</text><circle cx="297.6" cy="375.8" r="6" fill="#d0652a"/><text x="285.6" y="361.8" font-size="14" font-weight="700" text-anchor="end" fill="#9c4317">打平:约今天的 5.1%</text><text x="32.0" y="488.0" font-size="13" font-weight="400" text-anchor="start" fill="#536079">第 3 组数据;混合方案取成本上限,其中 Qwen 输入全部按未命中缓存计费。</text></g></svg>
diff --git a/news/index.json b/news/index.json
index 492fe1c0..068b0516 100644
--- a/news/index.json
+++ b/news/index.json
@@ -3,16 +3,16 @@
"slug": "routing-cache-cost",
"date": "2026-10-14",
"title": {
- "zh": "模型切换的缓存影响与智能路由成本分析",
- "en": "Model Switching Cache Effects and Smart Routing Costs"
+ "zh": "切换模型会丢缓存,但省下的钱丢不掉",
+ "en": "Switching Models Loses Cache, Not the Savings"
},
"shortTitle": {
"zh": "模型切换、缓存与整单成本",
"en": "Model switching, caching, and task cost"
},
"description": {
- "zh": "解释 HiRoute 如何保护连续调用的缓存复用,用 Astra 与 Qwen 3.8 Flash 的实验价格和用量计算缓存损失、摊薄条件与整单成本余量。",
- "en": "How HiRoute protects cache reuse, with calculations of cache losses, amortization, and whole-task cost margins using the Astra and Qwen 3.8 Flash experiment."
+ "zh": "为什么切换模型丢掉的缓存抵不掉智能路由省下的钱:在 Astra 与 Qwen 3.8 Flash 实验中,就算缓存全部命中,省钱比例也只变化几个百分点。",
+ "en": "Why the cache lost in a model switch does not cancel smart-routing savings: in the Astra and Qwen 3.8 Flash experiment, even a perfect cache changes the saving by only a few points."
},
"files": {
"zh": "2026-10-14-routing-cache-cost.zh-CN.md",