Skip to main content
POST
Chat Completions
Send the messages needed for the current turn. Conversation history is supplied by your application on every request.
string
required
Bearer followed by your derestricted API key.
string
default:"derestricted-llm"
Use derestricted-llm. Omitting this field uses the same deployment.
array
required
Conversation messages, such as {"role": "user", "content": "Hello"}. Include prior assistant messages and tool results when continuing a conversation. Maximum 2,000 items.
boolean
default:"false"
Set to true for server-sent events.
integer
Output allowance, capped at 65,536. If omitted, the service chooses an affordable allowance up to 32,768. max_completion_tokens is also accepted and takes precedence when both fields are present.
object
With streaming, use {"include_usage": true} to request the final usage chunk.
array
Optional client-defined tool schemas. Your application executes calls and returns their results. Up to 128 tool definitions are accepted within the shared request limits.

Example

Read answer text from choices[0].message.content. A response can also contain message.tool_calls or a message.reasoning_content extension. Check finish_reason; reaching the output limit may leave the answer incomplete.

Streaming

Raw SSE clients receive JSON in data: frames followed by data: [DONE]. Keepalive comments such as : ping contain no generated text. Answer text arrives in choices[].delta.content; reasoning may arrive separately in delta.reasoning_content or delta.reasoning. When usage is requested, the final usage chunk may have an empty choices array. Do not assume every chunk contains a choice. An error frame can occur after HTTP 200; treat it as a failed generation even if some text has already arrived.

Tool calls

Supply function definitions using the Chat Completions tool shape. If the model returns a tool call, validate its arguments, execute the approved operation in your application, and send the assistant tool call plus a role: "tool" result with the matching tool_call_id in the next request. The API does not run functions or enforce a strict JSON Schema contract for arguments. See compatibility limits and errors.