モデルにアクセスする場所を指定する

Gemini API プロバイダをクリックして、このページでプロバイダ固有のコンテンツとコードを表示します。


Google の生成 AI モデルは、特定のリージョンで利用できます。コンプライアンス、レイテンシ、可用性、耐久性の要件を満たすように、モデルにアクセスする場所を選択できます。

Firebase AI Logic を使用する場合、Agent Platform Gemini API (formerly Vertex AI) を使用する各リクエストには、モデルにアクセスするロケーションを任意で含めることができます。Firebase AI Logic にはデフォルトの位置情報の設定があります。

  • 新しい「Agent Platform」の初期化構文 global を使用する場合:
  • 以前の「Vertex AI」初期化構文を使用する場合: us-central1

global の位置情報について

ほぼすべての Gemini モデルで、Agent Platform Gemini API (formerly Vertex AI)global ロケーションを提供します。これは、リクエストがグローバル プール内の任意の場所で使用可能なモデルによって処理されることを意味します。

リクエストに global ロケーションを使用すると、モデルの容量上限に達することを回避し、「サービス過負荷」(503)エラーを減らすことができます。また、モデルによっては、 の場所がモデルで使用できる唯一の場所であるため(プレビュー版の Gemini モデルなど)、global の場所の使用が必須になる場合があります。

位置情報を明示的に設定する必要があるのはいつですか?

Firebase AI Logic には、ロケーションの自動デフォルトがあります(たとえば、「Agent Platform」の初期化構文を使用する場合は global)。ただし、別のロケーションを使用する必要がある場合や、別のロケーションを使用したい場合は、コードで Agent Platform Gemini API (formerly Vertex AI) バックエンド サービスの初期化時にロケーションを明示的に指定する必要があります。

モデルによっては、位置情報を明示的に設定することが必須となる場合があります。リクエストで、モデルが使用できないロケーションのモデルにアクセスしようとすると、モデル was not found or your project does not have access to it という 404 エラーが返されます。

  • Gemini プレビュー版モデルと試験運用版モデル: global ロケーションでのみ使用できます。

  • Gemini 3.x 安定版モデル: global ロケーションで利用できます。また、us ロケーションと eu ロケーションでも利用できる場合があります。

  • Gemini 2.5 モデル: 多くの地域で利用可能Gemini Live API 2.5 モデルは global では使用できません。

このページの後半にある利用可能なすべてのロケーションのリストをご覧ください。

一般的な事実とベスト プラクティス

以下に、ロケーションに関する重要なポイントとベスト プラクティスを紹介します。

  • 容量上限は、モデルごと、リージョンごと、1 分あたりの上限です。

  • 容量上限に予期せず達することを避けるには、global ロケーションの使用を検討してください(モデルが global ロケーションで使用可能な場合)。

  • Firebase Remote Config を使用して、モデルにアクセスするロケーションを制御することを検討してください。これにより、アプリの新しいバージョンをリリースせずに場所を変更できます。

  • ユースケースに global ロケーションの使用が適していない場合は、モデルにアクセスする場所を明示的に分散することを検討してください(モデルが global 以外のロケーションで使用可能な場合)。たとえば、Firebase Remote Config を使用して、エンドユーザーのロケーションに基づいてロケーションを設定できます。

コードサンプル

Firebase AI Logic には、ロケーションの自動デフォルトがあります(たとえば、「Agent Platform」の初期化構文を使用する場合は global)。ただし、別のロケーションを使用する必要がある場合や、別のロケーションを使用したい場合は、コードで Agent Platform Gemini API (formerly Vertex AI) バックエンド サービスの初期化時にロケーションを明示的に指定する必要があります。

LOCATION は、このページの後半にある利用可能なロケーションのリストから、ロケーション コード(globalus-central1 など)に置き換えます。

Agent Platform の構文

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 の構文

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"));

// ...

モデルが使用できないロケーションを指定すると、モデル was not found or your project does not have access to it という 404 エラーが発生します。

利用できるロケーション

Google Cloudリージョンを使用します。Google Cloud は、お客様が Agent Platform の生成 AI のすべての一般提供機能に指定したリージョンにのみ顧客データを保存します。

Agent Platform の生成 AI は、次のリージョンで利用できます。一部のモデルや特定のバージョンは、地域によってはご利用いただけない場合があります(利用可能な地域について詳しくは、Google Cloud のドキュメントをご覧ください)。

次の点にご注意ください。

  • Firebase AI Logic のデフォルトの場所は次のとおりです。

    • 新しい「Agent Platform」の初期化構文 global を使用する場合:
    • 以前の「Vertex AI」初期化構文を使用する場合: us-central1
  • Gemini プレビュー版モデルと試験運用版モデル: global ロケーションでのみ使用できます。

  • Gemini 3.x 安定版モデル: global ロケーションで利用できます。また、us ロケーションと eu ロケーションでも利用できる場合があります。

  • Gemini 2.5 モデル: 多くの地域で利用可能Gemini Live API 2.5 モデルは global では使用できません。

Gemini 3.x 以降のモデル

Gemini 3.x 以降のモデルを使用する場合、Firebase AI Logic は次のロケーションをサポートします。

  • global
  • us
  • eu

各モデルで使用可能なロケーションの詳細については、Google Cloud ドキュメントをご覧ください。

以前の世代のモデル

古い Gemini モデル(2.5 モデルなど)を使用する場合、Firebase AI Logic は次のロケーションをサポートします。

グローバル

  • global

米国

  • オハイオ州コロンバス(us-east5
  • テキサス州ダラス(us-south1
  • アイオワ(us-central1
  • ラスベガス、ネバダ州(us-west4
  • モンクスコーナー、サウスカロライナ州(us-east1
  • 北バージニア(us-east4
  • オレゴン(us-west1

カナダ

  • モントリオール(northamerica-northeast1

南アメリカ

  • サンパウロ、ブラジル(southamerica-east1

ヨーロッパ

  • ベルギー(europe-west1
  • フィンランド(europe-north1
  • フランクフルト、ドイツ(europe-west3
  • ロンドン、イギリス(europe-west2
  • マドリード、スペイン(europe-southwest1
  • ミラン、イタリア(europe-west8
  • オランダ(europe-west4
  • パリ、フランス(europe-west9
  • ワルシャワ、ポーランド(europe-central2
  • チューリッヒ、スイス(europe-west6

アジア太平洋

  • 彰化県、台湾(asia-east1
  • 香港、中国(asia-east2
  • ムンバイ、インド(asia-south1
  • ソウル、韓国(asia-northeast3
  • シンガポール(asia-southeast1
  • シドニー、オーストラリア(australia-southeast1
  • 東京、日本(asia-northeast1

中東

  • ダンマーム、サウジアラビア(me-central2
  • ドーハ、カタール(me-central1
  • テルアビブ、イスラエル(me-west1

Gemini Live API 2.5 モデルは global では使用できません。

各モデルで使用可能なロケーションの詳細については、Google Cloud ドキュメントをご覧ください。

以前は利用可能だったが、現在は利用できなくなった地域の一覧:

  • まだ拒否された地域はありません