litellm - ✅(Solved) Fix Vertex AI multi-region endpoints (us/eu) not supported — wrong base URL constructed [1 pull requests, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
BerriAI/litellm#25926Fetched 2026-04-17 08:28:07
View on GitHub
Comments
0
Participants
1
Timeline
3
Reactions
1
Author
Participants
Timeline (top)
cross-referenced ×1labeled ×1referenced ×1

Error Message

The wrong URLs don't exist and return an HTML error page. Actual: Request sent to https://us-aiplatform.googleapis.com → HTML error page

Root Cause

File: litellm/llms/vertex_ai/common_utils.py

def get_vertex_base_url(vertex_location):
    if vertex_location == "global":
        return "https://aiplatform.googleapis.com"
    else:
        return f"https://{vertex_location}-aiplatform.googleapis.com"

For us and eu, this produces:

InputGenerated (wrong)Expected (correct)
"us"https://us-aiplatform.googleapis.comhttps://aiplatform.us.rep.googleapis.com
"eu"https://eu-aiplatform.googleapis.comhttps://aiplatform.eu.rep.googleapis.com

The wrong URLs don't exist and return an HTML error page.

Fix Action

Fixed

PR fix notes

PR #25928: fix(vertex_ai): support multi-region endpoints (us/eu) with correct URL scheme

Description (problem / solution / changelog)

Problem

Passing vertex_location="us" or vertex_location="eu" to use Google Vertex AI's multi-region endpoints generates an incorrect base URL:

InputGenerated (wrong)Expected (correct)
"us"https://us-aiplatform.googleapis.comhttps://aiplatform.us.rep.googleapis.com
"eu"https://eu-aiplatform.googleapis.comhttps://aiplatform.eu.rep.googleapis.com

The wrong URLs don't exist and return errors.

Root cause

get_vertex_base_url in litellm/llms/vertex_ai/common_utils.py only handled the "global" special case. Google's multi-region endpoints (announced April 2026) use the URL pattern aiplatform.{region}.rep.googleapis.com rather than {region}-aiplatform.googleapis.com.

Fix

Added a _VERTEX_MULTI_REGION_URLS lookup for "us" and "eu" locations before falling back to the regional URL pattern:

_VERTEX_MULTI_REGION_URLS = {
    "us": "https://aiplatform.us.rep.googleapis.com",
    "eu": "https://aiplatform.eu.rep.googleapis.com",
}

def get_vertex_base_url(vertex_location):
    if vertex_location == "global":
        return "https://aiplatform.googleapis.com"
    if vertex_location in _VERTEX_MULTI_REGION_URLS:
        return _VERTEX_MULTI_REGION_URLS[vertex_location]
    return f"https://{vertex_location}-aiplatform.googleapis.com"

Closes #25926

Changed files

  • litellm/llms/vertex_ai/common_utils.py (modified, +1124/-1117)

Code Example

def get_vertex_base_url(vertex_location):
    if vertex_location == "global":
        return "https://aiplatform.googleapis.com"
    else:
        return f"https://{vertex_location}-aiplatform.googleapis.com"

---

_MULTI_REGION_URLS = {
    "us": "https://aiplatform.us.rep.googleapis.com",
    "eu": "https://aiplatform.eu.rep.googleapis.com",
}

def get_vertex_base_url(vertex_location):
    if vertex_location == "global":
        return "https://aiplatform.googleapis.com"
    if vertex_location in _MULTI_REGION_URLS:
        return _MULTI_REGION_URLS[vertex_location]
    return f"https://{vertex_location}-aiplatform.googleapis.com"

---

import litellm

response = litellm.completion(
    model="vertex_ai/claude-opus-4-7",
    messages=[{"role": "user", "content": "Hello"}],
    vertex_project="your-project-id",
    vertex_location="us",  # or "eu"
)
RAW_BUFFERClick to expand / collapse

Bug

When passing vertex_location=\"us\" or vertex_location=\"eu\" to use Google Vertex AI's multi-region endpoints, LiteLLM constructs an incorrect base URL.

Root cause

File: litellm/llms/vertex_ai/common_utils.py

def get_vertex_base_url(vertex_location):
    if vertex_location == "global":
        return "https://aiplatform.googleapis.com"
    else:
        return f"https://{vertex_location}-aiplatform.googleapis.com"

For us and eu, this produces:

InputGenerated (wrong)Expected (correct)
"us"https://us-aiplatform.googleapis.comhttps://aiplatform.us.rep.googleapis.com
"eu"https://eu-aiplatform.googleapis.comhttps://aiplatform.eu.rep.googleapis.com

The wrong URLs don't exist and return an HTML error page.

Background

Google Vertex AI introduced multi-region endpoints (us, eu) on April 16, 2026. These use a different URL scheme (aiplatform.{region}.rep.googleapis.com) compared to regional endpoints ({region}-aiplatform.googleapis.com).

Proposed fix

_MULTI_REGION_URLS = {
    "us": "https://aiplatform.us.rep.googleapis.com",
    "eu": "https://aiplatform.eu.rep.googleapis.com",
}

def get_vertex_base_url(vertex_location):
    if vertex_location == "global":
        return "https://aiplatform.googleapis.com"
    if vertex_location in _MULTI_REGION_URLS:
        return _MULTI_REGION_URLS[vertex_location]
    return f"https://{vertex_location}-aiplatform.googleapis.com"

Steps to reproduce

import litellm

response = litellm.completion(
    model="vertex_ai/claude-opus-4-7",
    messages=[{"role": "user", "content": "Hello"}],
    vertex_project="your-project-id",
    vertex_location="us",  # or "eu"
)

Expected: Request routed to https://aiplatform.us.rep.googleapis.com
Actual: Request sent to https://us-aiplatform.googleapis.com → HTML error page

Environment

  • LiteLLM version: latest (main)
  • Affected locations: us, eu
  • Working locations: global, us-east5, europe-west1, etc.

extent analysis

TL;DR

Update the get_vertex_base_url function to correctly handle multi-region endpoints for Google Vertex AI.

Guidance

  • Verify the issue by checking the generated URL for us and eu locations using the get_vertex_base_url function.
  • Update the get_vertex_base_url function to use a dictionary-based approach to map multi-region locations to their correct URLs, as shown in the proposed fix.
  • Test the updated function with different locations, including us, eu, and global, to ensure correct URL generation.
  • Consider adding additional logging or error handling to detect and handle any future URL generation issues.

Example

_MULTI_REGION_URLS = {
    "us": "https://aiplatform.us.rep.googleapis.com",
    "eu": "https://aiplatform.eu.rep.googleapis.com",
}

def get_vertex_base_url(vertex_location):
    if vertex_location == "global":
        return "https://aiplatform.googleapis.com"
    if vertex_location in _MULTI_REGION_URLS:
        return _MULTI_REGION_URLS[vertex_location]
    return f"https://{vertex_location}-aiplatform.googleapis.com"

Notes

The proposed fix assumes that the us and eu locations are the only multi-region endpoints. If additional multi-region endpoints are introduced, the _MULTI_REGION_URLS dictionary will need to be updated accordingly.

Recommendation

Apply the proposed fix to update the get_vertex_base_url function, as it correctly handles multi-region endpoints and provides a scalable solution for future additions.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING