How to Estimate LLM API Costs (Claude, OpenAI, Gemini)
Understand how LLM API pricing works — input vs output tokens, per-million rates and caching — and how to estimate the cost of a Claude, OpenAI or Gemini call.
By the ToolsHub team · Updated August 21, 2026
Large language model APIs bill by the token, not by the request — and the rates differ sharply between input and output and between models. A few minutes of estimating up front saves surprises on the invoice.
How token pricing works
Every API call has two priced parts: the input (your prompt and context) and the output (the model's reply). Each is charged per token, usually quoted per million tokens, and output tokens are typically several times more expensive than input. So the cost of a call is roughly (input tokens × input rate) + (output tokens × output rate).
A worked example
A prompt of 2,000 input tokens and a 500-token reply, on a model priced at $3 per million input and $15 per million output, costs (2000 ÷ 1,000,000 × $3) + (500 ÷ 1,000,000 × $15) = $0.006 + $0.0075 ≈ $0.0135 per call. Multiply by your call volume and the monthly figure becomes clear.
Estimate it in seconds
Rather than doing this by hand, use the calculators: the Claude, OpenAI and Gemini cost calculators apply each provider's current rates, and the LLM API Pricing Calculator compares all three side by side so you can pick the most cost-effective model. Not sure how many tokens your text is? The Token Usage Calculator counts them and estimates the cost.
Ways to cut the bill
- Use a smaller, cheaper model where quality allows — the price gap between tiers is large.
- Trim the prompt and cap output length; output tokens cost the most.
- Use prompt caching for repeated context to get cached-input discounts.
Frequently asked questions
- How is LLM API pricing calculated?
- You're charged per token, separately for input (your prompt) and output (the model's reply), usually quoted per million tokens. Cost = (input tokens × input rate) + (output tokens × output rate). Output tokens are typically several times more expensive than input.
- How do I estimate the cost of a Claude or OpenAI call?
- Estimate the input and output token counts, then apply each model's per-token rates. The Claude, OpenAI and Gemini cost calculators do this for you — enter your token counts and pick the model.
- What is a token?
- A token is a chunk of text — roughly ¾ of a word in English, so about 750 words is 1,000 tokens. The Token Usage Calculator counts tokens in your text and estimates the cost.
- Does prompt caching reduce cost?
- Yes. Providers offer cached input tokens at a large discount when you reuse the same context, which can cut the bill significantly for repeated prompts.