Các chế độ tích hợp
Advanced / operator docs
Ẩn khỏi sidebar Models & routing mặc định — link từ Deploy → Self-host nâng cao. Integrator Tier A chỉ cần Gommo public API (Mode A).
Ba cách gọi Gommo.
So sánh nhanh
| Mode A Direct | Mode B REST | Mode C Proxy | |
|---|---|---|---|
| Base URL | Host Gommo | {gateway}/gateway | {gateway} |
| Auth | Bearer / form upstream | Authorization: Bearer | Pass-through |
| Domain client | Form bắt buộc | Tùy chọn (GOMMO_API_DOMAIN) | Form bắt buộc |
| Ẩn upstream | Không | Có | Có |
| Poll / wrap | Tự implement | wait: true | Envelope Gommo |
| Response | Gommo native | { success, data, message, code } | Gommo native |
| Phù hợp | Production — khuyến nghị | Self-host JSON REST | FE Gommo legacy drop-in |
Mode A — Direct Gommo
Gọi thẳng upstream từ backend tin cậy.
V2 jobs:
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, chat, audio:
POST https://api.gommo.net/api/apps/go-mmo/auth/login
POST https://api.gommo.net/api/v2/chat
POST https://api.gommo.net/ai/audioTự poll
Gommo không webhook. Poll 3.5s × ~80 lần hoặc dùng Mode B wait: true.
Mode B — Gateway REST
Sắp có trên nền tảng Gommo
Mode B (/gateway/*, wait: true, JSON REST) là xem trước trên repo này. Integrator production nên dùng Mode A (host public Gommo). Mode B sẽ hội tụ vào API nền tảng Gommo chính thức.
JSON API /gateway/*. Gateway dịch sang form upstream và poll tùy chọn.
Domain tự điền từ GOMMO_API_DOMAIN nếu client không gửi.
| Gateway | Upstream |
|---|---|
GET /gateway/models?type= | POST /ai/models (v2) |
POST /gateway/jobs/:type | POST /ai/jobs/:type/:slug |
GET /gateway/jobs/:id?media= | poll |
POST /gateway/upload/image | upload V2 |
POST /gateway/chat | POST /api/v2/chat |
POST /gateway/audio/* | platform audio |
Auth: Authorization: Bearer {user_access_token}.
Tùy chọn khi self-host gateway — JSON REST, wait: true, portal billing.
Mode C — Gateway proxy
Pass-through — giữ path Gommo, đổi base URL sang gateway.
| Mount | Upstream |
|---|---|
/vi/v2/* | GOMMO_API_BASE_URL (bỏ /vi/v2) |
/vi/ai/*, /vi/api/v2/* | GOMMO_AUTH_BASE_URL |
/vi/api/apps/go-mmo/* | auth proxy |
POST /v2/ai/jobs/image/flux-dev → v2.api.gommo.net/…
POST /api/v2/chat → api.gommo.net/…Body limit 50MB. Stream chat/SSE. Form cần domain.
Dùng khi migrate FE Gommo sẵn có — chỉ đổi base URL.
Auth theo mode
| Route | Token |
|---|---|
| V2 jobs | Authorization: Bearer |
| Platform form | access_token trong form |
| Login | Không token — trả access_token |
Cùng catalog, cùng quy tắc
- List models trước — không đoán
ratio/mode/ … - Cùng user
access_token - Job async — poll hoặc
wait: true
