SpyBara
Go Premium

cli/resources/responses/subresources/input_tokens/index.md 2026-07-10 23:02 UTC to 2026-07-12 06:58 UTC

3 added, 1 removed.

2026
Wed 29 15:02 Sat 25 05:59 Thu 23 18:00 Wed 22 20:02 Mon 20 20:00 Fri 17 17:00 Thu 16 20:57 Wed 15 02:58 Tue 14 06:58 Mon 13 15:59 Sun 12 06:58 Fri 10 23:02 Thu 9 20:58 Tue 7 08:02

Input Tokens

Get input token counts

$ openai responses:input-tokens count

post /responses/input_tokens

Returns input token counts of the request.

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

Parameters

  • --conversation: optional string or ResponseConversationParam

    The conversation that this response belongs to. Items from this conversation are prepended to input_items for this response request. Input items and output items from this response are automatically added to this conversation after this response completes.

  • --input: optional string or array of ResponseInputItem

    Text, image, or file inputs to the model, used to generate a response

  • --instructions: optional string

    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.

  • --model: optional string

    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.

  • --parallel-tool-calls: optional boolean

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

  • --personality: optional string or "friendly" or "pragmatic"

    A model-owned style preset to apply to this request. Omit this parameter to use the model's default style. Supported values may expand over time. Values must be at most 64 characters.

  • --previous-response-id: optional string

    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.

  • --reasoning: optional object { context, effort, generate_summary, 2 more }

    gpt-5 and o-series models only Configuration options for reasoning models.

  • --text: optional object { format, verbosity }

    Configuration options for a text response from the model. Can be plain text or structured JSON data. Learn more:

  • --tool-choice: optional ToolChoiceOptions or ToolChoiceAllowed or ToolChoiceTypes or 6 more

    Controls which tool the model should use, if any.

  • --tool: optional array of Tool

    An array of tools the model may call while generating a response. You can specify which tool to use by setting the tool_choice parameter.

  • --truncation: optional "auto" or "disabled"

    The truncation strategy to use for the model response. - auto: If the input to this Response exceeds the model's context window size, the model will truncate the response to fit the context window by dropping items from the beginning of the conversation. - disabled (default): If the input size will exceed the context window size for a model, the request will fail with a 400 error.

Returns

  • InputTokenCountResponse: object { input_tokens, object }

    • input_tokens: number

    • object: "response.input_tokens"

Example

openai responses:input-tokens count \
  --api-key 'My API Key'

Response

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