Lesson 11 of 12 · Using It Well
Costs and Limits
How generative AI is paid for: free tiers, subscriptions and per-token APIs, input vs output pricing, why long chats cost more, rate limits and a calculator.
- 7 min read
- Beginner
- Reviewed
- The two main ways people pay for AI: subscriptions and pay-per-token APIs
- How to estimate the cost of a task from its tokens
- Why long conversations cost more than you expect
- The limits you will run into, and what to do about them
Two ways to pay
Chat apps (the assistants you use in a browser or phone) usually have:
- a free tier, with a limited number of messages or a less capable model;
- paid plans at a fixed monthly price, with higher limits and the best models;
- team and enterprise plans, with admin controls and stronger privacy terms for work data.
APIs are for developers building AI into their own apps and tools. Instead of a monthly fee, you pay for exactly what you use, measured in tokens.
Paying per token
Prices are quoted per million tokens. A million tokens is roughly 750,000 English words, about ten novels. Bigger, more capable models cost more per token, sometimes 20 times more or even higher than the smallest ones.
The same calculation in Python, so you can change the numbers:
# Example prices in dollars per million tokens (real prices vary by model and change often)
price_input = 3.00
price_output = 15.00
emails = 1000
input_tokens_each = 500 # the email plus your instructions
output_tokens_each = 200 # the reply the model writes
input_tokens = emails * input_tokens_each
output_tokens = emails * output_tokens_each
input_cost = input_tokens / 1_000_000 * price_input
output_cost = output_tokens / 1_000_000 * price_output
print(f"Input: {input_tokens:,} tokens -> ${input_cost:.2f}")
print(f"Output: {output_tokens:,} tokens -> ${output_cost:.2f}")
print(f"Total: ${input_cost + output_cost:.2f}")Notice that output is the bigger cost here, even though there are fewer output tokens. Asking for shorter answers is one of the easiest ways to save money.
Why long conversations get expensive
A model has no memory between requests. To continue a chat, the app sends the whole conversation so far with every new message. So each turn costs more than the last.
message_tokens = 100 # each message you type
reply_tokens = 300 # each reply
history = 0
total_input = 0
for turn in range(1, 11):
sent = history + message_tokens # the whole conversation is sent again
total_input += sent
history = sent + reply_tokens
if turn in (1, 2, 5, 10):
print(f"Turn {turn}: {sent:,} input tokens")
print(f"Total input over 10 turns: {total_input:,} tokens")
print(f"Your own messages were only {10 * message_tokens:,} tokens")Ten short messages cost 19 times more input than their own length, because the history is re-sent each time. This is one more reason to start a fresh conversation for a new topic.
The limits you will meet
| Limit | What it means | What to do |
|---|---|---|
| Usage caps in chat apps | A number of messages per few hours or per week | Wait for the reset, use a smaller model, or upgrade |
| Rate limits on APIs | Requests or tokens per minute | Slow down, wait and retry, or ask for a higher limit |
| Context window | Maximum tokens per request | Shorten the input, split documents, start a new chat |
| Maximum output | Longest answer per request | Ask for the answer in parts |
| File limits | Size and number of uploads | Split or compress files, paste only the relevant part |
| Knowledge cutoff | No knowledge after a date | Use search, or paste current information |
| Usage policies | Things the provider does not allow | Read the policy; the model will decline those requests |
Common mistakes
Estimate the running cost of a small chatbot that uses a cheap model.
requests_per_day = 2000 input_tokens_each = 800 output_tokens_each = 300 price_input = 0.50 # dollars per million input tokens price_output = 2.00 # dollars per million output tokens # Work out the daily cost and the cost for 30 days. Print exactly: # Daily cost: $2.00 # Monthly cost: $60.00
Why does each new message in a long chat cost more than the one before?
Summary
- Chat apps use free tiers and subscriptions; APIs charge per token, quoted per million.
- Output tokens usually cost several times more than input tokens; bigger models cost more per token.
- Cost = tokens / 1,000,000 × price, for input and output separately.
- Long conversations re-send their history, so costs grow every turn. Caching and batch processing help.
- Expect usage caps, rate limits, context and output limits, and set spending limits on APIs.
Next: using AI responsibly, safely and fairly.
Finished reading? Tick it off to track your progress.