> ## Documentation Index
> Fetch the complete documentation index at: https://docs.heyaskr.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Chat completions

> POST /chat/completions

Create a model response for a conversation. OpenAI-compatible.

```
POST https://api.heyaskr.ai/chat/completions
```

## Request body

<ParamField body="model" type="string" required>
  The model id, e.g. `gpt-5.5`, `claude-sonnet-4.6`. Add routing suffixes like
  `:nitro` or `:online` where supported.
</ParamField>

<ParamField body="messages" type="array" required>
  The conversation so far. Each item has `role` (`system` | `user` |
  `assistant`) and `content`.
</ParamField>

<ParamField body="stream" type="boolean" default="false">
  If true, returns Server-Sent Events as tokens are generated.
</ParamField>

<ParamField body="temperature" type="number" default="1">
  Sampling temperature, 0–2.
</ParamField>

<ParamField body="max_tokens" type="integer">
  Maximum tokens in the completion.
</ParamField>

<ParamField body="plugins" type="array">
  Optional plugins, e.g. `[{"id":"web","max_results":5}]` for web search.
</ParamField>

## Response

<ResponseField name="id" type="string">Unique id for the completion.</ResponseField>

<ResponseField name="choices" type="array">
  The generated choices. Each has a `message` (`role`, `content`) and a
  `finish_reason`.
</ResponseField>

<ResponseField name="usage" type="object">
  Token counts: `prompt_tokens`, `completion_tokens`, `total_tokens`.
</ResponseField>

```json theme={null}
{
  "id": "chatcmpl-...",
  "choices": [
    { "message": { "role": "assistant", "content": "Hello!" }, "finish_reason": "stop" }
  ],
  "usage": { "prompt_tokens": 12, "completion_tokens": 3, "total_tokens": 15 }
}
```
