Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

fix(cost): drop remaining unnecessary cast in batch cost calculator

kerry168d0d3d997e
diff --git a/litellm/cost_calculator.py b/litellm/cost_calculator.py
index 39af725a231..3dc6d81256b 100644
--- a/litellm/cost_calculator.py
+++ b/litellm/cost_calculator.py
@@ -2365,7 +2365,7 @@ def batch_cost_calculator(
tokens * rate
for tokens, rate in zip(
(
- max(cast(int, usage.prompt_tokens) - audio_tokens - image_tokens - video_tokens, 0),
+ max((usage.prompt_tokens or 0) - audio_tokens - image_tokens - video_tokens, 0),
audio_tokens,
image_tokens,
video_tokens,