Skip to content

Chat ​

Gommo Developer client

Official Gommo Developer TypeScript client — npm alias @ai-gateway/client. Calls Gommo public API (api.gommo.net, v2.api.gommo.net).

→ Gommo public API · Roadmap

Upstream requires non-empty messages.

Optional language (upstream form field, e.g. EN, VI). When omitted, the client sends VI (same as the gateway).

Chat (JSON or SSE) ​

action=chat may return SSE even when you expect JSON. Concatenate choices[0].delta.content from data: lines until [DONE].

typescript
const res = await client.chat.send({
  action: 'chat',
  query: 'Hello',
  language: 'EN',
  messages: [{ role: 'user', text: 'Hello' }],
});

Optional: sessionId for multi-turn; model, server, agentId for routing.

Stream (SSE) ​

typescript
for await (const chunk of client.chat.stream({
  query: 'Tell a short story',
  language: 'EN',
  messages: [{ role: 'user', text: 'Tell a short story' }],
})) {
  process.stdout.write(chunk);
}

Models catalog ​

typescript
const catalog = await client.chat.listModels();

Tier A upstream: POST /api/v2/chat with action=models. Gateway mode: GET /gateway/chat-models.

Set model ​

typescript
await client.chat.send({
  action: 'set_model',
  messages: [{ role: 'user', text: 'hi' }],
  model: 'gpt-5.5::cheap',
});

Session sync (server storage) ​

Separate from sessionId on chat — persists messages on Gommo:

typescript
const sessions = await client.chatSessions.listSessions({ limit: 20 });

await client.chatSessions.saveMessage({
  sessionId: '…',
  messageId: '…',
  role: 'user',
  text: 'Hello',
});

See Chat reference — Reading responses (JSON vs SSE) and Chat sessions.