Input and output tokens are often billed at different rates, so the total number of tokens alone is not enough to estimate an LLM API bill . To calculate the cost of a request, multiply input tokens by the input rate, output tokens by the output rate, then add any applicable cached-input or other usage charges.
The exact rates depend on the provider, model, service tier, and billing conditions. OpenAI, Anthropic, and Google publish pricing tables that distinguish input from output and document additional pricing rules for features such as caching or tools. Check the OpenAI API pricing page , Anthropic Claude pricing , or Gemini API pricing for the model and tier you actually use.
The short version
Input tokens are the tokens the model receives, including relevant instructions, conversation history, retrieved text, and the current user message.
Output tokens are the tokens the model generates.…