Chat (agent)
Chat AI qua platform chat API Gommo trên https://api.gommo.net.
Endpoint (khuyến nghị)
POST https://api.gommo.net/api/v2/chat
Authorization: Bearer {access_token}
Content-Type: application/x-www-form-urlencoded
action=chat&domain=%REGISTRATION_DOMAIN%&query=Hello&messages=[{"role":"user","text":"Hello"}]Form có thể dùng access_token thay Bearer header — cùng token.
Actions
action | Hành vi |
|---|---|
chat | Response JSON một lần |
stream | SSE stream |
set_model | Đổi chat model cho session |
agent | set_model (best-effort) rồi chat — text agent flow |
models | List chat models có sẵn |
Messages không rỗng
Upstream action=chat yêu cầu messages có ít nhất một entry — vd. { "role": "user", "text": "..." }.
Streaming
Đặt action=stream cho SSE token-by-token. Consume stream trên client — không kỳ vọng một JSON body.
Credits
Chat tiêu credit user Gommo. Kiểm tra số dư qua POST https://api.gommo.net/ai/me.
Portal chat
/vi/app/chat/ dùng cùng upstream API. Lịch sử chat trong portal chỉ local — export/import JSON từ sidebar để backup.
Playground (test REST)
Khi chạy Gommo Developer local (npm run docs:stack), Playground có thể gọi /gateway/chat same-origin (proxy dev). Integrator production dùng POST https://api.gommo.net/api/v2/chat — không dùng /gateway/*.
Playground — worker Nền tảng → Chat (?worker=chat) để test tương tác. JSON language tùy chọn (VI, EN).
Tùy chọn: self-host (operator)
Khi self-host repo — Deploy → Self-host nâng cao.
API đầy đủ
→ Chat reference (models, SSE, chat sessions, field nâng cao) · Gommo public API
