Skip to Content

Ollama-compatible chat. Same request/response shape as Ollama /api/chat . The response arrives in the same HTTP request.

Endpoint

POST https://llm.dat.ai/api/chat Authorization: Bearer YOUR_API_KEY Content-Type: application/json

Request body

Uses the Ollama chat schema . Full request — see Example below.

FieldRequiredDescription
modelYesModel name, e.g. qwen3:1.7b
messagesYesChat history — see messages below
streamNoDefault false if omitted. Set true for streaming
toolsNoOllama function calling — passed through; not the same as datai.tools
dataiNodat.ai built-in node tools (net, fs) — see Inference overview

messages

Array of objects with role and content:

"messages": [ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Hello!" } ]

Roles: user, assistant, system (same as Ollama /api/chat ).

Other Ollama /api/chat  fields (options, etc.) are passed through as-is.

Optional header: X-Request-ID.

Response

Non-streaming (200): Ollama ChatResponse with the final message in message.content and "done": true.

Streaming: Content-Type: application/x-ndjson — one JSON object per line, each with partial message.content, ending with a final object where "done": true.

Errors

Plain JSON { "error": "..." } — see Authentication. Common cases:

StatusCause
400Invalid JSON, missing model, datai.tools + stream: true
401Missing or invalid API key
402Insufficient credits
504Request timed out (max wait 180 seconds)

Example

curl -sS -X POST "https://llm.dat.ai/api/chat" \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "qwen3:1.7b", "messages": [{"role": "user", "content": "Hello!"}], "stream": false }'