|
Gemini API プロバイダをクリックして、このページでプロバイダ固有のコンテンツとコードを表示します。 |
Google の生成 AI モデルは、特定のリージョンで利用できます。
コードで Vertex AI Gemini API バックエンド サービスを初期化するときに、リクエストでアクセスするモデルのロケーションを必要に応じて指定できます。ロケーションを指定しない場合、デフォルトは us-central1 です。このページの後半の利用可能なロケーションのリストをご覧ください。
global の場所について
Gemini 2.0 モデルと Gemini 2.5 モデルにアクセスする場合、Vertex AI Gemini API は global ロケーションをサポートします。つまり、リクエストはグローバル プール内の任意の場所にある使用可能なモデルによって処理されます。リクエストのロケーションを global に設定すると、全体的な可用性が向上し、リソース不足(429)エラーを減らすことができます。
また、2025 年 6 月以降にリリースされた Gemini 2.5 プレビュー モデルと試験運用版モデルは、通常、global ロケーションでのみアクセスできます。
コードサンプル
これらのサンプルでは Gemini モデルへのアクセスを示していますが、Imagen モデルにアクセスするときにロケーションを指定することもできます。
LOCATION は、このページの後半にある利用可能なロケーションのリストからロケーション コード(europe-west4 など)に置き換えます。
Swift
// ...
// Initialize the Vertex AI Gemini API backend service
// Specify the 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 the 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 the 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 the 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 the 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 the 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");
// ...
利用できるロケーション
Google Cloud はリージョンを使用します。Google Cloud は、お客様が Vertex AI の生成 AI のすべての一般提供機能に指定したリージョンにのみお客様のデータを保存します。
Vertex AI の生成 AI は、次のリージョンで利用できます。一部のモデルや特定のバージョンは、地域によってはご利用いただけない場合があります(地域ごとの利用可否の詳細については、Google Cloud ドキュメントをご覧ください)。
Gemini 2.0 モデルと Gemini 2.5 モデル(Gemini 2.0 Flash Live を除く)は、global ロケーションでも使用できます。Imagen モデルの場合、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)