Block VII · What it costs and what suits you · Lesson 36
API prices: how to pay much less
You'll learn the techniques that cut API costs the most: prompt caching, batch processing at a 50% discount, sending easy tasks to cheap models and comparing providers from a single place.
- 11 min
- 9 animated slides
- 4-question quiz
- Narrated in 6 languages
What you'll see in this lesson
- Where the money goes in the API
You pay for every input and output token in every call, and most of it is usually text you send again and again.
- Prompt caching: pay once for what you repeat
If the start of the prompt is identical across several calls, the provider stores it and charges you a fraction of the price.
- How it works at OpenAI, Anthropic and Google
All three offer caching with discounts of 90 % or more on reads, but each one turns it on and charges for it its own way.
- Order your prompt to hit the cache
Put what never changes at the top and what changes every call at the bottom: that way the prefix always matches.
- Batches: half price if you can wait
OpenAI, Anthropic and Google charge 50 % less if you accept getting the replies within a few hours, a day at most.
- Send easy tasks to cheap models
Between the most expensive and the cheapest model from the same provider, prices differ by 40 to 100 times.
- OpenRouter: compare providers from one place
With a single key you get hundreds of models from many providers, and you can ask it to always pick the cheapest.
- Set a spending cap before you need it
A badly coded loop or a leaked key can burn hundreds of euros in one night: set limits from day one.
- Summary
Combine caching, batches and routing, compare providers and protect your account with caps: your bill can drop to a fraction.
Tools and concepts
- Prompt caching
- Batch API
- OpenRouter
Sign in with your Google account to access this lesson and the whole course.