Skip to content

เลือกโหมด integration ​

เลือกโหมดครั้งเดียวต่อ client surface ทุกโหมดใช้ token และ catalog เดียวกัน

Decision tree ​

มี FE Gommo ที่ใช้ /v2 และ /api/v2 อยู่แล้ว?
├─ ใช่ → โหมด C (เปลี่ยนแค่ base URL ของ gateway)
└─ ไม่
    ├─ เรียก Gommo upstream โดยตรงได้? (แนะนำ)
    │   ├─ ได้ → โหมด A Direct (v2.api.gommo.net + api.gommo.net)
    │   └─ ไม่ได้
    │       └─ ต้องการ billing, BYOK หรือ wait: true บน self-host?
    │           ├─ ใช่ → โหมด B REST (/gateway/*)
    │           └─ ไม่ → โหมด A Direct (ง่ายสุด — ไม่พึ่ง gateway)

ตาม use case ​

Use caseแนะนำเหตุผล
แอป/backend ใหม่โหมด APublic API ไม่พึ่ง gateway
Mobile ผ่าน backendโหมด ADirect upstream; poll เอง
Script batchโหมด A หรือ BA = ไม่มี infra; B = wait: true self-host
FE site-ai / Gommo legacyโหมด Cเปลี่ยน base URL น้อยที่สุด
ต้องการ billing/BYOK gatewayโหมด Bโอนเงินผ่านธนาคาร, BYOK, JSON errors
Playground devโหมด A หรือ B/CPlayground แสดง public URL; dev อาจ proxy
Browser cross-origin + self-hostโหมด B + CORSREST + GATEWAY_CORS_ORIGIN
Agent / automationโหมด A หรือ Gommo MCPHTTP direct หรือ MCP hosted

Trade-offs ​

โหมด A — Direct (แนะนำ) ​

ข้อดี: ไม่พึ่ง gateway; latency ต่ำ; host Gommo อย่างเป็นทางการ
ข้อเสีย: สอง hostname; poll เอง; domain ในทุก form

โหมด B — REST ​

ข้อดี: prefix เดียว; JSON; poll ในตัว; inject domain; billing/BYOK
ข้อเสีย: ต้อง self-host gateway; shape ต่างจาก Gommo raw

โหมด C — Proxy ​

ข้อดี: drop-in FE Gommo; คง envelope upstream
ข้อเสีย: client ยังส่ง domain; ไม่มี wait: true

เปลี่ยนโหมดภายหลัง ​

จาก → ไปความพยายาม
A → Bปานกลาง — ชี้ gateway, JSON body
C → Bปานกลาง — เขียนใหม่ /gateway/*
B → Aต่ำ — public hosts, form + poll client
B → Cต่ำสำหรับ media — map REST กลับ /th/v2

Token และ slug เหมือนกันทุกโหมด

Checklist ​

  • [ ] list models และ copy ratio จาก response
  • [ ] ยืนยัน domain ส่งที่ไหน (form client สำหรับโหมด A)
  • [ ] วางแผน poll (3.5s × 80 หรือ gateway wait: true)
  • [ ] CORS เฉพาะเมื่อ browser เรียก self-host gateway (โหมด B)
  • [ ] merchant token ไม่อยู่ client

ขั้นตอนถัดไป ​

→ Gommo public API · Integration modes · Quickstart