Skip to content

Conversation

@araa47
Copy link

@araa47 araa47 commented Jan 17, 2026

Summary

Multi-region locations (us, eu, asia, europe, me, northamerica, southamerica, africa) require the global endpoint aiplatform.googleapis.com, not {location}-aiplatform.googleapis.com.

Problem

When using Vertex AI with multi-region locations like us or eu, the SDK constructs an invalid URL:

https://us-aiplatform.googleapis.com/v1/projects/.../locations/us/...

This returns an HTML 404 error because us-aiplatform.googleapis.com doesn't exist.

Current Workaround

Users can work around this by setting the environment variable:

GOOGLE_VERTEX_BASE_URL=https://aiplatform.googleapis.com/

However, this forces all requests to use the global endpoint, which may not be desired for users who want to use specific regional endpoints for data residency or latency reasons.

Solution

The correct URL for multi-region locations uses the global endpoint with the location in the path:

https://aiplatform.googleapis.com/v1/projects/.../locations/us/...

This PR updates baseUrlFromProjectLocation() to recognize all multi-region locations and route them to the global endpoint, while preserving the existing behavior for regional endpoints like us-central1, europe-west1, etc.

Multi-Region Locations

Per Google Cloud documentation:

Location Type
global Already handled
us Multi-region
eu Multi-region
asia Multi-region
europe Multi-region
me Multi-region
northamerica Multi-region
southamerica Multi-region
africa Multi-region

Test Plan

  • Added unit tests for all 8 new multi-region locations
  • Verified regional endpoints (us-central1, me-central1, etc.) continue to work
  • Tested against live Vertex AI API with gemini-2.0-flash model

Multi-region locations (us, eu, asia, europe, me, northamerica,
southamerica, africa) require the global endpoint aiplatform.googleapis.com,
not {location}-aiplatform.googleapis.com which doesn't exist.

This fixes 404 errors when using locations like 'us' or 'eu' with Vertex AI.
@google-cla
Copy link

google-cla bot commented Jan 17, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

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.

1 participant