litellm/tests/test_litellm/google_genai
Ankit Jha b00c00e5f8
fix: record vertex_location on the generate_content path so cost uses the configured region
The Vertex location decides the regional pricing uplift. The completion path
sets it on litellm_params and async_anthropic_messages_handler records it on
the logging object, but generate_content passed only litellm_call_id, so the
cost calculator never saw it.

The result is that a model configured `vertex_location: global` is priced as
us-central1 on POST /v1beta/models/{model}:generateContent and costs 10% more
than the same model over /v1/chat/completions. Two requests differing only in
the URL are billed differently, and spend cannot be reconciled against the
cloud bill.

Uses the same VertexBase.explicit_vertex_ai_location helper the anthropic
messages path already uses, so an unset location records nothing and the cost
calculator keeps its own fallback.

Fixes #40692

Signed-off-by: Ankit Jha <jhaankit373@gmail.com>
2026-09-11 20:36:23 +05:30
..
test_google_genai_adapter.py test: drop the cwd-relative sys.path.insert calls from the test suite (#37802) 2026-08-22 09:25:58 -07:00
test_google_genai_adapter_fixes.py test: drop the cwd-relative sys.path.insert calls from the test suite (#37802) 2026-08-22 09:25:58 -07:00
test_google_genai_handler.py test: drop the cwd-relative sys.path.insert calls from the test suite (#37802) 2026-08-22 09:25:58 -07:00
test_google_genai_main.py fix: record vertex_location on the generate_content path so cost uses the configured region 2026-09-11 20:36:23 +05:30
test_google_genai_streaming_iterator.py refactor(google_genai): pick the stream logging endpoint type at construction 2026-08-26 17:18:44 -07:00
test_google_genai_transformation.py test: drop the cwd-relative sys.path.insert calls from the test suite (#37802) 2026-08-22 09:25:58 -07:00