How to use the AI token cost calculator
Pick a provider and model, then tell the calculator how much text moves in each direction. You can enter token counts directly (typing shorthand like 100k or 1.5m works too), or switch to "Paste text" and drop in a sample prompt and answer to get an automatic token estimate. Set how many requests you expect per month and the tool projects the running bill. Turn on "Compare another model" to see a second model's cost next to the first, useful when you're deciding between a flagship and a cheaper option. Every number updates live, and the whole thing runs on your device. Nothing you paste is uploaded. If you want an exact token count for your actual text first, including real tiktoken-equivalent counts for OpenAI models, try the token counter, then use its "see what this costs to run" link to bring the count straight back here.
Comparing API cost across providers
OpenAI, Anthropic, Google, Meta, Mistral, DeepSeek, and xAI all price by the token, but the absolute rates and the input/output spread vary a lot between them, and between models from the same provider. A flagship reasoning model from one vendor can cost ten times more per million tokens than a small, fast model from another, for tasks where the smaller model is perfectly adequate. This hub calculator lets you switch providers and models in the same view so you can shop the whole market at once. If you already know which provider you're using, the dedicated calculators below skip the provider picker and go straight to that vendor's model lineup and cost-cutting notes:
- OpenAI (ChatGPT/GPT) API pricing calculator
- Anthropic Claude API pricing calculator
- Google Gemini API pricing calculator
- Meta Llama API pricing calculator
- Mistral API pricing calculator
- DeepSeek API pricing calculator
- xAI Grok API pricing calculator
Input tokens vs output tokens
Language model APIs bill in two directions. Input tokens are everything you send: the system prompt, instructions, examples, and the user's message. Output tokens are what the model generates back. These are priced separately, and output almost always costs more, frequently three to five times the input rate, because generating text is more expensive than reading it. That asymmetry matters: a task with short prompts and long answers (like drafting) is dominated by output cost, while a task with huge context and short answers (like classification over documents) is dominated by input cost.
How token estimation works here
When you paste text, the calculator estimates tokens per-model rather than applying one heuristic across the board. Most estimate-lane models split at roughly four characters per token (about 1.33 tokens per word for English), and that's the default here. Anthropic's newer tokenizer (Opus 4.7+, Fable 5, Sonnet 5) is the one confirmed exception: it runs about 30% denser, so this calculator estimates those Claude models at roughly 3.1 characters per token instead of 4, so a Sonnet 5 estimate doesn't quietly undercount next to a Haiku 4.5 one. This is close enough for budgeting but not exact; real tokenizers split code, punctuation, numbers, and non-English scripts differently. For a precise count, use the provider's official tokenizer, or the exact BPE counts this site's token counter runs client-side for OpenAI models; for planning a monthly bill, the per-model estimate is fine.
A worked example
Say you send a 1,000-token prompt and get a 500-token answer on a model priced at $2.50 input and $10.00 output per million tokens. Input costs 1,000 ÷ 1,000,000 × $2.50 = $0.0025. Output costs 500 ÷ 1,000,000 × $10.00 = $0.005. That's $0.0075 per call, and at 100,000 calls a month, $750. Drop to a mini model at a tenth of the price and the same volume costs $75. That single swap is usually the biggest lever you have. Use the compare toggle above to see it side by side before you commit.
Cutting your bill
The highest-impact moves are choosing the smallest model that still meets your quality bar, trimming system prompts and few-shot examples you no longer need, capping maximum output length, and caching or reusing context that repeats across calls. Measure before optimizing: run this calculator on your real average prompt and response sizes rather than guessing, because the shape of your traffic decides which lever pays off. Compare a few models side by side using the same token counts to see the trade-off between price and capability before you commit.