Send messages to any supported model and receive a completion via the OpenAI-compatible chat endpoint.
Chat completions are the core inference primitive of the OpenDunes API. Send a conversation as an ordered array of messages, get a completion back — or stream it token by token.
This is the only inference endpoint today. It is compatible with the OpenAI chat completions spec, so any code or library targeting the OpenAI API works without modification — just swap the base URL and key.
| Field | Type | Required | Description |
|---|---|---|---|
model | string | Yes | Model slug, e.g. openai/gpt-5.4 |
messages | array | Yes | Ordered conversation history |
stream | boolean | No | Stream tokens via SSE (default false) |
max_tokens | integer | No | Cap on generated tokens |
temperature | number | No | Sampling temperature, 0–2 (default 1) |
top_p | number | No | Nucleus sampling threshold, 0–1 (default 1) |
For the full parameter set, including fields that are not yet available, see Parameters.
Each message object has a role and content.
| Role | Purpose |
|---|---|
system | Instructions that shape the model's behavior across the conversation |
user | Input from the human turn |
assistant | Prior model output, or a prefill to continue from |
tool | Tool-call result returned to the model (set tool_call_id) |
content can be a plain string or an array of content parts. Use the parts format to send images alongside text for vision-capable models:
The usage object shows token counts for the request. Your balance is deducted at the model's DA-per-million-token rate; the X-Balance-Available header in the response carries your remaining balance in micro-DA.
Set "stream": true to receive tokens as server-sent events. See Streaming for the full event format and code examples.
Errors return a non-2xx status code with a JSON body. See Errors for the full status-code table and the exact response shape.