แชท + stream
POST https://api.gommo.net/api/v2/chat — upstream ต้องการ messages ไม่ว่าง
แชท (JSON response)
powershell
$h = @{ Authorization = "Bearer $env:TOKEN" }
$body = "action=chat&domain=%REGISTRATION_DOMAIN%&query=Say hello in one short sentence.&messages=[{\"role\":\"user\",\"text\":\"Say hello in one short sentence.\"}]"
Invoke-RestMethod -Method POST `
-Uri "https://api.gommo.net/api/v2/chat" `
-Headers $h `
-ContentType "application/x-www-form-urlencoded" `
-Body $bodyทางเลือก: ส่ง sessionId จาก response ก่อนหน้าสำหรับ multi-turn
Stream (SSE)
ใช้ curl -N อ่านสตรีมบน terminal:
powershell
curl.exe -N -X POST "https://api.gommo.net/api/v2/chat" ^
-H "Authorization: Bearer %TOKEN%" ^
-H "Content-Type: application/x-www-form-urlencoded" ^
-d "action=stream&domain=%REGISTRATION_DOMAIN%&query=Tell a very short story.&messages=[{\"role\":\"user\",\"text\":\"Tell a very short story.\"}]"Self-host (operator เท่านั้น)
เมื่อ deploy local — Deploy → Self-host ขั้นสูง
Playground
Playground — worker Platform → Chat (ค้นหา chat) หรือ ?embed=1&worker=chat → stream → Run request ดู Chat reference
ถัดไป
- อ้างอิงแชท — Reading responses (JSON vs SSE)
- Agent HTTP flow
