Skip to content

Commit 7d66785

Browse files
committed
docs(pricing): explain all-or-nothing long-context overlay check
Codex review suggested filling missing tier fields independently when a refreshed LiteLLM entry carries partial *_above_200k_tokens data. That would mix rates that assume the 200K LiteLLM boundary with built-in rates that assume the OpenAI 272K boundary under a single per-model threshold, mispricing both tiers, so the overlay defers to upstream entirely once any tier rate exists. Record that rationale next to the check.
1 parent 18bc4c9 commit 7d66785

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

‎rust/crates/ccusage/src/pricing.rs‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,10 @@ impl PricingMap {
639639
/// entries only carry the flat rates. Runs after every pricing load
640640
/// (embedded and live) because LiteLLM refreshes replace whole entries.
641641
/// Entries that already carry any tier rate are left untouched so
642-
/// upstream data wins once it exists.
642+
/// upstream data wins once it exists. The check is deliberately
643+
/// all-or-nothing rather than per field: upstream `*_above_200k_tokens`
644+
/// values assume the 200K boundary, so mixing them with built-in rates
645+
/// that assume the OpenAI 272K boundary would price both tiers wrong.
643646
fn apply_builtin_long_context_rates(&mut self) {
644647
for (model, pricing) in &mut self.entries {
645648
if pricing.input_above_200k.is_some()

0 commit comments

Comments
 (0)