Responses

Get input token counts

Changed on

Returns input token counts of the request.

Returns an object with object set to response.input_tokens and an input_tokens count.

post/responses/input_tokens

Request

  • Base URL
    https://api.openai.com/v1
  • URL
    https://api.openai.com/v1/responses/input_tokens
  • Auth
    HTTP bearer

Request body

modelstring nullable

Model ID used to generate the response, like gpt-4o or o3. OpenAI offers a wide range of models with different capabilities, performance characteristics, and price points. Refer to the model guide to browse and compare available models.

previous_response_idstring nullable

The unique ID of the previous response to the model. Use this to create multi-turn conversations. Learn more about conversation state. Cannot be used in conjunction with conversation.

truncation'auto' | 'disabled'
instructionsstring nullable

A system (or developer) message inserted into the model's context. When used along with previous_response_id, the instructions from a previous response will not be carried over to the next response. This makes it simple to swap out system (or developer) messages in new responses.

parallel_tool_callsboolean nullable

Whether to allow the model to run tool calls in parallel.

Response

Success

object'response.input_tokens' required
input_tokensinteger required

Example response

{
  "object": "response.input_tokens",
  "input_tokens": 123
}

Changes

    • info

      added the new optional request property //////////

    • info

      added the new optional request property //////////

    • info

      added the new optional request property //////////

    • info

      added the new optional request property //////////

    • info

      added the new optional request property //////////

    • info

      added the new optional request property //////////

    • info

      added the new optional request property ///////////

    • info

      added the new optional request property ///////////

    • info

      added the new optional request property ///////////

    • info

      the request property default value changed from gpt-image-1 to gpt-image-2

    • info

      the request property default value changed from gpt-image-1 to gpt-image-2

    • info

      the request property default value changed from gpt-image-1 to gpt-image-2