---
title: "Chat Completions"
method: POST
path: "/api/v1/chat/completions"
tags: ["openai compatible"]
---

# Chat Completions

`POST /api/v1/chat/completions`

OpenAI-compatible chat completions endpoint

## Request body

- ChatCompletionRequest
  - `model` string, required
  - `messages` object[], required
  - `functions` object[], nullable
  - `function_call` union
    - object
    - string
  - `temperature` number
  - `top_p` number
  - `n` integer
  - `stream` boolean
  - `stop` union
    - string
    - string[]
  - `max_tokens` integer, nullable
  - `presence_penalty` number
  - `frequency_penalty` number
  - `logit_bias` object, nullable
  - `user` string, nullable

## Response `200`

Successful Response

- ChatCompletionResponse
  - `id` string, required
  - `object` string, required
  - `created` integer, required
  - `model` string, required
  - `choices` object[], required
  - `usage` object, required

## Other responses

- `422` — Validation Error

## Changes

- **2025-03-12** `181efcea9e6e` — 1 info
  - endpoint added
- **2024-11-23** `a2d864f3a8db` — 1 breaking
  - api path removed without deprecation

[Change history](https://skmtc.dev/pyspur-dev/apis/pyspur-api/changes/api/v1/chat/completions/post.md)

---

[API](https://skmtc.dev/pyspur-dev/apis/pyspur-api.md) · [All operations](https://skmtc.dev/pyspur-dev/apis/pyspur-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/pyspur-dev/pyspur-api/revisions/adc77484c851/schema)
