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
messagesand the system prompt insystem. - Set
stream: truefor Anthropic SSE events. A complete stream ends withmessage_stop. An incomplete stream ends with anerrorevent. - Use
toolsandtool_choicefor tool calls. Reasoning models can returnthinkingcontent blocks. - Set
thinkingto turn reasoning on (enabledoradaptive) or off (disabled). The API validatesbudget_tokensbut does not enforce it.max_tokensbounds the whole answer. - The API accepts
cache_control,service_tierandspeed: "standard", and they change nothing: it caches each prompt prefix, and themunito-service-tierheader 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.
AuthorizationBearer <token>Your Munito API key.
munito-service-tier?stringpriority, standard or flex. The response names the tier that is billed; see x-ratelimit-over-limit. See Service tiers.
"standard""priority""standard""flex"munito-affinity?stringAn 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?stringoff, 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.
"off""off""model""class""any"munito-prompt-cache-isolation-key?stringA 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.
length <= 256application/json- body
model*stringModel id from GET /models, e.g. qwen/qwen3.8-27b.
messages*array<>The conversation as Anthropic-style messages: content is a string or an array of content blocks.
max_tokens*integerMaximum tokens to generate. Required. Clamped to the model's output maximum.
system?|array<>System prompt (top-level, Anthropic-style): a string or an array of text blocks.
stream?booleanStream Anthropic SSE events (message_start … message_stop).
falsetools?array<>Anthropic-style tools the model may call (steer with tool_choice).
An Anthropic-compatible message.
application/jsoncurl -X POST 'https://api.munito.ai/inference/v1/messages' \
-H 'Content-Type: application/json' \
-d '{
"model": "qwen/qwen3.8-27b",
"max_tokens": 512,
"messages": [
{
"role": "user",
"content": "Explain intelligence sovereignty in one sentence."
}
]
}'{
"id": "msg_7f3c1a",
"type": "message",
"role": "assistant",
"model": "qwen/qwen3.8-27b",
"content": [
{
"type": "text",
"text": "Intelligence sovereignty is the ability to run, govern, and improve your own AI on infrastructure you control, with no foreign cloud in the loop."
}
],
"stop_reason": "end_turn",
"usage": {
"input_tokens": 18,
"output_tokens": 34
}
}List chat completion messages GET
Lists the request messages of a completion that was created with store: true, in the order of the request by default.
Count tokens POST
Count the input tokens a Messages request would consume, without running it. Same request shape as POST /messages (minus max_tokens); free.