LLM Token Cost Calculator
Model pricing is quoted per million tokens and input almost always costs less than output. Enter the two prices from whichever provider you use.
How the math works
Cost = (input tokens / 1,000,000) x input price + (output tokens / 1,000,000) x output price. Cached input is billed here at 10 percent of the normal input rate, which is the common industry discount. Check your provider, since a few differ.
Common questions
- Why does output cost more than input?
- Input is processed in parallel in a single pass, while output is generated one token at a time, each pass depending on the last. That sequential work is what the higher price reflects, often by four or five times.
- How do I reduce API costs?
- In order of effect: cap the output length, cache the parts of the prompt that never change, drop to a smaller model for simple steps, and trim conversation history. Output length is usually the largest single lever.
- What is prompt caching?
- Providers can store the processed form of a prompt prefix, so a repeated system prompt or document is not reprocessed. Reads typically bill at around a tenth of the input rate, which makes it very effective for long fixed prefixes.