|
Gemini API プロバイダをクリックして、このページでプロバイダ固有のコンテンツとコードを表示します。 |
Google の生成 AI モデルは、特定のリージョンで利用できます。コンプライアンス、レイテンシ、可用性、耐久性の要件を満たすために、モデルにアクセスする場所を選択できます。
Firebase AI Logicを使用する場合、 Agent Platform Gemini API (formerly Vertex AI)を使用する各リクエストに、 モデルにアクセスするロケーションを含めることができます。Firebase AI Logic にはデフォルトのロケーション設定があります。
- 新しい「Agent Platform」初期化構文を使用する場合:
global - 従来の「Vertex AI」初期化構文を使用する場合:
us-central1
ほぼすべての Gemini モデルで、Agent Platform Gemini API (formerly Vertex AI) は
global ロケーションをサポートしています。つまり、リクエストはグローバル プール内の利用可能な
モデルによって処理されます。リクエストに global ロケーションを使用すると、モデルの容量上限に達することを回避し、「サービス過負荷」(503)エラーを減らすことができます。また、モデルによっては、global ロケーションの使用が必須になる場合があります。
ロケーションを明示的に設定する必要があるのはいつですか?
Firebase AI Logic には、ロケーションの自動デフォルトがあります(たとえば、
global「Agent Platform」初期化構文を使用する場合)。ただし、別のロケーションを使用する必要がある場合や、別のロケーションを使用する場合は、コード内でAgent Platform Gemini API (formerly Vertex AI)バックエンド サービスの初期化時にロケーションを明示的に指定する必要があります。
モデルによっては、ロケーションを明示的に設定することが必須になる場合があります。
リクエストが、モデルが利用できないロケーションのモデルにアクセスしようとすると、モデルが見つからないか、プロジェクトにアクセス権がないことを示す 404 エラーが返されます。 was not found or your project does not have access to it
Gemini Gemini のプレビュー版モデルと試験運用版モデル:
globalロケーションでのみ利用できます(Live API モデルを除く - 下記を参照)。Gemini 3.x モデル __: Firebase AI Logic を使用する場合、
globalロケーションでのみ利用できます。Firebase AI Logic は、usロケーションとeuロケーションをまだサポートしていません。Gemini 2.5 モデル: 多くのロケーションで利用できます。
Gemini Live API モデル:
us-central1ロケーションでのみ利用できます。globalロケーションはサポートされていません。
利用可能なすべてのロケーションのリストについては、この ページの後半をご覧ください。
一般的な事実とベスト プラクティス
ロケーションに関する重要な事実とベスト プラクティスをいくつかご紹介します。
容量上限は、モデルごと、リージョンごと、分ごとに設定されます。
容量上限に予期せず達することを避けるため、ロケーション
globalの使用を検討してください(モデルがglobalロケーションをサポートしている場合)。Firebase Remote Config を使用して、モデルにアクセスするロケーションを制御することを検討してください。これにより、アプリの新しいバージョンをリリースせずにロケーションを変更できます。
ユースケースで
globalロケーションの使用が適用できない場合やサポートされていない場合は、モデルにアクセスする場所を明示的に分散することを検討してください。たとえば、 Firebase Remote Config を使用して、エンドユーザーのロケーションに基づいてロケーションを設定できます。 Firebase Remote Config
コードサンプル
Firebase AI Logic には、ロケーションの自動デフォルトがあります(たとえば、
global「Agent Platform」初期化構文を使用する場合)。ただし、別のロケーションを使用する必要がある場合や、別のロケーションを使用する場合は、コード内でAgent Platform Gemini API (formerly Vertex AI)バックエンド サービスの初期化時にロケーションを明示的に指定する必要があります。
LOCATION は、このページの後半にある 利用可能なロケーションのリストから、ロケーション コード(global や
us-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"));
// ...
モデルが利用できないロケーションを指定すると、モデルが見つからないか、プロジェクトにアクセス権がないことを示す 404 エラーが返されます。 was not found or your project does not have access to it
利用できるロケーション
Google Cloud では リージョンを使用します。 Google Cloud の顧客データは、お客様が Agent Platform の生成 AI のすべての一般提供機能に指定したリージョンにのみ保存されます。
Agent Platform の生成 AI は、次のリージョンで利用できます。 一部のモデルや特定のバージョンは、すべてのロケーションで利用できない場合があります。 (ロケーションの可用性の詳細については、 Google Cloud ドキュメントをご覧ください)。
次の点にご注意ください。
Firebase AI Logic のデフォルトのロケーションは次のとおりです。
- 新しい「Agent Platform」初期化構文を使用する場合:
global - 従来の「Vertex AI」初期化構文を使用する場合:
us-central1
- 新しい「Agent Platform」初期化構文を使用する場合:
すべての Gemini プレビュー版 モデル(Live API モデルを除く)でサポートされているロケーションは
globalのみです。Firebase AI Logic を使用して Gemini 3.x モデルにアクセスする場合、サポートされているロケーションは のみ です。
globalFirebase AI Logic は、usロケーションとeuロケーションをまだサポートしていません。すべての Live API モデルで、
globalロケーションは サポートされていません。
Gemini 3.x 以降のモデル
Gemini 3.x 以降のモデルを Firebase AI Logic で使用する場合、 次のロケーションがサポートされます。
global
us ロケーションと eu ロケーションのサポートは近日中に開始予定です。
旧世代モデル
古い Gemini モデルを 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)
以前は利用可能だったが、現在は停止されているロケーションのリスト:
- まだ停止されたロケーションはありません