About this endpoint
What it does
Sends a chat-completions request using an OpenAI-style message array and returns a JSON object containing the generated completion metadata and choices. The request is sent in the body, and the response includes the completion id, model, usage, object, choices, and created fields.
Request Body
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
| model | String | No | Model name. Default: Qwen/Qwen3-0.6B. |
| top_p | Number | No | Nucleus sampling value. Must be between 0 and 1. |
| stream | Boolean | No | Whether to stream the response. Default: false. |
| messages | Object Array | Yes | Chat messages to send. Must contain at least 1 item. Each item requires role and content. |
| messages[].role | ENUM | Yes | Message role. Allowed values: system, user, assistant, tool. |
| messages[].content | String | Yes | Message content. |
| max_tokens | Integer | No | Maximum number of tokens to generate. Default: 256. Must be between 1 and 8192. |
| temperature | Number | No | Sampling temperature. Default: 0.7. Must be between 0 and 2. |
Response
Returns a JSON object with id, model, usage, object, choices, and created fields. The usage field is an object containing total_tokens, prompt_tokens, and completion_tokens; choices is an array of objects, each with index, message, and finish_reason.
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
| id | String | No | Completion identifier. |
| model | String | No | Model used for the response. |
| usage | Object | No | Token usage information. Contains total_tokens, prompt_tokens, and completion_tokens. |
| usage.total_tokens | Integer | No | Total tokens used. |
| usage.prompt_tokens | Integer | No | Prompt tokens used. |
| usage.completion_tokens | Integer | No | Completion tokens used. |
| object | String | No | Response object type. |
| choices | Object Array | No | Array of completion choices. |
| choices[].index | Integer | No | Choice index. |
| choices[].message | Object | No | Message returned for the choice. Contains role and content. |
| choices[].message.role | String | No | Role of the returned message. |
| choices[].message.content | String | No | Returned message content. |
| choices[].finish_reason | String | No | Reason the generation stopped. |
| created | Integer | No | Creation timestamp. |