🧮 Machines That Talk · Day 11

The AI Cash Register

This is your money superpower. Paste any prompt, add documents, pick a model, and this register tells you exactly what one call costs — and what 1,000 calls cost. After today you can price ANY chatbot or feature.

↓ open the register
🧮 Lab · The Full Cost Calculator

Add up every piece of a real AI call

A real request is more than your question. It bundles the system prompt, your message, any documents, and reserves room for the answer. Every piece is billable input (except the answer, which is output). Edit anything — the register updates live.

250
1
💡 One call looks cheap. Multiply by how many users or steps and it gets real — this is how a "free" feature can cost a company thousands.
🐞 Break-It Challenge

The document that blows the budget

Stuffing a giant document into every call is the #1 way people accidentally spend a fortune. Tap to jam ~8,000 tokens of "reference" into the doc box, then watch the register — and check if it even fits the model.

Watch two things: (1) the cost jumps because those doc tokens are billed on every single call, and (2) if input + answer is bigger than the model's context window, it won't even fit. Only include the parts you actually need.
🏷️ The pro wordYour total billable input = system + user + documents + any retrieved context. The register runs the real formula for each: tokens × price ÷ 1,000,000. Prices are quoted per million tokens, and input & output have different rates. Multiply one call by your number of requests to get the real monthly bill.

⚠️ Two gotchas: in real apps your billable input also includes hidden tokens you never typed — the system prompt, the whole chat history, tool descriptions, and formatting wrappers. And "expected answer length" is a cap (max_tokens), not a promise — you're only charged for what the model actually writes. This register is a preflight estimate; the API's usage report is the final truth.
🎯 Boss Build · Price the Feature

You're the engineer — quote it

Your app will run the current call 10,000 times a day. Your boss says keep it under $5/day. Pick the cheapest model that (a) fits the call in its context window and (b) stays under budget. Get it right to win!

pick a model above, then submit
🚀 Beyond the Basics

How the pros really do it

Your register is the real thing. Pros then add these money levers on top:

🧮

Estimate before (what you built)

Count tokens × price to predict cost. ✅ Plan budgets up front. ⚠️ It's an estimate until the call runs.

💾

Cache the repeats (save 50–90%)

Reuse an unchanged prompt prefix at a discount. ✅ Huge savings on repeated system prompts/docs. ⚠️ Needs stable prefixes.

🐢

Batch & downshift (the pro move)

Non-urgent jobs run cheaper in batches or on smaller models. ✅ Big discounts. ⚠️ Slower or slightly less capable.

🏷️ Pro names to look upLevers: prompt caching, batch API, model routing, and setting a max_tokens cap on the answer. Every response reports a usage object so you can track spend for real.

🎉 Day 11 Complete!

You built the AI Cash Register. You can now price any AI call: add up system + message + documents for input, add the expected output, run each side through tokens × price ÷ 1,000,000, and multiply by how often it runs. That's a real professional skill.

Day 12: The Long-Chat Snowball →
Tomorrow: we point the register at a whole conversation and watch the total snowball turn by turn. ☃️
AI Adventure · Machines That Talk · Day 11 — made for young inventors 🚀