|
Click your Gemini API provider to view provider-specific content and code on this page. |
Google's generative AI models are available in specific regions.
When initializing the Vertex AI Gemini API backend service in your code, you can specify the location for the model that you're accessing in your requests. See the list of available locations later on this page.
For accessing almost all Gemini models, the
Vertex AI Gemini API supports a global location, which means your
request will be handled by an available model anywhere in the global pool.
Setting the location to global for your requests can help you avoid hitting
capacity limits for the model and reduce "service overloaded" (503) errors.
Depending on the model, setting this location may be required:
Gemini preview models: Setting the location to
globalis required (except for Live API preview models).Gemini 3.x models: Setting the location to
globalis required when using Firebase AI Logic.Gemini 2.5 models: Setting the location is optional. If you don't specify a location, the default is
us-central1.Gemini Live API models: Setting the location is optional. If you don't specify a location, the default is
us-central1. Note that thegloballocation is not supported.
Here are some key facts and best practices about locations:
Capacity limits are per-model, per-region, per-minute.
To avoid hitting capacity limits unexpectedly, consider setting the location to
global(if your model supports thegloballocation).If setting the location to
globalisn't applicable or supported for your use case, consider explicitly distributing where you access models. For example, you can set the location based on your end user's location by using Firebase Remote Config.
Code samples
Note that these samples show accessing a Gemini model, but you can also specify a location when accessing an Imagen model.
Replace LOCATION with the location code (for example, global or
europe-west4) from the list of available locations
later on this page.
Swift
// ...
// Initialize the Vertex AI Gemini API backend service
// Specify a supported location for where you want to access the model
let ai = FirebaseAI.firebaseAI(backend: .vertexAI(location: "LOCATION"))
// Create a `GenerativeModel` instance with a model that supports your use case
let model = ai.generativeModel(modelName: "MODEL_NAME")
// ...
Kotlin
// ...
// Initialize the Vertex AI Gemini API backend service
// Specify a supported location for where you want to access the model
val model = Firebase.ai(backend = GenerativeBackend.vertexAI(location = "LOCATION"))
.generativeModel("MODEL_NAME")
// ...
Java
// ...
// Initialize the Vertex AI Gemini API backend service
// Specify a supported location for where you want to access the model
GenerativeModel ai = FirebaseAI.getInstance(GenerativeBackend.vertexAI("LOCATION"))
.generativeModel("MODEL_NAME");
GenerativeModelFutures model = GenerativeModelFutures.from(ai);
// ...
Web
// ...
// Initialize FirebaseApp
const firebaseApp = initializeApp(firebaseConfig);
// Initialize the Vertex AI Gemini API backend service
// Specify a supported location for where you want to access the model
const ai = getAI(firebaseApp, { backend: new VertexAIBackend('LOCATION') });
// Create a `GenerativeModel` instance with a model that supports your use case
const model = getGenerativeModel(ai, { model: 'MODEL_NAME' });
// ...
Dart
// ...
// Initialize the Vertex AI Gemini API backend service
// Specify a supported location for where you want to access the model
final ai = await FirebaseAI.vertexAI(location: 'LOCATION');
// Create a `GenerativeModel` instance with a model that supports your use case
final model = ai.generativeModel(model: 'MODEL_NAME');
// ...
Unity
// ...
// Initialize the Vertex AI Gemini API backend service
// Specify a supported location for where you want to access the model
var ai = FirebaseAI.GetInstance(FirebaseAI.Backend.VertexAI(location: "LOCATION"));
// Create a `GenerativeModel` instance with a model that supports your use case
var model = ai.GetGenerativeModel(modelName: "MODEL_NAME");
// ...
Note that if you specify a location where the model isn't available, you'll get
a 404 error that says the model
was not found or your project does not have access to it.
Available locations
Google Cloud uses regions. Google Cloud only stores customer data in the region that you specify for all generally-available features of Generative AI on Vertex AI.
Generative AI on Vertex AI is available in the following regions. Some models and/or specific versions may not be available in all locations (for detailed location availability, see the Google Cloud documentation).
Note the following:
For all Gemini preview models (except Live API models), the only supported location is
global.When using Firebase AI Logic to access Gemini 3.x models, the only supported location is
global.For all Live API models and all Imagen models, the
globallocation is not supported.
Global
global
United States
- Columbus, Ohio (
us-east5) - Dallas, Texas (
us-south1) - Iowa (
us-central1) - Las Vegas, Nevada (
us-west4) - Moncks Corner, South Carolina (
us-east1) - Northern Virginia (
us-east4) - Oregon (
us-west1)
Canada
- Montréal (
northamerica-northeast1)
South America
- Sao Paulo, Brazil (
southamerica-east1)
Europe
- Belgium (
europe-west1) - Finland (
europe-north1) - Frankfurt, Germany (
europe-west3) - London, United Kingdom (
europe-west2) - Madrid, Spain (
europe-southwest1) - Milan, Italy (
europe-west8) - Netherlands (
europe-west4) - Paris, France (
europe-west9) - Warsaw, Poland (
europe-central2) - Zürich, Switzerland (
europe-west6)
Asia Pacific
- Changhua County, Taiwan (
asia-east1) - Hong Kong, China (
asia-east2) - Mumbai, India (
asia-south1) - Seoul, Korea (
asia-northeast3) - Singapore (
asia-southeast1) - Sydney, Australia (
australia-southeast1) - Tokyo, Japan (
asia-northeast1)
Middle East
- Dammam, Saudi Arabia (
me-central2) - Doha, Qatar (
me-central1) - Tel Aviv, Israel (
me-west1)