Count the input tokens a Messages request would consume, without running it. Same request shape as POST /messages (minus max_tokens); free.
POST
header
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.
Default
"standard"Value in
"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.
application/json- body
model*stringModel id from GET /models.
messages*array<>The conversation as Anthropic-style messages: content is a string or an array of content blocks.
system?|array<>System prompt (top-level, Anthropic-style): a string or an array of text blocks.
The input-token count.
application/jsoncurl -X POST 'https://api.munito.ai/inference/v1/messages/count_tokens' \
-H 'Content-Type: application/json' \
-d '{
"model": "qwen/qwen3.8-27b",
"messages": [
{
"role": "user",
"content": "Explain intelligence sovereignty in one sentence."
}
]
}'Example Response200
{
"input_tokens": 18
}