Skip to content
mathbehind

AI Feature Cost Calculator

Estimate the monthly API bill for a chatbot or AI feature from your users and conversations, including the cost of re-sending chat history.

Your numbers

Prices and fees in this tool are in US dollars.

User messages, each followed by one AI reply.

tokens

Sent with every message. Include any documents you add as context.

tokens

About 45 words is 60 tokens.

tokens

Monthly API cost

$391.20

Cost per active user

$0.391

Cost per conversation
$0.0391
Input tokens per conversation
10,560
Output tokens per conversation
1,800
Conversations per month
10,000
Annual API cost
$4,694
The math behind it
  1. Input tokens

    6 × 800 + 6 × 60 + 360 × 6 × 5 ÷ 2equals10,560

  2. Output tokens

    6 × 300equals1,800

  3. Per conversation

    10,560 ÷ 1M × $2.00 + 1,800 ÷ 1M × $10.00equals$0.0391

  4. Per month

    $0.0391 × 10,000 conversationsequals$391.20

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.

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.

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.