litellm/litellm-rust
Yujong Lee c5db9162e0 refactor(model-catalog): typed price model in cost, wire and lowering layers
The catalog crate no longer depends on llms-types. It gets its own EffortLevel and a copy of LaxI64, so a new chat-completions variant can't change what the catalog accepts

litellm-cost now owns the money vocabulary and the normalized price model. UnitPrice is USD per unit, Usd is an amount and Multiplier is never below 1. Prices are keyed by Meter, Channel and When, where When holds the service tier and the prompt band, batch and decisions are channels, off-peak is an overlay with its schedule, and regional uplifts are Adjustments. Prices::band and Prices::rate resolve a token rate with the (tier, band), (standard, band), (tier, base), (standard, base) chain and fall back from cache prices to input. cost only gains serde and schemars behind optional features, and calculate and its input model are untouched

model-catalog is split into wire/, lower.rs and catalog.rs. EntryWire reads an entry in one pass and collects every bad value by key. lower.rs turns it into cost::Prices, Adjustments and Model and checks rules across keys such as duplicate prices, contiguous tiers, suffixes inside blocks and off-peak prices. Catalog::parse keeps every entry with its raw fields and lists problems per entry instead of rejecting the document, and an unknown weekday_timezone is reported without dropping the model. A JSON null means absent and sample_spec passes through untouched

served.rs is removed and nothing embeds the registry yet. Tests over the checked-in registry stay ignored, and they pass on main's JSON with no problems and every key understood. tests/price_lookup_reference.json pins band and rate to Python's _get_token_base_cost on main's JSON, regenerated by the script next to it
2026-10-20 17:53:42 -07:00
..
.agents/skills refactor(rust): derive strum VariantArray and string conversions (#45434) 2026-10-08 21:24:49 +00:00
crates refactor(model-catalog): typed price model in cost, wire and lowering layers 2026-10-20 17:53:42 -07:00
docs/adrs docs(rust): add ADRs for the Rust core (#45205) 2026-10-08 10:21:56 -07:00
.gitignore feat: add LiteLLM Rust workspace with Mistral OCR bridge (#31033) 2026-06-23 13:16:47 -07:00
AGENTS.md feat(rust): add native OpenRouter Responses (#46000) 2026-10-15 11:02:03 -07:00
Cargo.lock refactor(model-catalog): typed price model in cost, wire and lowering layers 2026-10-20 17:53:42 -07:00
Cargo.toml refactor(model-catalog): typed price model in cost, wire and lowering layers 2026-10-20 17:53:42 -07:00
clippy.toml feat(rust): add the MCP gateway (#43470) 2026-09-27 19:37:41 -07:00