Skip to content

fix(vertex_ai): add Gemini 3.7 Flash regions - #37991

Open
pmerlin1 wants to merge 3 commits into
BerriAI:litellm_internal_stagingfrom
pmerlin1:codex/gemini-37-vertex-regions
Open

pmerlin1 wants to merge 3 commits into
BerriAI:litellm_internal_stagingfrom
pmerlin1:codex/gemini-37-vertex-regions

Conversation

@pmerlin1

@pmerlin1 pmerlin1 commented Aug 23, 2026

Copy link
Copy Markdown

TLDR

Problem this solves:

  • Gemini 3.7 Flash falls back to unsupported us-central1 when no location is supplied
  • Saved deployments return Vertex AI publisher-model 404 errors

How it solves it:

  • Registers Gemini 3.7 Flash's supported Vertex AI locations: global, us, and eu
  • Defaults a missing location to global
  • Preserves explicitly configured locations instead of silently changing their residency boundary
  • Tests missing, supported, and unsupported explicit locations

User Flow

Before: a proxy admin saves Gemini 3.7 Flash, but a deployment without a persisted location routes to unsupported us-central1

  1. They open /ui/?page=models, add vertex_ai/gemini-3.7-flash, enter their Vertex project, set the location to global, and see the connection test succeed
  2. They save the deployment and send POST /v1/chat/completions with "model": "gemini-3.7-flash"
  3. The request returns 404 because the publisher-model path contains locations/us-central1

After: a missing saved location defaults to a supported endpoint without overriding an explicit regional setting

  1. They save or configure vertex_ai/gemini-3.7-flash
  2. A deployment with no location uses global
  3. Explicit global, us, eu, or regional values remain unchanged

Relevant issues

Fixes #37989

Linear ticket

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have added meaningful tests
  • The handful of test files covering my change pass locally, e.g. uv run pytest tests/test_litellm/<your_test_file>.py -v. Leave the suites (make test-unit-*, make test-unit) to CI: it finishes in ~15 minutes where a laptop takes an hour or more
  • My PR passes all required CI/CD checks (e.g., lint, schema.d.ts sync check, etc.)
  • My PR's scope is as isolated as possible; it only solves 1 specific problem
  • I have received a Greptile Confidence Score of at least 4/5 before requesting a maintainer review (Greptile reviews automatically once the PR is opened; only comment @greptileai to re-request a review after pushing changes)

Delays in PR merge?

If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review)

Screenshots / Proof of Fix

Before (75613bf)

  1. Run git show 75613bf22f:model_prices_and_context_window.json | jq '."vertex_ai/gemini-3.7-flash".supported_regions // null'
  2. The command prints null, so LiteLLM has no model-specific location metadata
  3. A live saved-model request returns 404 with locations/us-central1 in the Vertex AI publisher-model path, as reproduced in [Bug]: Vertex AI Gemini 3.7 Flash defaults to unsupported us-central1 location #37989

After (e05d99d)

  1. Run git show e05d99d345:model_prices_and_context_window.json | jq '."vertex_ai/gemini-3.7-flash".supported_regions // null'
  2. The command prints ["global", "us", "eu"], matching the Gemini 3.7 Flash model page
  3. Missing locations resolve to global; explicit locations remain unchanged

Type

🐛 Bug Fix
✅ Test

Caveats (if any)

  • Live after-proof requires deploying a build from this branch
  • This PR does not change model-save parameter persistence
  • Explicit unsupported locations are preserved and can still produce a provider error; LiteLLM no longer silently broadens them

QA runbook

  • tests/test_litellm/llms/vertex_ai/test_vertex_ai_common_utils.py::test_get_vertex_region_gemini_3_7_flash verifies Gemini 3.7 Flash location selection
    • Run the parametrized test with no location and expect global
    • Run it with global, us, and eu and expect each unchanged
    • Run it with us-central1 and expect us-central1 unchanged
  • Qwen and Gemma resolver tests verify the same explicit-location contract for global-only model metadata

Final Attestation

  • The tests check the right things, including the edge cases, and regressions in the respective real-world customer use-cases are not possible after this PR

@pmerlin1
pmerlin1 requested a review from mateo-berri as a code owner August 23, 2026 01:45
Comment thread tests/test_litellm/llms/vertex_ai/test_vertex_ai_common_utils.py Outdated
@veria-ai

veria-ai Bot commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

PR overview

All previously flagged issues have been addressed. No open security concerns remain on this pull request.

Security review

No open security issues remain on this pull request.

Fixed/addressed: 1 · PR risk: 0/10

@greptile-apps

greptile-apps Bot commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This follow-up synchronizes Gemini 3.7 Flash region metadata into both model catalogs while preserving explicitly configured Vertex AI locations.

  • Registers global, us, and eu as supported regions for Gemini 3.7 Flash.
  • Uses global when this model has no configured location.
  • Preserves explicit locations and updates the corresponding Gemini, Gemma, and Qwen tests.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
litellm/llms/vertex_ai/vertex_llm_base.py Region resolution now uses catalog metadata only for missing locations and preserves every explicit location.
model_prices_and_context_window.json Adds Gemini 3.7 Flash region metadata to the root model registry.
litellm/model_prices_and_context_window_backup.json Synchronizes the packaged runtime catalog with the root registry.
tests/test_litellm/llms/vertex_ai/test_vertex_ai_common_utils.py Covers missing, supported, and explicitly configured region resolution for Gemini 3.7 Flash.
tests/test_litellm/llms/vertex_ai/vertex_ai_partner_models/gemma/test_vertex_ai_gemma_global_endpoint.py Updates Gemma coverage to enforce preservation of explicit regions.
tests/test_litellm/llms/vertex_ai/vertex_ai_partner_models/qwen/test_vertex_ai_qwen_global_endpoint.py Updates Qwen coverage to enforce preservation of explicit regions.

Reviews (3): Last reviewed commit: "fix(model_cost): sync Gemini 3.7 regions..." | Re-trigger Greptile

@codecov

codecov Bot commented Aug 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@devin-ai-integration

Copy link
Copy Markdown
Contributor

Reviewed while consolidating registry changes into the rolling PR #37902. Not rolling this one in yet, reason in that PR description under 'Source PR disposition for this run'. Leaving it open for the author to respond.

@pmerlin1

Copy link
Copy Markdown
Author

Updated the resolver and tests to preserve explicit regions, and confirmed Google lists only global, us, and eu. @devin-ai-integration @greptileai please review again

@pmerlin1

Copy link
Copy Markdown
Author

Synced the packaged local model catalog with the root registry, fixing the CI failure while preserving explicit regions. @devin-ai-integration @greptileai please review again

@codspeed

codspeed Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 31 untouched benchmarks


Comparing pmerlin1:codex/gemini-37-vertex-regions (cca5fea) with litellm_internal_staging (ca0b951)

Open in CodSpeed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Vertex AI Gemini 3.7 Flash defaults to unsupported us-central1 location

2 participants