mirror of
https://github.com/BerriAI/litellm.git
synced 2026-08-28 05:25:59 +00:00
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 |
||
|---|---|---|
| .. | ||
| chat | ||
| test_perplexity.py | ||
| test_perplexity_cost_calculator.py | ||
| test_perplexity_integration.py | ||