responses

Count Input Tokens

Changed on

Count response input tokens.

Count the input tokens for a Responses request without generating a response. The count includes the supplied conversation, instructions, and tool definitions.

Use the same input, instructions, and tools that you plan to send when creating a response. For multi-turn conversations, include prior output items and function results in input.

post/v1/responses/input_tokens

Request

Request body

modelstring required
instructionsstring nullable
parallel_tool_callsboolean
previous_response_idunknown
truncation'disabled'
conversationunknown
promptunknown

Response

Successful Response

input_tokensinteger required
object'response.input_tokens' required

Changes