Hi all,
I am currently setting up Vertex AI using the @Google/genai SDK for Node.js library. I have multiple users from different locations with individual credentials and am getting stuck on how to initialize the model location and endpoints.
The call for setting up the config is: https://googleapis.github.io/js-genai/release_docs/interfaces/client.GoogleGenAIOptions.html
import {GoogleGenAI} from '@google/genai';
const ai = new GoogleGenAI({
vertexai: true,
project: 'PROJECT_ID',
location: 'PROJECT_LOCATION'
});
From what I have read, a GCP project is not tied to a specific location. But, models seem to only be available in certain regions. If I hard-code a location in like 'us-central1' would that allow users around the world to use Vertex? Would that cause issues if their project is in a different location or create latency problems?
And, if I do not hardcode, how can I guarantee the endpoint so that if they were to use provisioned throughput, they could place the correct order?
I have had a hard time understanding exactly how this works, especially since I am new to working with GCP. I would appreciate any insight people may have!
Solved! Go to Solution.
Hi @mbillawala,
Welcome to Google Cloud Community!
GCP projects are global, but Vertex AI resources—such as models and endpoints—are region-specific. This means when you deploy a model, it will be assigned to a particular region like us-central1, europe-west4, or asia-southeast1.
If you hardcode a region like us-central1, then:
However, if your users are sensitive to latency (e.g., real-time applications like chat or streaming), consider multi-region deployments or region-aware routing to reduce delays.
It's important to note that while projects are global, resources like models and endpoints are tied to specific regions. As long as the user has the correct IAM permissions and access to the project, they can call the endpoint—even if they’re located elsewhere geographically or organizationally.
Best Practices:
For further reading on how Vertex AI manages model locations, endpoints, and regional configurations, check out the following resources:
Was this helpful? If so, please accept this answer as “Solution”. If you need additional assistance, reply here within 2 business days and I’ll be happy to help.