Home › Blog › How to Cut Your Anthropic API Costs

How to Cut Your Anthropic API Costs

By Victor, founder of apicuts

Claude gives you strong cost levers, but most teams leave them half-used. Caching that silently misses and background jobs on full price are the usual culprits.

Quick answer

Cache your stable prompt prefix (cache reads cost about a tenth of normal input on most models), send anything nobody is waiting on through the Message Batches API (50% off), pick the smallest model that passes your evals, and control thinking spend with the effort setting.

1. Read the usage object on every response

Every Claude API response reports input_tokens, output_tokens, cache_creation_input_tokens and cache_read_input_tokens. Log them with a feature name and rank features by cost. To check a prompt's size before you send it, use Anthropic's token counting endpoint. Third-party tokenizers built for other models won't match Claude's counts.

2. Cache your stable prompt prefix

Prompt caching is the biggest lever on most Claude bills. Mark the end of the stable part of your prompt with cache_control, or turn on automatic caching for the whole request.

3. Batch anything nobody is waiting on

The Message Batches API takes 50% off every token in the request, including cache reads and writes, so the two discounts stack. Results arrive asynchronously within 24 hours. It suits evals, backfills, scheduled reports and enrichment jobs.

4. Pick the model per route

Haiku-class models handle classification, extraction and routing at a fraction of the price of larger models. Test each route on your evals before you switch. Compare cost per completed task, not cost per request: a cheaper model that needs extra retries or turns can end up costing more. A larger model at a lower effort setting is sometimes cheaper per finished task than a smaller one.

5. Control thinking spend with effort

Thinking tokens are billed as output tokens, whether or not you show them to users. On current models, the effort setting is the main control over how much the model thinks. Routine routes such as chat and classification often hold quality at low or medium effort. Keep higher effort for hard coding and agent work, and measure before you change a default.

6. Trim output and agent loops

Measure the result

Track cost per request per route, and watch your cache read share after every deploy. A prompt change that breaks caching can wipe out your savings overnight; that's what cost regression protection catches.

Want us to find your 20%?

Book a free 15-minute API cost teardown. Bring last month's provider usage and we'll show you your biggest waste and the first fix we'd ship.

Get My Free 15-Minute API Cost Teardown

Frequently asked questions

Does prompt caching work on every Claude model?

Current models support it, but the minimum cacheable length differs by model. If cache_read_input_tokens stays at zero, your prefix is too short or something in it changes between requests.

Do cached tokens count toward rate limits?

On the Claude API, cache reads don't count toward input-token rate limits on most models, so good caching can raise your throughput as well as cut cost.

Can I combine batching and caching?

Yes. The batch discount applies to cache reads and writes too. Cache hits inside a batch are best-effort, because requests in a batch can run at the same time.

Related