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

# Chat Completions (OpenAI Compatible)

> Successful Response

### Request body

`OpenAIChatCompletionRequest`

<ParamField body="model" type="string" required>
  Model identifier
</ParamField>

<ParamField body="messages" type="OpenAIChatMessage[]" required>
  Chat messages
</ParamField>

<ParamField body="max_tokens" type="integer,null">
  Max tokens to generate
</ParamField>

<ParamField body="temperature" type="number,null">
  Sampling temperature
</ParamField>

<ParamField body="top_p" type="number,null">
  Top-p sampling
</ParamField>

<ParamField body="stream" type="boolean">
  Stream partial responses
</ParamField>

<ParamField body="stop" type="string">
  Stop sequence(s)
</ParamField>

<ParamField body="tools" type="object[],null">
  Tool definitions
</ParamField>

<ParamField body="tool_choice" type="string">
  Tool choice
</ParamField>

### Response

`OpenAIChatCompletionResponse`

<ResponseField name="id" type="string" required />

<ResponseField name="object" type="string" required />

<ResponseField name="created" type="integer" required />

<ResponseField name="model" type="string" required />

<ResponseField name="choices" type="object[]" required />

<ResponseField name="usage" type="object,null" />

### Status codes

| Code  | Meaning                 |
| ----- | ----------------------- |
| `200` | Successful Response     |
| `401` | Authentication required |
| `422` | Validation Error        |
| `429` | Rate limit exceeded     |

<RequestExample>
  ```bash cURL theme={null}
  curl --request POST \
    --url 'http://localhost:8000/v1/chat/completions' \
    --header 'Authorization: Bearer YOUR_API_KEY' \
    --header 'Content-Type: application/json' \
    --data '{
    "model": "string",
    "messages": [
      {
        "role": "system",
        "content": "Two-person tent, green — replacement for damaged pole set.",
        "name": "Two-Person Tent",
        "tool_call_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
        "tool_calls": []
      }
    ],
    "max_tokens": 1,
    "temperature": 1.5,
    "top_p": 1.5,
    "stream": false,
    "stop": "string",
    "tools": [
      {}
    ],
    "tool_choice": "string"
  }'
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "object": "string",
    "created": 1,
    "model": "string",
    "choices": [
      {}
    ],
    "usage": {}
  }
  ```
</ResponseExample>
