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

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


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

เมื่อใช้ Firebase AI Logic คำขอแต่ละรายการที่ใช้ Agent Platform Gemini API (formerly Vertex AI) จะระบุตำแหน่งเพื่อเข้าถึงโมเดล ได้โดยไม่บังคับ Firebase AI Logic มีการตั้งค่าตำแหน่งเริ่มต้น

  • เมื่อใช้ไวยากรณ์การเริ่มต้น "แพลตฟอร์มตัวแทน" ใหม่ ให้ทำดังนี้ 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 Gemini API (formerly Vertex AI)ในโค้ด

การตั้งค่าตำแหน่งอย่างชัดเจนอาจจำเป็น ทั้งนี้ขึ้นอยู่กับรุ่น หากคำขอพยายามเข้าถึงโมเดลในสถานที่ที่ไม่มีให้บริการ คุณจะได้รับข้อผิดพลาด 404 ที่ระบุว่าโมเดล was not found or your project does not have access to it

  • Gemini โมเดลตัวอย่างและเวอร์ชันทดลอง: พร้อมให้บริการเฉพาะ ในglobal

  • 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 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 จะจัดเก็บข้อมูลลูกค้าในภูมิภาคที่คุณระบุสำหรับฟีเจอร์ Generative AI ที่พร้อมให้บริการโดยทั่วไปทั้งหมดใน Agent Platform เท่านั้น

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

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

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

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

รายชื่อสถานที่ที่เคยพร้อมให้บริการแต่ตอนนี้ไม่พร้อมให้บริการแล้ว

  • ยังไม่มีการปฏิเสธสถานที่ตั้ง