Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
a1ec7cd
fix(vertex_ai): route Model Garden models through the generateContent…
devin-ai-integration[bot] Sep 18, 2026
66fb1c2
test(vertex_ai): annotate generateContent route test parameters
devin-ai-integration[bot] Sep 18, 2026
da29aa8
merge: origin/main into litellm_vertex_grok_generatecontent_route
devin-ai-integration[bot] Sep 18, 2026
c4bb4cb
Merge remote-tracking branch 'origin/main' into litellm_vertex_grok_g…
mateo-berri Oct 9, 2026
982e407
fix(vertex_ai): type litellm_params in get_vertex_ai_model_route
mateo-berri Oct 9, 2026
e9270ba
Merge remote-tracking branch 'origin/main' into litellm_vertex_grok_g…
mateo-berri Oct 15, 2026
371d5b6
fix(vertex_ai): bill and log Model Garden generateContent calls like …
mateo-berri Oct 15, 2026
c0dd7e9
Merge remote-tracking branch 'origin/main' into litellm_vertex_grok_g…
mateo-berri Oct 15, 2026
3f0f0d4
fix(google_genai): keep adapter stream usage, admin opt-out, single f…
mateo-berri Oct 15, 2026
39c32b2
Merge remote-tracking branch 'origin/main' into litellm_vertex_grok_g…
mateo-berri Oct 15, 2026
e7e1f25
fix(google_genai): ask for stream usage on every adapter stream so Cl…
mateo-berri Oct 15, 2026
bb54aa0
test(google_genai): expect the trailing usage chunk on bridged OpenAI…
mateo-berri Oct 15, 2026
1e79a15
fix(google_genai): end adapter streams with one STOP event carrying u…
mateo-berri Oct 15, 2026
560a0d9
fix(google_genai): send the held STOP event when no usage arrives, ke…
mateo-berri Oct 15, 2026
baef268
test(integration): cover the moved Vertex routes, adapter stream usag…
mateo-berri Oct 15, 2026
af2ec8d
test(integration): add cache-hit twins for the stream usage setting a…
mateo-berri Oct 15, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions litellm/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -10100,19 +10100,18 @@ def get_provider_google_genai_generate_content_config(

return GoogleGenAIConfig()
elif litellm.LlmProviders.VERTEX_AI == provider:
from litellm.llms.vertex_ai.common_utils import (
VertexAIModelRoute,
get_vertex_ai_model_route,
)
from litellm.llms.vertex_ai.google_genai.transformation import (
VertexAIGoogleGenAIConfig,
)
from litellm.llms.vertex_ai.vertex_ai_partner_models.main import (
VertexAIPartnerModels,
)

#########################################################
# If Vertex Partner models like Anthropic, Mistral, etc. are used,
# return None as we want this to go through the litellm.completion() adapter
# and not the Google Gen AI adapter
#########################################################
if VertexAIPartnerModels.is_vertex_partner_model(model):
if get_vertex_ai_model_route(model) in (
VertexAIModelRoute.PARTNER_MODELS,
VertexAIModelRoute.MODEL_GARDEN,
):
return None
Comment thread
greptile-apps[bot] marked this conversation as resolved.
Resolved

#########################################################
Expand Down
21 changes: 21 additions & 0 deletions tests/unit/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6645,6 +6645,27 @@ def test_get_model_info_gemini(monkeypatch):
assert info.get("rpm") is not None, f"{model} does not have rpm"


@pytest.mark.parametrize(
"model, expects_native_config",
[
("gemini-2.5-flash", True),
("xai/grok-4.6", False),
("claude-haiku-4-5@20251001", False),
("openai/gpt-oss-120b-maas", False),
],
)
def test_vertex_generate_content_config_follows_model_route(model: str, expects_native_config: bool):
from litellm.llms.vertex_ai.google_genai.transformation import VertexAIGoogleGenAIConfig

config: Final = ProviderConfigManager.get_provider_google_genai_generate_content_config(
model=model, provider=litellm.LlmProviders.VERTEX_AI
)
if expects_native_config:
assert isinstance(config, VertexAIGoogleGenAIConfig)
else:
assert config is None


@pytest.mark.parametrize(
("max_parallel_requests", "rpm", "tpm", "default_max_parallel_requests", "expected"),
[
Expand Down
Loading