Skip to content

โหมดการเชื่อมต่อ ​

Advanced / operator docs

ซ่อนจาก sidebar Models & routing เริ่มต้น — ลิงก์จาก Deploy → Self-host ขั้นสูง Integrator Tier A ใช้ Gommo public API (Mode A) เท่านั้น

สามวิธีเข้าถึง Gommo โหมด A Direct (แนะนำ) เรียก v2.api.gommo.net และ api.gommo.net โดยตรง โหมด B/C ผ่าน self-host Gommo Developer — ทางเลือกสำหรับ dev, portal billing หรือ BYOK

เปรียบเทียบเร็ว ​

โหมด A Directโหมด B RESTโหมด C Proxy
Base URLv2.api.gommo.net / api.gommo.net{gateway}/gateway{gateway}
AuthBearer / form upstreamAuthorization: Bearerส่งต่อ headers + body
Domain ฝั่ง clientต้องมีใน formทางเลือก (เซิร์ฟเวอร์ GOMMO_API_DOMAIN)ต้องมีใน form
ซ่อน URL upstreamไม่ใช่ใช่
Poll / wrapทำเองwait: true ในตัวGommo envelope ดิบ
รูปแบบ responseGommo native{ success, data, message, code }Gommo native
เหมาะสำหรับProduction — แนะนำSelf-host JSON RESTFE Gommo legacy drop-in

{gateway} = http://localhost:3001 (dev) หรือ URL API production


โหมด A — Direct Gommo ​

เรียกโฮสต์ upstream โดยตรงจาก backend ที่เชื่อถือได้ ไม่มี gateway ในเส้นทาง

งานมีเดีย V2:

http
POST https://v2.api.gommo.net/ai/jobs/image/{modelSlug}
Authorization: Bearer {token}
Content-Type: application/x-www-form-urlencoded

domain={GOMMO_API_DOMAIN}&project_id=default&prompt=...&ratio=...

Auth, แชท, เสียง:

http
POST https://api.gommo.net/api/apps/go-mmo/auth/login
POST https://api.gommo.net/api/apps/go-mmo/ai/me
POST https://api.gommo.net/api/v2/chat
POST https://api.gommo.net/ai/audio

ใช้เมื่อไม่พึ่ง gateway — เช่น แอปมือถือที่มี backend เอง หรือบริการภายในที่เชื่อม Gommo แล้ว

คุณต้อง poll เอง

Gommo ไม่ webhook เมื่องานเสร็จ ทำ poll (ช่วง 3.5s ~80 ครั้ง) หรือใช้โหมด B wait: true


โหมด B — Gateway REST ​

Coming to Gommo platform

โหมด B (/gateway/*, wait: true, JSON REST) เป็น preview บน repo นี้ integrator production ควรใช้ โหมด A (host public Gommo) โหมด B จะรวมเข้า API แพลตฟอร์ม Gommo อย่างเป็นทางการ

→ Roadmap แพลตฟอร์ม Gommo

JSON API บน /gateway/* gateway แปล REST body เป็น form call upstream และ poll ทางเลือก

เติม domain อัตโนมัติ: ถ้า client ไม่ส่ง domain gateway inject GOMMO_API_DOMAIN จาก env เซิร์ฟเวอร์

Gateway endpointเทียบเท่า upstream
GET /gateway/models?type=POST /ai/models (v2)
POST /gateway/jobs/:typePOST /ai/jobs/:type/:slug
GET /gateway/jobs/:id?media=poll งาน
POST /gateway/upload/imagePOST /ai/upload/image
POST /gateway/upload/videoPOST /ai/upload/video
POST /gateway/chatPOST /api/v2/chat
POST /gateway/audio/voicesPOST /ai/audio
POST /gateway/audio/ttsTTS ผ่าน platform
GET /gateway/audio/listsรายการเสียง

Auth: Authorization: Bearer {user_access_token}

ตัวอย่างสร้างงาน:

http
POST /gateway/jobs/image
Authorization: Bearer {token}
Content-Type: application/json

{
  "modelSlug": "flux-dev",
  "wait": true,
  "fields": {
    "prompt": "A sunset",
    "ratio": "16:9"
  }
}

ข้อผิดพลาด:

json
{ "success": false, "message": "…", "code": "VALIDATION_ERROR" }

ทางเลือกเมื่อ self-host gateway — JSON REST, wait: true, portal billing


โหมด C — Gateway proxy ​

ส่งต่อโปร่งใส — path เดียวกับ Gommo แต่ base URL เป็น gateway

Mount บน gatewayUpstreamหมายเหตุ
/th/v2/*GOMMO_API_BASE_URLตัด /th/v2
/th/ai/*GOMMO_AUTH_BASE_URL
/th/api/v2/*GOMMO_AUTH_BASE_URLStream สำหรับ /th/chat หรือ SSE
/th/api/apps/go-mmo/*GOMMO_AUTH_BASE_URLLogin, me, balances

ตัวอย่าง map URL:

POST /v2/ai/jobs/image/flux-dev  →  POST https://v2.api.gommo.net/ai/jobs/image/flux-dev
POST /api/v2/chat                →  POST https://api.gommo.net/api/v2/chat
POST /api/apps/go-mmo/auth/login →  POST https://api.gommo.net/api/apps/go-mmo/auth/login
  • ขีด body 50 MB (raw)
  • Pipe stream สำหรับแชท / SSE
  • Form body ต้องมี domain — ใช้ GOMMO_API_DOMAIN (ตรงโดเมนลงทะเบียนผู้ใช้)

ใช้เมื่อย้าย FE Gommo ที่มีอยู่: เปลี่ยน base URL เป็น gateway คง path และ form body


Auth ข้ามโหมด ​

ตระกูล routeสไตล์ token
งาน V2 (/th/v2, /gateway/jobs)Authorization: Bearer
Route form platformaccess_token ใน form (+ Bearer บน /th/api/v2 เมื่อต้องการ)
Loginไม่มี token — คืน access_token

ดู การยืนยันตัวตน


แคตตาล็อกและกฎเดียวกัน ​

ทั้งสามโหมด:

  1. ลิสต์โมเดลก่อนสร้างงาน — ห้ามเดา ratio / mode / resolution / duration
  2. ใช้ Gommo access_token ของผู้ใช้
  3. เคารพ semantics งาน async (poll หรือ wait: true)

ถัดไป ​

→ เลือกโหมด · แผนที่ endpoint · ภาพรวมโมเดล