Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Aw1xktpUnix5tWhvSzey8t |
||
|---|---|---|
| .. | ||
| src | ||
| tests | ||
| Cargo.toml | ||
| POC-behavior-spec.md | ||
| POC-strategy-contract.md | ||
| POC.md | ||
| README.md | ||
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