litellm/litellm-rust/crates/router
Claude a607d9657c
Some checks failed
LiteLLM Rust / rust-lint (push) Has been cancelled
LiteLLM Rust / rust-test (push) Has been cancelled
LiteLLM Rust / rust-wheel (push) Has been cancelled
docs(router): record the proxy switchover in the poc notes
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Aw1xktpUnix5tWhvSzey8t
2026-10-07 21:58:45 +00:00
..
src feat(router): put fallback targets to the proxy's access and budget checks from rust 2026-10-07 21:25:52 +00:00
tests feat(router): put fallback targets to the proxy's access and budget checks from rust 2026-10-07 21:25:52 +00:00
Cargo.toml feat(router): serve Router(...) from the Rust engine through python-bridge 2026-10-07 01:26:09 +00:00
POC-behavior-spec.md feat(router): serve the Responses API and Anthropic messages from the Rust backend 2026-10-07 03:55:48 +00:00
POC-strategy-contract.md docs(router): draft a contract for model-driven routing strategies 2026-10-07 20:57:11 +00:00
POC.md docs(router): record the proxy switchover in the poc notes 2026-10-07 21:58:45 +00:00
README.md feat(router): add the Rust routing engine to litellm-router 2026-10-07 01:03:01 +00:00

litellm-router holds two things. Router scaffolds the gateway's model-list lookup: Router::from_model_list(&config.model_list) maps configured public names to provider deployments, lookup is exact, and the last entry wins when public names repeat

engine::Engine is the routing core behind the Python litellm.Router Rust backend. It owns a snapshot::Registry (an ArcSwap of deployments, indices and settings) and runs the execute loop Python's router runs: pick a deployment with simple-shuffle, retry within the group, fall back across groups, cool deployments down and count usage. Every attempt goes to the host through host::RouterHost::invoke, so the engine never touches a provider call, a response or an exception object; the host answers with the response or a failure::Classified record of the error. Writes the host must make to the request's metadata and exceptions come back as ordered host::Ops

Runtime state lives in store::Store, in memory and optionally Redis, with the keys, value encodings and TTLs Python writes, so a Python router and a Rust router can share one Redis. random::PythonRandom is CPython's Mersenne Twister, so seeded runs pick the same deployments as Python