Count tokens in a Message
Count tokens in a Message
Request
This endpoint expects an object.
model
Model identifier or alias.
messages
Conversation messages for the request.
system
System prompt input. Accepts str, list[str], System, list[System], or null. It is normalized internally to list[System].
tools
Optional tool definitions.
thinking
Thinking configuration.
tool_choice
Tool selection policy.
output_config
Optional output configuration options.
cache_control
Optional request-level cache control.
Response
This endpoint returns an object.
input_tokens
Estimated number of input tokens for the provided payload.
Errors
401
Unauthorized
422
Unprocessable Entity

