Skip to main content

Endpoint

  • POST /api/chat

What it does

Ollama-compatible chat:
  • non-streaming: a single JSON object (application/json)
  • streaming: NDJSON (application/x-ndjson, one JSON object per line)

Request body (Ollama-like)

  • model (string, required) — model name.
  • messages (array, expected) — array of {role, content} messages.
  • system (string, optional) — system prompt.
  • options (object, optional) — Ollama options (examples: temperature, top_p, top_k, num_predict, num_ctx, stop, seed).
  • stream (bool, optional) — enable streaming (defaults to false).
  • datai.tools (optional) — built-in tools switch (same as in Completions).
Minimal request:

Response (non-streaming)

Metric fields may be missing.

Streaming (NDJSON)

Streaming errors may also be sent as NDJSON lines:

curl examples

Non-streaming:
Streaming (NDJSON):
Tools (non-streaming only):