Per-token prices look tiny, but a chat feature multiplies them in a way that is easy to miss: every message re-sends the whole conversation so far. This calculator models that growth, so you can price an AI feature before the first invoice arrives.
Figures checked by Muhammad Ahmad against OpenAI API pricing, Claude API pricing and Gemini API pricing. Prices and rules change, so confirm with the official source before relying on them. How we check the math
How it works
Each message sends the system prompt, the new user message and, in a normal chat, every earlier message and reply. So the input for message 6 includes messages 1 to 5 and their replies.
For m messages, total input tokens are m × system + m × user + (user + reply) × m(m − 1) ÷ 2. The last term is the chat history, and it grows with the square of conversation length.
Cost is input tokens ÷ 1,000,000 × the model's input price, plus output tokens ÷ 1,000,000 × its output price. Prices come from the same verified dataset as the AI API Cost Calculator.
A worked example
A 6-message chat with an 800-token system prompt, 60-token messages and 300-token replies uses 10,560 input tokens and 1,800 output tokens. On Claude Sonnet 5 ($2 in, $10 out per million), that is $0.0391 per conversation. At 1,000 users having 10 conversations a month, the bill is $391.20 a month, or $0.39 per user.
More examples
The default chatbot workload, 10,000 conversations a month, costs $391.20 on Claude Sonnet 5 or GPT-6 Sol, and $19.56 on GPT-6 Luna.
Sending no history (one-off requests) cuts input from 10,560 to 5,160 tokens per conversation, and the Sonnet 5 bill from $391.20 to $283.20.
Common mistakes
- Leaving out conversation history, which is resent with every message.
- Pricing on average users when heavy users drive most of the cost.
- Forgetting reasoning tokens, billed as output on models that think.
- Not rechecking after model price changes, which were frequent in 2026.
Questions people ask
Why does conversation length matter so much?
Because history is re-sent with every message, a 12-message chat costs much more than twice a 6-message chat. Capping history, summarizing older turns, or starting fresh conversations keeps costs predictable.
Does prompt caching change the result?
Yes. Most providers now discount repeated input such as a long system prompt when it is cached. This calculator uses standard prices, so treat the result as an upper estimate if you use caching.
How do I count tokens?
In English, one token is roughly three quarters of a word, so 100 words is about 133 tokens. Use the Token and Word Count Converter to translate your own prompt lengths.
How much does it cost to run an AI chatbot?
Multiply the tokens in an average conversation by the model's prices, then by conversations per month. Long conversations cost far more than short ones, because the whole history is resent with every message.
How can I reduce the cost of an AI feature?
Cache the fixed system prompt, trim or summarise long chat histories, route simple requests to a smaller model, and set sensible limits on conversation length or messages per user.
Guides
- AI API Pricing in 2027: What's Likely to Change, and WhenFrontier model pricing fell 50-80% through 2026. 2027 will keep cutting prices on commodity-tier models while top-tier reasoning models hold or raise their rates.
- SaaS Pricing Trends 2027: Usage, AI Add-Ons and the Death of Per-SeatPer-seat pricing is losing ground to usage-based tiers in 2027. AI feature upsells are the single largest growth lever for mature SaaS, and MoR models are becoming default for cross-border sellers.
- Why AI Agents Cost More Than You Expect (and How to Cut the Bill)An agent re-sends a growing pile of context on every step, so doubling the steps roughly triples the cost. Here's the math, and the four levers that bring it down.
- How to Estimate and Reduce LLM API CostsAPI bills come from input and output tokens priced separately. With three numbers per request you can estimate a monthly bill and compare models before writing any code.
- How to Price an AI Feature So It Stays ProfitableStart from cost per active user, not cost per token. Here's how to estimate it, including chat history, and turn it into a price with a healthy margin.
- How Much Does an AI Chatbot Cost? GPT vs Claude vs GeminiEvery new message in a chat resends the whole conversation as input. That makes long conversations much more expensive than the sum of their messages.