---
title: "Create a chat completion"
method: POST
path: "/v1/chat/completions"
---

# Create a chat completion

`POST /v1/chat/completions`

## Headers

- `X-Speko-Objective` 'latency' | 'quality' | 'cost' | 'balanced'
- `X-Speko-Language` string
- `X-Speko-Allow` string
- `X-Speko-Deny` string
- `X-Speko-Max-Price` number

## Request body

- object
  - `model` string, required — Use auto for benchmark-led routing, or provide a model id.
  - `messages` object[], required
  - `stream` boolean

## Response `200`

OpenAI-compatible completion or event stream

## Other responses

- `502` — Every attempted upstream failed before the router could complete the request. Route, reason, and failover-count headers are present; X-Speko-First-Byte-Ms is omitted.
- `default` — Router-generated errors use the Speko JSON error schema. A non-retryable upstream 4xx is passed through after response-header sanitization with its upstream status, media type, and body, which can be non-JSON.

---

[API](https://skmtc.net/speko/apis/speko-voice-router-api.md) · [All operations](https://skmtc.net/speko/apis/speko-voice-router-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/speko/speko-voice-router-api/versions/ef3d201df72e/schema)
