ระบุตำแหน่งสำหรับการเข้าถึงโมเดล

คลิกผู้ให้บริการ Gemini API เพื่อดูเนื้อหาเฉพาะของผู้ให้บริการ และโค้ดในหน้านี้


โมเดล Generative AI ของ Google พร้อมให้บริการในบางภูมิภาค คุณสามารถเลือกตำแหน่งที่จะเข้าถึงโมเดลเพื่อให้เป็นไปตามข้อกำหนดด้านการปฏิบัติตามข้อกำหนด เวลาในการตอบสนอง ความพร้อมใช้งาน และความทนทาน

เมื่อใช้ 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) นอกจากนี้ การใช้ตำแหน่ง global อาจ จำเป็น เนื่องจากเป็นตำแหน่งเดียวที่โมเดลพร้อมให้บริการ (เช่น โมเดล เวอร์ชันตัวอย่าง Gemini ) ทั้งนี้ขึ้นอยู่กับโมเดล

กรณีใดบ้างที่ต้องตั้งค่าตำแหน่งอย่างชัดเจน

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 โมเดลเวอร์ชันตัวอย่างและ เวอร์ชันทดลอง: พร้อมให้บริการ ในตำแหน่ง global เท่านั้น

  • Gemini 4.x และโมเดลเสถียร Gemini 3.x: พร้อมให้บริการ ในตำแหน่ง global และมักจะพร้อมให้บริการในตำแหน่ง us และ eu

  • Gemini 2.5 โมเดล: พร้อมให้บริการในหลายตำแหน่ง. โปรดทราบว่า Gemini Live API 2.5 โมเดล ไม่พร้อมให้บริการใน global

ดูรายการตำแหน่งทั้งหมดที่พร้อมให้บริการในส่วนท้ายของ หน้านี้

ข้อเท็จจริงและแนวทางปฏิบัติแนะนำทั่วไป

ข้อเท็จจริงและแนวทางปฏิบัติแนะนำที่สำคัญบางประการเกี่ยวกับตำแหน่งมีดังนี้

  • ขีดจำกัดความจุเป็นไปตามโมเดล ต่อภูมิภาค ต่อนาที

  • หากต้องการหลีกเลี่ยงการเข้าถึงขีดจำกัดความจุโดยไม่คาดคิด ให้ลองใช้ตำแหน่ง global (หากโมเดลพร้อมให้บริการในตำแหน่ง global)

  • ลองใช้ Firebase Remote Config เพื่อควบคุมตำแหน่งที่คุณเข้าถึงโมเดล วิธีนี้จะช่วยให้คุณเปลี่ยนตำแหน่งได้โดยไม่ต้องเผยแพร่แอปเวอร์ชันใหม่

  • หากการใช้ตำแหน่ง global ไม่เหมาะกับกรณีการใช้งานของคุณ ให้ลอง กระจายตำแหน่งที่คุณเข้าถึงโมเดลอย่างชัดเจน (หากโมเดลพร้อมให้บริการ ในตำแหน่งอื่นที่ไม่ใช่ global) เช่น คุณสามารถตั้งค่าตำแหน่งตามตำแหน่งของผู้ใช้ปลายทางได้โดยใช้ Firebase Remote Config

ตัวอย่างโค้ด

Firebase AI Logic มีค่าเริ่มต้นอัตโนมัติสำหรับตำแหน่ง (เช่น global เมื่อใช้ไวยากรณ์การเริ่มต้น "Agent Platform") อย่างไรก็ตาม หาก คุณต้องการใช้ตำแหน่งอื่น คุณต้อง ระบุตำแหน่งอย่างชัดเจนในระหว่างการเริ่มต้นบริการแบ็กเอนด์ Agent Platform Gemini API (formerly Vertex AI)ในโค้ด

แทนที่ LOCATION ด้วยรหัสตำแหน่ง (เช่น global หรือ us-central1) จากรายการตำแหน่งที่พร้อมให้บริการ ในส่วนท้ายของหน้านี้

ไวยากรณ์ของ Agent Platform

Swift

ไวยากรณ์ agentPlatform พร้อมให้บริการตั้งแต่ SDK เวอร์ชัน 12.17.0 เป็นต้นไป

// ...

// 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

ไวยากรณ์ agentPlatform พร้อมให้บริการตั้งแต่ SDK เวอร์ชัน 17.15.0 เป็นต้นไป และ Firebase Android BoM เวอร์ชัน 34.17.0 เป็นต้นไป

