From 64cbadb216050bac9b96e8bdcda400bc07065f8d Mon Sep 17 00:00:00 2001 From: Sameer Kankute Date: Wed, 8 Apr 2026 22:08:52 +0530 Subject: [PATCH] Fix greptile review --- litellm/cost_calculator.py | 5 ++--- litellm/llms/openai/cost_calculation.py | 9 ++++++++- 2 files changed, 10 insertions(+), 4 deletions(-) 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_`` keys.""" + """ + Map usage resolution to a safe suffix for ``output_cost_per_second_`` 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