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 greptile review

Sameer Kankute64cbadb21605
diff --git a/litellm/cost_calculator.py b/litellm/cost_calculator.py
index aaede837ca9..699afba412f 100644
--- a/litellm/cost_calculator.py
+++ b/litellm/cost_calculator.py
@@ -58,9 +58,10 @@ from litellm.llms.lemonade.cost_calculator import (
cost_per_token as lemonade_cost_per_token,
)
from litellm.llms.openai.cost_calculation import (
+ _video_output_cost_per_second,
cost_per_second as openai_cost_per_second,
+ cost_per_token as openai_cost_per_token,
)
-from litellm.llms.openai.cost_calculation import cost_per_token as openai_cost_per_token
from litellm.llms.perplexity.cost_calculator import (
cost_per_token as perplexity_cost_per_token,
)
@@ -2038,8 +2039,6 @@ def default_video_cost_calculator(
if video_cost_per_second is not None:
return video_cost_per_second * duration_seconds
- from litellm.llms.openai.cost_calculation import _video_output_cost_per_second
-
output_cost_per_second = _video_output_cost_per_second(cost_info, video_resolution)
if output_cost_per_second is not None:
return output_cost_per_second * duration_seconds
diff --git a/litellm/llms/openai/cost_calculation.py b/litellm/llms/openai/cost_calculation.py
index 504163062c1..30f26ef6c3e 100644
--- a/litellm/llms/openai/cost_calculation.py
+++ b/litellm/llms/openai/cost_calculation.py
@@ -129,7 +129,14 @@ def cost_per_second(
def _video_resolution_to_cost_field_suffix(resolution: str) -> Optional[str]:
- """Map usage resolution to a safe suffix for ``output_cost_per_second_<suffix>`` keys."""
+ """
+ Map usage resolution to a safe suffix for ``output_cost_per_second_<suffix>`` keys.
+
+ Note: Currently only ``output_cost_per_second_1080p`` is explicitly declared in
+ ModelInfo (types/utils.py). Other resolution tiers (e.g., 720p, 4k) can be added
+ to model_prices_and_context_window.json but are not exposed via get_model_info()
+ until added to the ModelInfo TypedDict.
+ """
r = resolution.strip().lower()
if not r:
return None