Skip to content

แชท (agent) ​

Upstream: POST https://api.gommo.net/api/v2/chat (form urlencoded)

Playground

Playground — worker Platform → Chat (ค้นหา chat) หรือ sidebar เมื่อ ?dev=1 · UI แชท: /th/app/chat/

การดำเนินการGommo public API
Chat agentPOST https://api.gommo.net/api/v2/chat action=chat
Chat streamPOST https://api.gommo.net/api/v2/chat action=stream (SSE)
Set modelPOST https://api.gommo.net/api/v2/chat action=set_model

Form fields (Direct) ​

Fieldหมายเหตุ
actionchat, stream, set_model, models
access_tokenUser token (หรือ Bearer header)
domainโดเมนที่สมัคร เช่น <registration-domain>
queryข้อความผู้ใช้
messagesJSON array — ต้องไม่ว่าง สำหรับ action=chat
languageทางเลือก — locale upstream (capture VI, EN)
chat_idUUID session (form upstream; gateway JSON ใช้ sessionId)

ฟิลด์ขั้นสูง: model, server, agent_id, chat_tools, device_* — gateway เติมค่าเริ่มต้นเมื่อไม่ส่ง

WARNING

Upstream action=chat ต้องมี messages ไม่ว่าง ส่งอย่างน้อย { "role": "user", "text": "..." }

action=stream → response SSE


Chat (agent) ​

bash
curl.exe -X POST "https://api.gommo.net/api/v2/chat" ^
  -H "Content-Type: application/x-www-form-urlencoded" ^
  -d "action=chat&access_token=%TOKEN%&domain=%REGISTRATION_DOMAIN%&query=Hello&messages=[{\"role\":\"user\",\"text\":\"Hello\"}]"
powershell
$d = $env:GOMMO_API_DOMAIN; if (-not $d) { throw 'Set GOMMO_API_DOMAIN to the user registration domain (dealer)' }
$messages = '[{"role":"user","text":"Hello"}]'
$form = "action=chat&access_token=$env:TOKEN&domain=$d&query=Hello&messages=$messages"
Invoke-RestMethod -Method POST -Uri "https://api.gommo.net/api/v2/chat" `
  -ContentType "application/x-www-form-urlencoded" -Body $form

Stream ​

bash
curl.exe -N -X POST "https://api.gommo.net/api/v2/chat" ^
  -H "Content-Type: application/x-www-form-urlencoded" ^
  -d "action=stream&access_token=%TOKEN%&domain=%REGISTRATION_DOMAIN%&query=Tell a short story&messages=[{\"role\":\"user\",\"text\":\"Tell a short story\"}]"

รายการ model (action=models) ​

POST …/api/v2/chat — action=models · response JSON catalog · ใช้ id กับ set_model

Mode B: GET {gateway}/gateway/chat-models


Set model ​

action=set_model + chat_id + model


อ่าน response (JSON vs SSE) ​

stream (และบางครั้ง chat) คืน SSE — รวม choices[0].delta.content จนถึง [DONE] ไม่มี field "text" เต็มประโยคในบody เดียว


Chat sessions (sync server) ​

POST …/api/v2/ai-chat-sessions — action: save_message | list_sessions | get_messages | get_session

Mode B: POST {gateway}/gateway/chat-sessions JSON (sessionId → session_id)


Self-host (operator เท่านั้น) ​

POST {gateway}/gateway/chat JSON — Bearer; language ทางเลือก (ค่าเริ่มต้น gateway VI) Playground Chat มีช่อง language

→ Deploy → Self-host ขั้นสูง · Gommo public API