AI & information

Count API input tokens with the tools, not just the prompt text

The request includes message structure, files and tool schemas that a word count can miss.

GPT-6.1 Terra entered the API on 26 October 2026. When adapting a workflow to a different model, recheck the complete request size: the new model announcement does not make an old text-only estimate valid. The token-counting endpoint described below is an existing documented tool, not a feature announced today.

A short prompt can become a large API input when it includes conversation history, files and tool schemas. Dividing the visible characters by four is not a reliable way to establish the model’s actual input size.

Count the request you will send

OpenAI’s input-token counting endpoint accepts the Responses input format. Use the intended model and the same messages, tools, images or files as the real request. The documented count includes structural formatting that may not appear in the text you see.

For a small planned check, compare a plain-text request with the same task plus its real tool schema. Record the returned counts; do not invent a fixed overhead for every tool. If you subsequently change the payload, the earlier count no longer describes that request.

Keep input size separate from the bill

Use the count to check supported input and context limits and to plan routing. It is not a prediction of final output tokens, reasoning usage or tool-call charges. Read the model and endpoint’s current rules before treating a size estimate as a complete cost estimate. No API counting call was made for this article.

Use the exact model and payload supported by your endpoint and account. API availability and limits depend on the chosen model and permitted region; a ChatGPT subscription alone does not define them. Keep credentials out of prompts and examples.

Sources & further reading

  1. OpenAI API documentation
  2. OpenAI — API changelog, 26 October 2026

Sources support the technical explanations. Examples and suggested checks are editorial guidance.