Cloud and AI costs · Starting Up
How do I cut what I spend on LLM APIs like OpenAI and Anthropic?
Checked 24 November 2026
Route each task to the cheapest model that passes your tests, cache the long repeated part of every prompt, and send anything that can wait to the Batch API at half price. Then trim prompts and history and cap output length.
By case
-
If one call dominates the bill
Test a smaller model on it against a set of real examples.
Claude Haiku 5.5 costs a fortieth of Opus 5.5 for input, and many classification and extraction steps pass on it.
-
If every request repeats a long system prompt or documents
Turn on prompt caching and keep that prefix identical on every call.
Cached reads cost a fraction of fresh input.
-
If the work is not interactive, such as tagging, summaries or evaluations
Send it through the Batch API.
Batches cost half and finish within a day.
-
If the bill comes from agent loops
Cap the number of steps and trim the history each step resends.
Every step sends the conversation so far again.
The steps5 steps
-
Log tokens and cost per request, tagged by feature, and find the costliest call.
-
Build a small test set from real requests and try cheaper models against it.
-
Move stable content to the start of the prompt and turn on caching.
-
Send background work through the Batch API.
-
Cap output length and trim history in long conversations.
The figuresEach with where it was read
- Claude API input price a million tokens: Haiku 5.5, and Opus 5.5 $0.10; $4
- Claude cache hit price as a share of input price: most models, and Opus 5.5 and Sonnet 5.5 0.1 times; 0.05 times
- OpenAI discount on cached input tokens up to 95%
- Batch API discount at Anthropic and OpenAI, and OpenAI's completion window 50%; within 24 hours
- Claude Sonnet 5.5 input price a million tokens $2
- Worked example: 1,000 requests a day x a 4,000-token prompt = 4 million tokens; at $2 a million, $8 a day; cached at 0.05 times, $0.40 a day $8 and $0.40 a day
What goes wrong
Putting a timestamp or user name at the top of the prompt, which breaks the cache on every call.
Keeping the biggest model everywhere because the prototype used it.
No cost tracking per feature, so nobody sees which call burns the money.
Free-tier users with no usage cap.
A worked example
A feature making 1,000 requests a day, each with a 4,000-token system prompt, sends 4 million prompt tokens a day: $8 a day on Sonnet 5.5 at $2 a million, or $0.40 a day once that prompt is read from cache at 0.05 times, before cache writes.
Go deeper6 sources
-
Claude API pricing (Anthropic)
Anthropic · platform.claude.com · Tool
A model maker's own price list, which shows what an AI product pays per million tokens and so what each task costs.
-
Prompt caching (Claude API Docs)
Anthropic · platform.claude.com · Official
How to mark the repeated part of a prompt so later requests read it from cache.
-
Batch processing (Claude API Docs)
Anthropic · platform.claude.com · Official
How to send large volumes of requests that do not need an immediate answer, at half price.
-
OpenAI API pricing
OpenAI · developers.openai.com · Official
OpenAI's price list per model, with standard, batch and cached-input rates.
-
Batch API (OpenAI)
OpenAI · developers.openai.com · Official
OpenAI's guide to asynchronous batches at half the price of synchronous calls.
-
Prompt caching (OpenAI)
OpenAI · developers.openai.com · Official
How OpenAI reuses a repeated prompt prefix and what it charges for it.