แชท
แชท AI ผ่าน platform chat API ของ Gommo บน https://api.gommo.net
Endpoint (แนะนำ)
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 อาจใช้ access_token แทน Bearer header — token เดียวกัน
Actions
action | พฤติกรรม |
|---|---|
chat | response JSON ครั้งเดียว |
stream | สตรีม SSE |
set_model | เปลี่ยน chat model สำหรับ session |
agent | set_model (best-effort) แล้ว chat — text agent flow |
models | ลิสต์ chat models ที่มี |
messages ไม่ว่าง
upstream action=chat ต้องการ messages อย่างน้อยหนึ่งรายการ — เช่น { "role": "user", "text": "..." }
Streaming
ตั้ง action=stream สำหรับ SSE token-by-token consume สตรีมบน client — ไม่คาดหวัง JSON body เดียว
Credits
แชทใช้เครดิต user Gommo ตรวจยอดผ่าน POST https://api.gommo.net/ai/me
Portal chat
/th/app/chat/ ใช้ upstream API เดียวกัน ประวัติแชทใน portal เฉพาะ local — export/import JSON จาก sidebar สำหรับ backup
Playground (ทดสอบ REST)
เมื่อรัน Gommo Developer local (npm run docs:stack) Playground อาจเรียก /gateway/chat same-origin (proxy dev) — integrator production ใช้ POST https://api.gommo.net/api/v2/chat ไม่ใช่ /gateway/*
Playground — worker Platform → Chat (?worker=chat) · language ทางเลือก (VI, EN)
ทางเลือก: self-host (operator)
เมื่อ self-host repo — Deploy → Self-host ขั้นสูง
API ฉบับเต็ม
→ อ้างอิงแชท (models, SSE, sessions) · Gommo public API
ถัดไป
→ เสียง & TTS · งานมีเดีย
