litellm/litellm-rust/crates/cost
Yujong Lee 2f65871b42 refactor(cost): price characters and seconds with the Rust cost core [09/12]
cost::calculate gains character, second and text-message arms. Second meters take a Duration, so no caller hands a
millisecond to a per-second price. Speech, transcription, wall-clock, video, Replicate, realtime and Amazon Transcribe
price through Prices.price, the row's text unit replaces the Vertex model-name router, and the Vertex character band
and completion characters are fixed

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 09:11:28 -07:00
..
src refactor(cost): price characters and seconds with the Rust cost core [09/12] 2026-10-28 09:11:28 -07:00
Cargo.toml refactor(cost): price token usage with the Rust cost core [08/12] 2026-10-28 09:11:19 -07:00
README.md refactor(cost): price token usage with the Rust cost core [08/12] 2026-10-28 09:11:19 -07:00

litellm-cost

This crate holds the price data model that litellm-model-catalog lowers each catalog entry into, plus the usage, call context and priced outcome types. calculate prices a call's token usage over a row's Prices and Adjustments, one Line per meter with usage, and names the meter whose rate a line borrowed in fallback_from. Character, second and per-unit meters land in later PRs and are reported as missing until then. UnitPrice is USD per unit and Usd is an amount, and only the operations that make sense between them exist, so a price is never added to an amount. Prices::band picks the prompt band the way Python's _get_token_base_cost does