Messages
Count tokens
Count the input tokens a Messages request would consume, without running it. Same request shape as POST /messages (minus max_tokens); free.
post/messages/count_tokens
Request
- Base URLhttps://api.munito.ai/inference/v1
- URLhttps://api.munito.ai/inference/v1/messages/count_tokens
- Auth
- HTTP bearer
- or API key in header x-api-key
Headers
munito-service-tier'priority' | 'standard' | 'flex'
priority, standard or flex. The response names the tier that is billed; see x-ratelimit-over-limit. See Service tiers.
munito-affinitystring
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.
Request body
Example request
{
"model": "qwen/qwen3.8-27b"
}Response
The input-token count.
Changes
No recorded changes to this operation across all 1 revision of this API.