|
Klik penyedia Gemini API untuk melihat konten khusus penyedia dan kode di halaman ini. |
Model AI generatif Google tersedia di region tertentu. Anda dapat memilih tempat untuk mengakses model yang memenuhi persyaratan kepatuhan, latensi, ketersediaan, dan ketahanan Anda.
Saat menggunakan Firebase AI Logic, setiap permintaan Anda yang menggunakan Agent Platform Gemini API (formerly Vertex AI) dapat secara opsional menyertakan lokasi untuk mengakses model. Firebase AI Logic memiliki setelan lokasi default.
- Saat menggunakan sintaks inisialisasi "Agent Platform" baru:
global - Saat menggunakan sintaks inisialisasi "Vertex AI" lama:
us-central1
Untuk hampir semua Gemini model, Agent Platform Gemini API (formerly Vertex AI) mendukung
lokasi global, yang berarti permintaan Anda akan ditangani oleh model yang tersedia
di mana saja dalam kumpulan global. Menggunakan lokasi global untuk permintaan Anda dapat membantu Anda menghindari batas kapasitas untuk model dan mengurangi error "layanan kelebihan beban" (503). Selain itu, bergantung pada modelnya, penggunaan lokasi global mungkin diperlukan.
Kapan lokasi perlu ditetapkan secara eksplisit?
Firebase AI Logic memiliki default otomatis untuk lokasi (misalnya,
global saat menggunakan sintaks inisialisasi "Agent Platform"). Namun, jika
Anda perlu atau ingin menggunakan lokasi lain, Anda harus menentukan lokasi secara eksplisit
selama inisialisasi layanan backend
Agent Platform Gemini API (formerly Vertex AI) dalam kode Anda.
Bergantung pada modelnya, penetapan lokasi secara eksplisit mungkin diperlukan.
Jika permintaan Anda mencoba mengakses model di lokasi yang tidak tersedia, Anda akan mendapatkan error 404 yang menyatakan bahwa model was not found or your project does not have access to it.
Gemini Model pratinjau dan eksperimental: Hanya tersedia di lokasi
global(kecuali model Live API - lihat di bawah).Gemini 3.x model: Hanya tersedia di lokasi
globalsaat menggunakan Firebase AI Logic. Firebase AI Logic belum mendukungusdaneulokasi.Gemini 2.5 model: Tersedia di banyak lokasi.
Gemini Live API model: Hanya tersedia di lokasi
us-central1. Lokasiglobaltidak didukung.
Lihat daftar semua lokasi yang tersedia di halaman ini.
Fakta umum dan praktik terbaik
Berikut beberapa fakta utama dan praktik terbaik tentang lokasi:
Batas kapasitas adalah per model, per region, per menit.
Untuk menghindari batas kapasitas yang tidak terduga, sebaiknya gunakan lokasi
global(jika model Anda mendukung lokasiglobal).Sebaiknya gunakan Firebase Remote Config untuk mengontrol lokasi tempat Anda mengakses model. Dengan begitu, Anda dapat mengubah lokasi tanpa merilis aplikasi versi baru.
Jika penggunaan lokasi
globaltidak berlaku atau tidak didukung untuk kasus penggunaan Anda, sebaiknya distribusikan secara eksplisit tempat Anda mengakses model. Misalnya, Anda dapat menetapkan lokasi berdasarkan lokasi pengguna akhir menggunakan Firebase Remote Config.
Contoh kode
Firebase AI Logic memiliki default otomatis untuk lokasi (misalnya,
global saat menggunakan sintaks inisialisasi "Agent Platform"). Namun, jika
Anda perlu atau ingin menggunakan lokasi lain, Anda harus menentukan lokasi secara eksplisit
selama inisialisasi layanan backend
Agent Platform Gemini API (formerly Vertex AI) dalam kode Anda.
Ganti LOCATION dengan kode lokasi (misalnya, global atau
europe-west4) dari daftar lokasi yang tersedia
di halaman ini.
Sintaks 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 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"));
// ...
Sintaks 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"));
// ...
Perhatikan bahwa jika Anda menentukan lokasi tempat model tidak tersedia, Anda akan mendapatkan error 404 yang menyatakan bahwa model was not found or your project does not have access to it.
Lokasi yang tersedia
Google Cloud menggunakan region. Google Cloud hanya menyimpan data pelanggan di region yang Anda tentukan untuk semua fitur AI Generatif yang tersedia secara umum di Agent Platform.
AI Generatif di Agent Platform tersedia di region berikut. Beberapa model dan/atau versi tertentu mungkin tidak tersedia di semua lokasi (untuk mengetahui ketersediaan lokasi mendetail, lihat Google Cloud dokumentasi).
Perhatikan hal berikut:
Firebase AI Logic menggunakan lokasi
us-central1secara default.Untuk semua Gemini model pratinjau (kecuali model Live API), lokasi satu-satunya yang didukung adalah
global.Saat menggunakan Firebase AI Logic untuk mengakses model Gemini 3.x, lokasi satu-satunya yang didukung adalah
global. Firebase AI Logic belum mendukung lokasiusdaneu.Untuk semua Live API model dan semua Imagen model,
globallokasi tidak didukung.
Global
global
Amerika Serikat
- 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)
Kanada
- Montréal (
northamerica-northeast1)
Amerika Selatan
- Sao Paulo, Brasil (
southamerica-east1)
Eropa
- Belgia (
europe-west1) - Finlandia (
europe-north1) - Frankfurt, Jerman (
europe-west3) - London, Inggris Raya (
europe-west2) - Madrid, Spanyol (
europe-southwest1) - Milan, Italia (
europe-west8) - Belanda (
europe-west4) - Paris, Prancis (
europe-west9) - Warsawa, Polandia (
europe-central2) - Zürich, Swiss (
europe-west6)
Asia Pasifik
- Changhua County, Taiwan (
asia-east1) - Hong Kong, China (
asia-east2) - Mumbai, India (
asia-south1) - Seoul, Korea (
asia-northeast3) - Singapura (
asia-southeast1) - Sydney, Australia (
australia-southeast1) - Tokyo, Jepang (
asia-northeast1)
Timur Tengah
- Dammam, Arab Saudi (
me-central2) - Doha, Qatar (
me-central1) - Tel Aviv, Israel (
me-west1)