How AI token pricing works
Short answer
Most AI APIs charge per token, not per request. You pay for the tokens you send (input) plus the tokens the model generates (output), usually at different rates, with output often more expensive. Cost scales with how much text moves in and out.
You pay per token
AI APIs are billed by the token rather than per call. The cost of a request is the number of input tokens plus output tokens, each multiplied by its price. Since a token is roughly four characters of English, long prompts and long answers both add up. See What is a token in AI language models?.
Input and output are priced separately
- Input tokens: everything you send, including system instructions and context
- Output tokens: everything the model generates in reply
- Output usually costs more per token than input
- Rates vary by model and provider, so the same text costs different amounts on different models
Ways to reduce cost
- Trim unnecessary context from the prompt
- Ask for shorter output when you do not need length
- Reuse cached or summarized context instead of resending everything
- Pick a smaller model when the task does not need the largest one