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

For almost all Gemini models, the Agent Platform Gemini API (formerly Vertex AI) supports 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.

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 (except for Live API models - see below).

  • Gemini 3.x models: Only available in the global location when using Firebase AI Logic. Firebase AI Logic does not yet support the us and eu locations.

  • Gemini 2.5 models: Available in many locations.

  • Gemini Live API models: Only available in the us-central1 location. The global location is not supported.

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 location global (if your model supports 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 location of global isn't applicable or supported for your use case, consider explicitly distributing where you access models. 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 europe-west4) 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 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`.
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 us-central1 location.

  • 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. Firebase AI Logic does not yet support the us and eu locations.

  • For all Live API models and all Imagen models, the global location 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)