v3

latestOpenAPI 3.0.02026-08-081996601.2 MB
LLM Chat Completions

Create a chat completion

Creates a chat completion for a multi-turn chat through an OpenAI-compatible interface. Applications built for the OpenAI Chat Completions format can use the platform's language models with minimal changes to existing tools or code.

Use this endpoint for interactive chat experiences with context-aware responses, streaming output, and token usage tracking.

The request includes a series of chat messages and optional parameters that control the behavior and structure of the model response. The request body must include the messages parameter. This is an array of message objects (role, content) that represents the full conversation so far.

Streaming responses

If the stream parameter is set to true, the response arrives as a series of text/event-stream parts (also known as chunks). Each chunk includes a delta field with the incremental message update.

Example request

This example sends a simple chat conversation to the API, asking the model for the capital of France. The request includes a system message, a user message, and a temperature setting for response variability.

{
  "model": "chat-model-001","messages": [{ "role": "system", "content": "You are a helpful assistant." },
  { "role": "user", "content": "What is the capital of France?" }
],
"temperature": 0.7,
"stream": false
}

Example response

The response includes the model's assistant reply, along with token usage statistics. In this example, the model returns a direct answer to a user question.

{
"id": "chatcmpl-abc123",
"object": "chat.completion",
"created": 1712454830,
"model": "chat-model-001",
"choices": [
  {
    "index": 0,
    "message": {
      "role": "assistant",
      "content": "The capital of France is Paris."
  },
    "finish_reason": "stop"
  }
],
"usage": {
  "prompt_tokens": 21,
  "completion_tokens": 9,
  "total_tokens": 30
  } 
} 
post/v2/llms/chat/completions

Headers

Request-Timeoutinteger

The platform makes a best effort to complete the request in the specified seconds, or it times out.

Request-Timeout-Millisinteger

The platform makes a best effort to complete the request in the specified milliseconds, or it times out.

Request body

modelstring required

The ID of the model to use. This field is required.

streamboolean

Optional. When set to true, the platform streams partial message deltas as they become available instead of returning the full message at once.

Example request

{
  "response_format": {
    "json_schema": {
      "schema": {
        "type": "object"
      }
    }
  }
}

Response

A chat completion

object'chat.completion' required

The object type, which is always 'chat.completion'.