Skip to Content

Chat completion

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.

POST
/chat/completions

Authorization

headerAuthorizationBearer <token>

Your Munito API key.

Header Parameters

munito-service-tier?string

priority, standard or flex. The response names the tier that is billed; see x-ratelimit-over-limit. See Service tiers.

Default"standard"
Value in"priority""standard""flex"
munito-affinity?string

An opaque token. Send it back with the next request of the conversation, so that the prompt cache can serve it. Without it, the API uses prompt_cache_key, x-session-affinity or user, or metadata.user_id on the Messages API, for the same purpose.

munito-overflow?string

off, model, class or any: what may serve a chat request that its own capacity refuses. The response names the step that served it. Off by default. The request keeps its region, and you pay the price of the model that you asked for. Flex, background and free-tier requests do not overflow.

Default"off"
Value in"off""model""class""any"
munito-prompt-cache-isolation-key?string

A secret string of up to 256 characters. Requests with different keys never share the prompt cache. The body field prompt_cache_isolation_key does the same. See Prompt caching.

Lengthlength <= 256
prefer?"respond-async"

respond-async: answer 202 at once. Then poll the location until the request finishes.

Value in"respond-async"

Request Body

application/json
  1. body
model*string

Model id from GET /models, e.g. qwen/qwen3.8-27b.

messages*array<>

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.

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.

Defaultfalse
tools?array<>

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}.

Defaultfalse
prompt_cache_isolation_key?string

A secret key. Requests with different keys never share the prompt cache. See Prompt caching.

Lengthlength <= 256

Response Body

An OpenAI-compatible chat completion.

application/json
curl -X POST 'https://api.munito.ai/inference/v1/chat/completions' \
  -H 'Content-Type: application/json' \
  -d '{
  "model": "qwen/qwen3.8-27b",
  "messages": [
    {
      "role": "user",
      "content": "Explain intelligence sovereignty in one sentence."
    }
  ],
  "max_tokens": 512
}'
Example Response
{
  "id": "chatcmpl-7f3c1a",
  "object": "chat.completion",
  "model": "qwen/qwen3.8-27b",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Intelligence sovereignty is the ability to run, govern, and improve your own AI on infrastructure you control, with no foreign cloud in the loop."
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 18,
    "completion_tokens": 34,
    "total_tokens": 52
  }
}