Specify the location for accessing the model

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. You can choose where to access the model to meet your compliance, latency, availability, and durability requirements.

When using Firebase AI Logic, each of your requests that use the Agent Platform Gemini API (formerly Vertex AI) can optionally include the location to access the model. Firebase AI Logic has default location settings.

  • When using the new "Agent Platform" initialization syntax: global
  • When using the legacy "Vertex AI" initialization syntax: us-central1

About the global location

For almost all Gemini models, the Agent Platform Gemini API (formerly Vertex AI) offers a global location, which means your request will be handled by an available model anywhere in the global pool.

Using the global location for your requests can help you avoid hitting capacity limits for the model and reduce "service overloaded" (503) errors. Also, depending on the model, using the global location may be required because it's the only available location for the model (for example, a preview Gemini model).

When is explicitly setting a location needed?

Firebase AI Logic has automatic defaults for location (for example, global when using the "Agent Platform" initialization syntax). However, if you need or want to use a different location, then you need to explicitly specify the location during initialization of the Agent Platform Gemini API (formerly Vertex AI) backend service in your code.

Depending on the model, explicitly setting a location may be required. If your request tries to access a model in a location where it's not available, then you'll get a 404 error that says the model was not found or your project does not have access to it.

  • Gemini preview and experimental models: Only available in the global location.

  • Gemini 3.x stable models: Available in the global location and often in the us and eu locations.

  • Gemini 2.5 models: Available in many locations. Note that Gemini Live API 2.5 models are not available in global.

See the list of all available locations later on this page.

General facts and best practices

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 using the global location (if the model is available in the global location).

  • Consider using Firebase Remote Config to control the location where you access the model. That way, you can change the location without releasing a new version of your app.

  • If using the global location isn't applicable for your use case, consider explicitly distributing where you access a model (if the model is available in locations other than global). For example, you can set the location based on the end user's location by using Firebase Remote Config.

Code samples

Firebase AI Logic has automatic defaults for location (for example, global when using the "Agent Platform" initialization syntax). However, if you need or want to use a different location, then you need to explicitly specify the location during initialization of the Agent Platform Gemini API (formerly Vertex AI) backend service in your code.

Replace LOCATION with the location code (for example, global or us-central1) from the list of available locations later on this page.

Agent Platform syntax

Swift

// ...

// Initialize the Agent Platform Gemini API backend service (formerly branded Vertex AI).
// For the `agentPlatform` syntax, the default location is `global`, so
// specifying a location is usually optional since most models are supported in `global`.
let ai = FirebaseAI.firebaseAI(backend: .agentPlatform(location: "LOCATION"))

// ...

Kotlin

// ...

// Initialize the Agent Platform Gemini API backend service (formerly branded Vertex AI).
// For the `agentPlatform` syntax, the default location is `global`, so
// specifying a location is usually optional since most models are supported in `global`.
val ai = Firebase.ai(backend = GenerativeBackend.agentPlatform(location = "LOCATION"))

// ...

Java

// ...

// Initialize the Agent Platform Gemini API backend service (formerly branded Vertex AI).
// For the `agentPlatform` syntax, the default location is `global`, so
// specifying a location is usually optional since most models are supported in `global`.
GenerativeModel ai = FirebaseAI.getInstance(GenerativeBackend.agentPlatform("LOCATION"));

// ...

Web

// ...

// Initialize FirebaseApp

// Initialize the Agent Platform Gemini API backend service (formerly branded Vertex AI).
// For the `AgentPlatformBackend` syntax, the default location is `global`, so
// specifying a location is usually optional since most models are supported in `global`.
const ai = getAI(firebaseApp, { backend: new AgentPlatformBackend('LOCATION') });

// ...

Dart

// ...

// Initialize the Agent Platform Gemini API backend service (formerly branded Vertex AI).
// For the `agentPlatform` syntax, the default location is `global`, so
// specifying a location is usually optional since most models are supported in `global`.
final ai = await FirebaseAI.agentPlatform(location: 'LOCATION');

// ...

Unity

// ...

// Initialize the Agent Platform Gemini API backend service (formerly Vertex AI).
// For the `AgentPlatform` syntax, the default location is `global`, so
// specifying a location is usually optional since most models are supported in `global`.
var ai = FirebaseAI.GetInstance(FirebaseAI.Backend.AgentPlatform(location: "LOCATION"));

// ...

Vertex AI syntax

Swift

// ...

// Initialize the Agent Platform Gemini API backend service (formerly branded Vertex AI).
// For the legacy `vertexai` syntax, the default location is `us-central`, so
// specifying a location is usually required since most models are *not* supported in `us-central`.
let ai = FirebaseAI.firebaseAI(backend: .vertexai(location: "LOCATION"))

// ...

Kotlin

// ...

// Initialize the Agent Platform Gemini API backend service (formerly branded Vertex AI).
// For the legacy `vertexAI` syntax, the default location is `us-central`, so
// specifying a location is usually required since most models are *not* supported in `us-central`.
val ai = Firebase.ai(backend = GenerativeBackend.vertexAI(location = "LOCATION"))

// ...

Java

// ...

// Initialize the Agent Platform Gemini API backend service (formerly branded Vertex AI).
// For the legacy `vertexAI` syntax, the default location is `us-central`, so
// specifying a location is usually required since most models are *not* supported in `us-central`.
GenerativeModel ai = FirebaseAI.getInstance(GenerativeBackend.vertexAI("LOCATION"));

// ...

Web

// ...

// Initialize FirebaseApp

// Initialize the Agent Platform Gemini API backend service (formerly branded Vertex AI).
// For the legacy `VertexAIBackend` syntax, the default location is `us-central`, so
// specifying a location is usually required since most models are *not* supported in `us-central`.
const ai = getAI(firebaseApp, { backend: new VertexAIBackend('LOCATION') });

// ...

Dart

// ...

// Initialize the Agent Platform Gemini API backend service (formerly branded Vertex AI).
// For the legacy `vertexAI` syntax, the default location is `us-central`, so
// specifying a location is usually required since most models are *not* supported in `us-central`.
final ai = await FirebaseAI.vertexAI(location: 'LOCATION');

// ...

Unity

// ...

// Initialize the Agent Platform Gemini API backend service (formerly branded Vertex AI).
// For the legacy `VertexAI` syntax, the default location is `us-central`, so
// specifying a location is usually required since most models are *not* supported in `us-central`.
var ai = FirebaseAI.GetInstance(FirebaseAI.Backend.VertexAI(location: "LOCATION"));

// ...

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 Agent Platform.

Generative AI on Agent Platform 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:

  • Firebase AI Logic defaults to the following locations:

    • When using the new "Agent Platform" initialization syntax: global
    • When using the legacy "Vertex AI" initialization syntax: us-central1
  • Gemini preview and experimental models: Only available in the global location.

  • Gemini 3.x stable models: Available in the global location and often in the us and eu locations.

  • Gemini 2.5 models: Available in many locations. Note that Gemini Live API 2.5 models are not available in global.

Gemini 3.x and later models

When using Gemini 3.x and later models, Firebase AI Logic supports the following locations:

  • global
  • us
  • eu

For details about the available locations for each model, see the Google Cloud documentation.

Older generation models

When using older Gemini models (like 2.5 models), Firebase AI Logic supports the following locations:

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)

Note that Gemini Live API 2.5 models are not available in global.

For details about the available locations for each model, see the Google Cloud documentation.

List of previously available, but now turned-down locations:

  • No locations have been turned down yet