[Bug]: Usage pricing is order-dependent across provider-qualified models #5797
Before submitting#
- I searched existing issues and did not find a duplicate.
- I included enough detail to reproduce or investigate the problem.
Area#
apps/server
Steps to reproduce#
- Parse a LiteLLM rate document containing both a canonical model key such as
gpt-5and one or more provider-qualified keys ending in the same model name, such asreplicate/openai/gpt-5. - Give the entries different or incomplete cache rates.
- Change their insertion order.
- Look up pricing for the bare transcript model
gpt-5.
The usage rate-table parser strips every provider prefix before inserting entries into a single map, so all of these keys collide.
Expected behavior#
A bare transcript model should resolve deterministically to the canonical bare-model rate. Provider-qualified aliases should only resolve to their own provider-specific entry, or use an explicit deterministic fallback when no canonical entry exists. JSON entry order must not change pricing.
Actual behavior#
The last normalized collision silently wins. A provider-qualified entry can overwrite the canonical entry and supply different base rates or omit cache rates. In the current LiteLLM document, this can make cached input fall back to full input price rather than the canonical cache-read price.
Impact#
Major degradation or frequent failure
Version or commit#
main @ 963ebf5bd7cce00d40ff60c258b34c12dcab271e
Environment#
Provider-independent; reproduced against the server usage pricing parser and current LiteLLM model-price document.
Logs, stack traces, or screenshots#
The same logical entries produce different lookup results when their object order is reversed.
Workaround#
None in the application. Users must treat affected API-equivalent cost estimates as unreliable.
Confirmed on T3 Code Nightly
0.0.36-nightly.20260828.1209, Claude Code2.1.250.T3 displays nearly $5K, while Anthropic API billing is approximately $600. Repricing the local transcript tokens with canonical Claude cache rates gives approximately $605.
The current LiteLLM document ends the normalized
claude-fable-5collision withdeepinfra/anthropic/claude-fable-5, which has no cache-read/write fields. Consequently, T3 falls back to the full $10/MTok input rate instead of Fable’s $1/MTok cache-read rate. This appears to be a real-world reproduction of #5797.maria-rcks closed this
Sign in to join this conversation.
Experiencing this issue - that's a machine with a single $100 Claude sub Basically, Claude is counted an cacheless