# Create chat completion

```http
POST /ai/v1/chat/completions
```

Create chat completion.

## Parameters

| Name                            | In     | Required | Description |
| ------------------------------- | ------ | -------- | ----------- |
| `x-veryfront-project-reference` | header |          |             |
| `x-veryfront-project-id`        | header |          |             |
| `x-veryfront-project-slug`      | header |          |             |
| `x-veryfront-agent-run-id`      | header |          |             |
| `x-veryfront-conversation-id`   | header |          |             |
| `x-veryfront-message-id`        | header |          |             |
| `x-veryfront-agent-id`          | header |          |             |
| `x-veryfront-billing-group-id`  | header |          |             |

## Request body

| Field      | Type   | Required | Description                                                                           |
| ---------- | ------ | -------- | ------------------------------------------------------------------------------------- |
| `model`    | string | Yes      | Catalog model ID or alias. Required: the request is routed by model, not by base URL. |
| `messages` | array  | Yes      | Vendor-shaped messages, forwarded as sent.                                            |

## Responses

| Status  | Description                                                                                                                                                   |
| ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 200     | Upstream provider response (forwarded as-is)                                                                                                                  |
| 400     | Invalid request                                                                                                                                               |
| 401     | Unauthorized                                                                                                                                                  |
| 402     | Insufficient AI credits, an exhausted monthly AI budget, or a provider spend limit                                                                            |
| 403     | Project access denied                                                                                                                                         |
| 404     | No deployment of this model speaks this protocol natively                                                                                                     |
| 413     | Request body over the 32 MiB limit (code request\_too\_large), or an upstream 413 re-rendered in this envelope                                                |
| 429     | The calling API key's requests-per-minute limit (code key-rate-limited), or an upstream provider rate limit re-rendered in this envelope with its Retry-After |
| 500     | Gateway error, or an upstream 500 re-rendered in this envelope                                                                                                |
| 502     | Gateway proxy error, or an upstream 502 re-rendered in this envelope                                                                                          |
| 503     | No available deployment, auth unavailable, or an upstream 503 re-rendered in this envelope                                                                    |
| 529     | Upstream provider overloaded, re-rendered in this envelope                                                                                                    |
| default | Any other status the upstream provider returned, with the upstream status and its body (if any) re-rendered in this envelope                                  |
