What AI costs

Play this lesson

Who pays for the AI?

Kai wants Nova, the space crystal in Hyper Shards, to give a short tip after each lost wave, written by Claude from how the run went. Remy asks the real question: what will that cost with 10,000 players? Every AI answer runs on powerful computers in a data centre, and somebody pays for each one.

Tokens: how AI is measured

AI models don't read letters or whole words. They read tokens: small chunks of text, often a word or a piece of one. A common word might be one token, a rare one three.

Anthropic's rough guide: in English, 1 token is about 4 characters, or three quarters of a word. So 1,000 words is roughly 1,300 tokens. Code, other languages and newer models can use more, and the exact count varies.

API prices are written per million tokens, shortened to MTok.

Quick check

Using Anthropic's rough guide (1 token is about three quarters of a word), about how many tokens is a 300-word Garden Defense design note?

  1. About 40
  2. About 400
  3. About 4,000
Show the answer

About 400

Each token is about three quarters of a word, so 300 words is about 300 ÷ 0.75 = 400 tokens. It is only a rough guide, and the real count depends on the text.

Input, output and model size

Every request has input tokens, everything we send (instructions, the conversation, files), and output tokens, what the model writes back. Output costs more. At the time of writing, Claude Opus 5.5 on the API costs US$4 per million input tokens and US$20 per million output tokens.

Bigger models cost more per token. Anthropic's own advice: Haiku for simple jobs, Sonnet for most work, Opus for the hardest reasoning. Jobs that can wait, like translating 500 store descriptions overnight, can use the Batch API at half price. Prices change, so always check claude.com/pricing.

Why long chats cost more

The API keeps no memory between requests. Each new message sends the whole conversation so far as input again, plus every file in it. All of that is the context window, the model's working memory.

So message 50 re-sends the 49 before it, and a big file pasted early is read again every turn. Prompt caching helps: when the start of a request matches one from the last few minutes, the API reuses it. At the time of writing, a cache hit costs a tenth of the normal input price or less. Very long contexts also make answers less accurate.

Cut the cost

#studio-chat, Remy
Claude Code and I have used the same chat since Monday, and I paste all 3,000 lines of game.js in every morning. Why do we hit our usage limit by lunch?

What is the best advice for Remy?

  1. Start a fresh chat for each task, and let Claude read only the files that task needs
  2. Paste game.js twice so Claude remembers it better
  3. Switch to the biggest model, because it reads faster
Show the answer

Start a fresh chat for each task, and let Claude read only the files that task needs

Every message re-sends the whole conversation, so a days-long chat with a pasted 3,000-line file re-reads all of it on each turn. A fresh, focused context costs far less and often gives better answers.

The runaway loop

The classic surprise bill is a runaway loop: code that calls the API again and again by mistake. Nova's tip code retries a failed request instantly, forever. Or an agent keeps "fixing" the same failing test all night. Each call costs tokens, and a computer can make thousands an hour.

So in the Claude Console, a parent sets a monthly spend limit: once reached, requests stop until next month. Each workspace can also get a lower limit, an email at a chosen amount, and rate limits on requests and tokens per minute. Unlike a Firebase budget alert, a spend limit really stops spending.

Do the maths: Nova's tips

An example with made-up round numbers. Real prices differ, so check the current price before planning. Say each tip sends 2,000 input tokens and gets 200 output tokens back, on a model that costs $1 per million input tokens and $5 per million output tokens.

One tip costs about $0.003. If 10,000 players see 10 tips a day, that's 100,000 tips, or $300 a day, about $9,000 a month.

Read the numbers

nova-tips-plan.txt
Hyper Shards, Nova tips (example numbers) AI cost per tip            $0.003Tips per player per day    10Days played in first month 30Price of Hyper Shards      $5, paid once

How much does one player's first month of Nova tips cost the studio, and what does that mean?

  1. $0.90, a big slice of a $5 sale, and it keeps growing for as long as they play
  2. $0.03, too small to matter
  3. Nothing, because the player already paid $5
Show the answer

$0.90, a big slice of a $5 sale, and it keeps growing for as long as they play

$0.003 x 10 x 30 = $0.90, almost a fifth of the price before payment fees. A pay-once player who plays all year keeps costing money with no new revenue. Fixes: fewer tips, a smaller model, caching, or a daily cap.

Pictures, video and music

Image, video and music generators are priced their own way. Google's price list for its AI models, for example, works out image prices per picture (a 4K image costs more than a small one), video per second, and music per song or clip.

Whatever the tool, the business question is the same: what does AI cost per player or per feature, and does that feature earn more than it costs? The Stage 6 money lessons and unit economics in Stage 10 use exactly this maths, together with the cloud bill from the costs lesson.

Bolt says: Before an AI feature ships, write down three numbers: tokens per use, uses per player, and the price per million tokens. Next: putting AI inside the game, safely.

Fact-checked 9 October 2026