mirror of
https://github.com/tiennm99/litellm.git
synced 2026-07-11 13:04:17 +00:00
5262896d62
Fixes #15337 Perplexity API returns pre-calculated costs in `usage.cost.total_cost` that include the `request_cost` (fixed per-request fee). LiteLLM was ignoring this and calculating costs manually, resulting in ~27x underreporting (e.g., $0.0002 vs actual $0.006). Changes: - Use `usage.cost.total_cost` from Perplexity response when available - Fall back to manual calculation if cost object not present - Add tests for both behaviors