Input tokens
All tokens the model receives before replying, including hidden instructions, chat history, documents, examples, and tool definitions.
See it
What it is
Input tokens are every token supplied to the model before it generates the next answer. That includes system instructions, the user message, chat history, retrieved documents, examples, and serialized tool definitions. They share the context window with the output room you reserve for the reply.
Track them when estimating request cost, latency, cache savings, and how close a request is to its limit. In a multi-turn chat, earlier messages usually become input again on every later turn, so the input count and bill grow even when the newest user message is only a sentence.
Gotcha: the visible prompt is not the whole input. Application instructions, tool schemas, formatting wrappers, and retrieved text can outweigh what the user typed. Cached input may receive different pricing but still needs to be counted, so use the API's returned usage numbers as the billing record and local tokenization as a preflight estimate.
Ask AI for it
Instrument this OpenAI Responses API wrapper to account for input tokens. Before each call, count the exact serialized instructions, messages, tool schemas, and retrieved text with tiktoken and record each category. After the call, read response.usage.input_tokens and response.usage.output_tokens, store the estimate-versus-actual delta, and emit a warning above 80 percent of the configured context limit. Add a per-conversation chart showing input growth by turn and a test that proves old history, system instructions, and tools are included even when the newest user message is short.