Skip to main content

Endpoint

  • POST /v1/chat/completions

What it does

OpenAI-compatible subset of chat.completions:
  • non-streaming: JSON (application/json)
  • streaming: SSE (text/event-stream) with data: ... events and a final data: [DONE]

Built-in tools via datai.tools (service extension)

This endpoint accepts datai.tools (not part of the OpenAI spec) to enable built-in tool access:
  • datai.tools.net: enable network/HTTP tools.
  • datai.tools.fs: enable filesystem tools.
  • datai.tools.webview: enable browser/webview tools.
Important rule:
  • Tools cannot be used with streaming: if stream: true and datai.tools is present, the server returns 400.

Request body

Validated:
  • model (string, required)
  • messages (array, required, non-empty)
Accepted fields include: stream, max_tokens, max_completion_tokens, temperature, top_p, stop, seed, tools, tool_choice, datai.tools. Minimal request:

Response (non-streaming)

usage is included only if token counters are available.

Streaming (SSE)

Errors (OpenAI-style)

curl examples

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