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

คลิกผู้ให้บริการ 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

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

รายชื่อสถานที่ตั้งที่เคยพร้อมให้บริการ แต่ตอนนี้ถูกปฏิเสธ

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