diff --git a/litellm/google_genai/main.py b/litellm/google_genai/main.py index 86f98d856b7..db1a11341fb 100644 --- a/litellm/google_genai/main.py +++ b/litellm/google_genai/main.py @@ -193,10 +193,8 @@ class GenerateContentHelper: if litellm_logging_obj is None: raise ValueError("litellm_logging_obj is required, but got None") - # The configured Vertex location decides the regional pricing uplift. The - # completion and anthropic_messages paths both record it here; without it - # the cost calculator falls back to a default region and prices a `global` - # model as us-central1, so the same model costs 10% more on this route. + # Record the configured location so a `global` model is not priced as + # us-central1 (+10%), matching the completion path. from litellm.llms.vertex_ai.vertex_llm_base import VertexBase explicit_vertex_location: Final = VertexBase.explicit_vertex_ai_location( diff --git a/tests/unit/google_genai/test_google_genai_main.py b/tests/unit/google_genai/test_google_genai_main.py index 497190ff914..275264e2542 100644 --- a/tests/unit/google_genai/test_google_genai_main.py +++ b/tests/unit/google_genai/test_google_genai_main.py @@ -282,11 +282,7 @@ def test_vertex_location_recorded_for_cost_calculation(configured_location): """ Regression for https://github.com/BerriAI/litellm/issues/40692 - The Vertex location decides the regional pricing uplift. The completion and - anthropic_messages paths record it on the logging object so the cost - calculator can price against the configured region. generate_content did - not, so a model configured `vertex_location: global` was priced as - us-central1 and cost 10% more than the same model over /v1/chat/completions. + generate_content must record vertex_location so `global` is not priced as us-central1. """ from litellm.google_genai.main import GenerateContentHelper