// ...

// 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

ไวยากรณ์ agentPlatform พร้อมให้บริการตั้งแต่ SDK เวอร์ชัน 17.15.0 เป็นต้นไป และ Firebase Android BoM เวอร์ชัน 34.17.0 เป็นต้นไป

// ...

// 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

ไวยากรณ์ AgentPlatformBackend พร้อมให้บริการตั้งแต่ Firebase JS SDK เวอร์ชัน 12.17.0 เป็นต้นไป

// ...

// 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

ไวยากรณ์ vertexAI ถูกนำออกใน SDK เวอร์ชัน 13.0.0

// ...

// Initialize the Agent Platform Gemini API backend service (formerly branded Vertex AI).
// For the legacy `vertexAI` syntax, the default location is `us-central1`, so
// specifying a location is usually required since most models are *not* supported in `us-central1`.
let ai = FirebaseAI.firebaseAI(backend: .vertexAI(location: "LOCATION"))

// ...

Kotlin

ไวยากรณ์ vertexAI ถูกนำออกใน SDK เวอร์ชัน 18.0.0 และ BoM เวอร์ชัน 35.0.0

// ...

// Initialize the Agent Platform Gemini API backend service (formerly branded Vertex AI).
// For the legacy `vertexAI` syntax, the default location is `us-central1`, so
// specifying a location is usually required since most models are *not* supported in `us-central1`.
val ai = Firebase.ai(backend = GenerativeBackend.vertexAI(location = "LOCATION"))

// ...

Java

ไวยากรณ์ vertexAI ถูกนำออกใน SDK เวอร์ชัน 18.0.0 และ BoM เวอร์ชัน 35.0.0

// ...

// Initialize the Agent Platform Gemini API backend service (formerly branded Vertex AI).
// For the legacy `vertexAI` syntax, the default location is `us-central1`, so
// specifying a location is usually required since most models are *not* supported in `us-central1`.
GenerativeModel ai = FirebaseAI.getInstance(GenerativeBackend.vertexAI("LOCATION"));

// ...

Web

ไวยากรณ์ VertexAIBackend ถูกนำออกใน SDK เวอร์ชัน 13.0.0

// ...

// Initialize FirebaseApp

// Initialize the Agent Platform Gemini API backend service (formerly branded Vertex AI).
// For the legacy `VertexAIBackend` syntax, the default location is `us-central1`, so
// specifying a location is usually required since most models are *not* supported in `us-central1`.
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-central1`, so
// specifying a location is usually required since most models are *not* supported in `us-central1`.
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-central1`, so
// specifying a location is usually required since most models are *not* supported in `us-central1`.
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 จะจัดเก็บข้อมูลลูกค้าไว้ในภูมิภาคที่คุณระบุไว้สำหรับฟีเจอร์ Generative AI ทั้งหมดที่พร้อมให้บริการโดยทั่วไปใน Agent Platform เท่านั้น

Generative AI ใน Agent Platform พร้อมให้บริการในภูมิภาคต่อไปนี้ โมเดลและ/หรือเวอร์ชันบางรายการอาจไม่พร้อมให้บริการในบางตำแหน่ง (ดูความพร้อมให้บริการในแต่ละตำแหน่งโดยละเอียดได้ใน Google Cloudเอกสารประกอบ)

โปรดทราบดังต่อไปนี้

  • Firebase AI Logic จะใช้ตำแหน่งต่อไปนี้เป็นค่าเริ่มต้น

    • เมื่อใช้ไวยากรณ์การเริ่มต้น "Agent Platform" ใหม่: global
    • เมื่อใช้ไวยากรณ์การเริ่มต้น "Vertex AI" แบบเดิม: us-central1
  • Gemini โมเดลเวอร์ชันตัวอย่างและ เวอร์ชันทดลอง: พร้อมให้บริการ ในตำแหน่ง global เท่านั้น

  • Gemini 4.x และโมเดลเสถียร 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
  • europe-west2 (ลอนดอน สหราชอาณาจักร)
  • asia-southeast1 (สิงคโปร์)

ดูรายละเอียดเกี่ยวกับตำแหน่งที่พร้อมให้บริการสำหรับ แต่ละโมเดลได้ใน 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เอกสารประกอบ

รายการตำแหน่งที่เคยพร้อมให้บริการแต่ตอนนี้ปิดตัวลงแล้ว

  • ยังไม่มีการปิดตัวลงในตำแหน่งใด