# Model and provider routing respects prompt-cache cost Status: accepted ## Context A tier or provider switch makes the next request re-read the whole history uncached. Big histories make switches costly; a 1M-context session cannot move to a 200k model; Fable is the most expensive tier. ## Decision Up-tiers apply immediately; a cheaper tier only after `down_after` light prompts in a row, and the hold grows with history size. Fable is dropped at once. A tier is skipped if the history would not fit the target window. Provider choice prefers the current provider (keeps the cache), then a logged-in one with the exact tier; providers out of quota are avoided when alternatives exist; custom endpoints serve only when nothing else is logged in. Switching providers rebuilds the client even for the same provider so refreshed credentials are picked up. Auto picks and one-turn overrides are not recorded as the user's pinned choice. ## Consequences Fewer cache-busting switches at the cost of slower step-down. Routing needs the history size and window as inputs. Code: crates/hx-core/src/route.rs:Router::choose, pick_provider; switch.rs:Switcher::set_provider, prepare