---
title: "Create a message"
method: POST
path: "/messages"
tags: ["Messages"]
---

# Create a message

`POST /messages`

## Request

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

Generate a response with the Anthropic Messages API. The Anthropic SDK uses your Munito key through `X-API-Key`. Set its base URL to `https://api.munito.ai/inference`.

- Send the conversation in `messages` and the system prompt in `system`.
- Set `stream: true` for Anthropic SSE events.
- Use `tools` and `tool_choice` for tool calls. Reasoning models can return `thinking` content blocks.
- Set `thinking` to turn reasoning on (`enabled` or `adaptive`) or off (`disabled`). The API validates `budget_tokens` but does not enforce it. `max_tokens` bounds the whole answer.
- The API accepts `cache_control`, `service_tier` and `speed: "standard"`, and they change nothing: it caches each prompt prefix, and the `munito-service-tier` header selects the tier. `speed: "fast"` is not available.

The API requires `max_tokens`. Values above the model's output maximum use that maximum. A response that reaches the cap returns `stop_reason: "max_tokens"`.

Requests are stateless and billed per token. Use `/messages/count_tokens` to count input tokens without inference.

## Headers

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

## Request body

- object
  - `model` string, required: Model id from GET /models, e.g. `qwen/qwen3.8-27b`.
  - `messages` object[], required: The conversation as Anthropic-style messages: `content` is a string or an array of content blocks.
    - `role` 'user' | 'assistant'
    - `content` union
      - string
      - object[]: Content blocks: `text`, `image`, `tool_use`, `tool_result` and `thinking`.
  - `max_tokens` integer, required: Maximum tokens to generate. Required. Clamped to the model's output maximum.
  - `system` union: System prompt (top-level, Anthropic-style): a string or an array of `text` blocks.
    - string
    - object[]: `text` blocks.
  - `stream` boolean: Stream Anthropic SSE events (message_start … message_stop).
  - `tools` object[]: Anthropic-style tools the model may call (steer with `tool_choice`).

## Response `200`

An Anthropic-compatible message.

---

[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)
