Skip to content

Chat ​

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

Playground

Playground — worker picker Platform → Chat (search chat) or sidebar Platform → Chat when ?dev=1. Multi-turn UI: /app/chat/.

OperationGommo 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) ​

FieldNotes
actionchat, stream, set_model, models
access_tokenUser token (or use Bearer header)
domainRegistration domain, e.g. <registration-domain>
queryUser message text
messagesJSON array — required non-empty for action=chat
sessionIdOptional — multi-turn; upstream form often uses chat_id (same UUID)
languageOptional — UI locale for upstream (capture uses VI, EN)

Optional fields (advanced direct calls) ​

Gateway fills defaults from env when omitted. Set explicitly when you manage models/sessions yourself:

FieldWhen
model, server, agent_idset_model, stream — model routing
chat_idSession UUID (set_model, chat)
project_idSome stream payloads
chat_toolsJSON e.g. {"web_search":true,"web_fetch":false} on stream
system_custom_prompt / custom_system_promptOverride system prompt
device_*Same as other platform forms

WARNING

Upstream action=chat requires non-empty messages. Send at least one { "role": "user", "text": "..." }.

action=stream → SSE response.


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
bash
curl.exe -X POST "https://api.gommo.net/api/v2/chat" ^
  -H "Authorization: Bearer %TOKEN%" ^
  -H "Content-Type: application/x-www-form-urlencoded" ^
  -d "action=chat&domain=%REGISTRATION_DOMAIN%&query=Hello&messages=[{\"role\":\"user\",\"text\":\"Hello\"}]"

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\"}]"
powershell
$d = $env:GOMMO_API_DOMAIN; if (-not $d) { throw 'Set GOMMO_API_DOMAIN to the user registration domain (dealer)' }
$messages = '[{"role":"user","text":"Tell a short story"}]'
$form = "action=stream&access_token=$env:TOKEN&domain=$d&query=Tell a short story&messages=$messages"
curl.exe -N -X POST "https://api.gommo.net/api/v2/chat" `
  -ContentType "application/x-www-form-urlencoded" -d $form

List chat models ​

POST https://api.gommo.net/api/v2/chat with action=models (form-urlencoded, same auth as chat).

powershell
$d = $env:GOMMO_API_DOMAIN; if (-not $d) { throw 'Set GOMMO_API_DOMAIN to your registration domain' }
$form = "action=models&access_token=$env:TOKEN&domain=$d"
Invoke-RestMethod -Method POST -Uri "https://api.gommo.net/api/v2/chat" `
  -ContentType "application/x-www-form-urlencoded" -Body $form

Response shape is pass-through JSON (catalog entries with model ids, servers, pricing metadata). Use a returned id with action=set_model before chat/stream if you switch models mid-session.

Mode B (self-host): GET {gateway}/gateway/chat-models — Bearer, merged catalog for portal/dev.


Set model (session) ​

action=set_model — form includes chat_id (session UUID), model, server, agent_id (from catalog or your config).

powershell
$d = $env:GOMMO_API_DOMAIN; if (-not $d) { throw 'Set GOMMO_API_DOMAIN to your registration domain' }
$sid = '<session-uuid>'
$form = "action=set_model&access_token=$env:TOKEN&domain=$d&chat_id=$sid&model=gpt-5.5::cheap"
Invoke-RestMethod -Method POST -Uri "https://api.gommo.net/api/v2/chat" `
  -ContentType "application/x-www-form-urlencoded" -Body $form

Reading responses (JSON vs SSE) ​

actionTypical Content-TypeClient work
chatOften text/event-stream or JSONIf SSE: read lines data: {...} until [DONE]; concatenate choices[0].delta.content (or message.content in final chunk). If JSON: parse body once.
streamtext/event-streamSame SSE loop; do not expect one JSON object.
models, set_modelapplication/jsonParse JSON envelope.

Example SSE chunk (simplified):

text
data: {"choices":[{"delta":{"content":"Hello"}}]}
data: [DONE]

Usage/credits may appear in the last chunks (usage, credit fields). Integrators must implement SSE parsing — raw body is not a single "text" field.


Chat sessions (server sync) ​

Optional server-side session/message storage (separate from chat_id on /api/v2/chat):

POST https://api.gommo.net/api/v2/ai-chat-sessions — form-urlencoded.

actionPurpose
save_messagePersist one message
save_sessionUpdate session title/preview and session metadata (e.g. chatProcessing)
list_sessionsList sessions for user
get_messagesMessages in a session
get_sessionSession metadata

Common form fields: access_token, domain, action, optional device_*.

ActionExtra fields
save_messagesession_id, message_id, role (user | model), text, optional attachments (JSON string), timestamp, metadata (JSON)
save_sessionsession_id, title, preview, optional agent_id, model, server, project_id, timestamp, metadata (JSON)
get_messages, get_sessionsession_id; optional limit, offset, cursor
list_sessionsoptional limit, offset, cursor
powershell
$d = $env:GOMMO_API_DOMAIN; if (-not $d) { throw 'Set GOMMO_API_DOMAIN to your registration domain' }
$form = "action=list_sessions&access_token=$env:TOKEN&domain=$d"
Invoke-RestMethod -Method POST -Uri "https://api.gommo.net/api/v2/ai-chat-sessions" `
  -ContentType "application/x-www-form-urlencoded" -Body $form

Mode B JSON (POST {gateway}/gateway/chat-sessions): use camelCase — sessionId, messageId, role, text, limit, offset, cursor — gateway maps to upstream session_id, etc.


Self-host (operators only) ​

POST {gateway}/gateway/chat — JSON body (Bearer required):

json
{
  "action": "chat",
  "query": "Hello",
  "messages": [{ "role": "user", "text": "Hello" }],
  "language": "EN"
}

Omit language → gateway sends upstream VI. Playground Platform → Chat exposes the same field.

Session sync (Mode B): POST {gateway}/gateway/chat-sessions — { "action": "list_sessions" } or { "action": "get_messages", "sessionId": "…" }.

→ Deploy → Self-host (advanced) · Gommo public API