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

# Chat Completions

`POST /v1/chat/completions`

OpenAI-compatible chat completions endpoint with RAG support.

Uses any-llm for unified LLM interface with native function calling support.
If the agent has a knowledge base, automatically provides search as a tool.

## Headers

- `authorization` string, nullable

## Request body

- ChatCompletionRequest — Schema for chat completion request.
  - `model` string, required — Agent slug to use for completion
  - `messages` ChatMessage[], required — List of messages in the conversation
    - `role` 'system' | 'user' | 'assistant', required — Message role
    - `content` string, required — Message content
  - `stream` boolean — Whether to stream the response
  - `max_tokens` integer, nullable — Maximum tokens to generate

## Response `200`

Successful Response

- unknown

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.dev/chonkie/apis/chonkie-api.md) · [All operations](https://skmtc.dev/chonkie/apis/chonkie-api/llms.txt) · [OpenAPI document](https://skmtc.dev/chonkie/apis/chonkie-api/revisions/f40f036f941c?raw)
