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

# Chat completion

`POST /chat/completions`

## Request

- Base URL: `https://api.munito.ai/inference/v1`
- URL: `https://api.munito.ai/inference/v1/chat/completions`
- Auth: one of:
  - HTTP bearer
  - API key in header `x-api-key`

Create a chat completion with an open model. Set the OpenAI SDK base URL to https://api.munito.ai/inference/v1 and use your Munito API key. Both Authorization: Bearer and X-API-Key are accepted. Use stream for streamed output, tools for function calls, and response_format for structured output. Each model accepts its own parameters, media types, and limits, and the API answers 400 to a request outside them. Images and video can use inline data or validated remote URLs. Audio uses inline data only. Set store to true to retain the completion. Account limits can further restrict output.

## Headers

- `munito-service-tier` 'priority' | 'standard' | 'flex'
- `munito-affinity` string
- `munito-overflow` 'off' | 'model' | 'class' | 'any'
- `prefer` 'respond-async'

## Request body

- object
  - `model` string, required: Model id from GET /models, e.g. `qwen/qwen3.8-27b`.
  - `messages` object[], required: OpenAI-style messages. Content can contain text and media parts when the selected model supports them: `image_url`, `video_url`, or `input_audio` for an audio model. An `input_audio` part holds base64 `data` and its `format` (`wav`, `mp3`, `flac`, `ogg`, `webm`, `m4a` or `mp4`), at most 30 seconds of audio, and up to 4 parts in one request. Send a longer recording to POST /audio/transcriptions.
    - `role` 'developer' | 'system' | 'user' | 'assistant' | 'tool'
    - `content` union
      - string
      - object[]: Content parts: `text`, `image_url`, `video_url`, `input_audio` or `file`.
  - `max_tokens` integer: Maximum tokens to generate. Omit it to allow the output maximum of the model. A larger value uses that maximum.
  - `temperature` number: Sampling temperature (0–2). Omit it to use the default of the model.
  - `stream` boolean: Stream tokens back as server-sent events.
  - `tools` object[]: OpenAI-style function tools the model may call (steer with `tool_choice`).
  - `store` boolean: Persist the completion for later retrieval via GET /chat/completions/{id}.

## Response `200`

An OpenAI-compatible chat completion.

## Other responses

- `202`: Accepted, when the request sends `Prefer: respond-async`. Poll the `location` until it finishes.

---

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