12 Nov 2026
AI API pricing explained: tokens, input vs output and how to spend less
How LLM APIs charge you, how to estimate a monthly bill, and practical ways to cut costs without hurting quality.
AI APIs from companies like OpenAI, Anthropic, Google and many open-model hosts all charge in a similar way. Once you understand tokens, the bills stop being a surprise.
What is a token?
A token is a small piece of text — roughly three quarters of an English word on average. "Hosting is cheap" is about four tokens. Code, other languages and unusual words can use more.
Input and output are priced separately
- Input tokens: everything you send — the system prompt, the chat history, documents.
- Output tokens: what the model writes back.
Output is usually several times more expensive than input. Prices are normally shown per million tokens.
Estimating a monthly bill
- Measure a typical request: input tokens + output tokens.
- Multiply by the number of requests per day, then by 30.
- Multiply by the provider's prices.
Most providers show token counts in their API responses, so you can measure real traffic instead of guessing.
Ways to spend less
- Pick the smallest model that does the job. Small and fast models handle classification, extraction and simple chat very well.
- Shorten the context. Don't resend the whole conversation forever; summarise old messages.
- Use prompt caching where the provider offers it — repeated long instructions get cheaper.
- Use batch processing for work that doesn't need an instant answer; many providers discount it.
- Limit output length with a maximum token setting.
- Cache answers to identical questions in your own database.
Choosing a provider
Compare quality on your own tasks, price per million tokens, speed, rate limits, data-privacy terms and whether there is a free tier for testing. Our AI API providers page lists the main options.