---
title: "Create chat completion"
method: POST
path: "/v1/chat/completions"
tags: ["Chat Completions"]
---

# Create chat completion

`POST /v1/chat/completions`

## Request

- Base URL: `/` (relative, and the document was published on a file host, not at the API’s origin)
- URL: `/v1/chat/completions`
- Auth: HTTP bearer
- TypeScript: <https://skmtc.dev/tenstorrent/apis/tt-media-server-api-c-drogon/docs/v1/chat/completions/post.ts> (a function with typed inputs; its response is checked against the schema)

Creates a chat completion for the provided messages. OpenAI-compatible endpoint. Messages are converted to a prompt internally; responses use object "chat.completion" and choices[].message with role and content.

## Request body

- ChatCompletionRequest
  - `model` string: Model identifier
  - `messages` object[], required: Conversation messages (required, non-empty)
    - `role` string, required: Message role: system, user, or assistant
    - `content` string, required: Message content
  - `max_tokens` integer: Maximum number of tokens to generate
  - `stream` boolean: Whether to stream the response as SSE
  - `stream_options` StreamOptions
    - `include_usage` boolean: Include usage statistics in response
    - `continuous_usage_stats` boolean: Include usage stats in each streamed chunk
  - `temperature` number: Sampling temperature
  - `top_p` number: Nucleus sampling probability
  - `stop` union: Stop sequence(s)
    - string
    - string[]
  - `presence_penalty` number
  - `frequency_penalty` number
  - `seed` integer
  - `user` string
  - `enable_reasoning` boolean: When false, reasoning models (e.g. DeepSeek-R1) skip chain-of-thought and respond directly. Has no effect on non-reasoning models.

## Response `200`

Successful chat completion (JSON) or streaming (text/event-stream)

- ChatCompletionResponse
  - `id` string, required: Unique chat completion identifier
  - `object` 'chat.completion', required: Object type
  - `created` integer, required: Unix timestamp of creation
  - `model` string: Model used for completion
  - `choices` object[], required
    - `index` integer
    - `message` object
      - `role` string
      - `content` string
    - `finish_reason` string
  - `usage` CompletionUsage
    - `prompt_tokens` integer: Number of tokens in the prompt
    - `completion_tokens` integer: Number of tokens in the completion
    - `total_tokens` integer: Total tokens used
    - `ttft_ms` number, nullable: Time to first token in milliseconds
    - `tps` number, nullable: Tokens per second (excluding first token)

## Other responses

- `400`: Invalid request (e.g. missing or empty messages)
- `401`: Missing or invalid authentication token
- `503`: Model not ready

## Changes

- **2026-08-06** `f1176db3fd15`: 1 warning
  - removed the request property `response_format`
- **2026-04-29** `ef78377de59d`: 1 info
  - added the new optional request property `enable_reasoning`
- **2026-04-15** `33faa2a0603c`: 1 info
  - added the new optional request property `response_format`
- **2026-04-03** `d051d35964ca`: 2 warning
  - removed the request property `enable_reasoning`
  - removed the request property `response_format`

[Operation history](https://skmtc.dev/tenstorrent/apis/tt-media-server-api-c-drogon/changes/v1/chat/completions/post.md)

---

[API](https://skmtc.dev/tenstorrent/apis/tt-media-server-api-c-drogon.md) - [All operations](https://skmtc.dev/tenstorrent/apis/tt-media-server-api-c-drogon/llms.txt) - [OpenAPI document](https://skmtc.dev/tenstorrent/apis/tt-media-server-api-c-drogon/revisions/f1176db3fd15?raw)
