chat

Create chat completion

Creates a model response for the given chat conversation.

The conversation is provided as an array of messages, where each message has a role (system, user, assistant, or tool) and content.

Set stream: true to receive partial responses as server-sent events.

post/chat/completions

Request body

frequency_penaltynumber float nullable

Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far.

max_tokensinteger nullable

The maximum number of tokens to generate in the chat completion.

modelstring required

ID of the model to use.

ninteger nullable

How many chat completion choices to generate for each input message.

presence_penaltynumber float nullable

Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far.

stopstring[] nullable

Up to 4 sequences where the API will stop generating further tokens.

streamboolean nullable

If set, partial message deltas will be sent as server-sent events.

temperaturenumber float nullable

What sampling temperature to use, between 0 and 2.

{"stackTrail":"components:schemas:ChatCompletionRequest:properties:tool_choice","oasType":"schema","type":"unknown","description":"Controls which (if any) tool is called by the model."}
top_pnumber float nullable

An alternative to sampling with temperature, called nucleus sampling.

userstring nullable

A unique identifier representing your end-user.

Example request

{
  "max_tokens": 256,
  "messages": [
    {
      "content": "You are a helpful assistant.",
      "role": "system"
    },
    {
      "content": "What is a doubleword?",
      "role": "user"
    }
  ],
  "model": "Qwen/Qwen3-30B-A3B-FP8",
  "temperature": 0.7
}

Response

Chat completion generated successfully. When streaming, returns a series of SSE events.

createdinteger required

The Unix timestamp of when the chat completion was created.

idstring required

A unique identifier for the chat completion.

modelstring required

The model used for the chat completion.

objectstring required

The object type, always "chat.completion".

system_fingerprintstring nullable

The system fingerprint of the model.

Example response

{
  "choices": [
    {
      "finish_reason": "stop",
      "index": 0,
      "message": {
        "content": "A doubleword is a data unit that is twice the size of a standard word in computer architecture, typically 32 or 64 bits depending on the system.",
        "role": "assistant"
      }
    }
  ],
  "created": 1703187200,
  "id": "chatcmpl-abc123",
  "model": "Qwen/Qwen3-30B-A3B-FP8",
  "object": "chat.completion",
  "usage": {
    "completion_tokens": 36,
    "prompt_tokens": 24,
    "total_tokens": 60
  }
}

Changes

No recorded changes to this endpoint across all 1 revision of this API.