How to reduce your OpenAI and Anthropic API costs

AI bills tend to grow a little at a time: a bigger model here, a longer prompt there. These steps help you bring yours back down, starting with finding out where the money goes.

1. Find out what’s driving the bill

Before you change anything, see which models, days and apps account for most of the spend. Our guides on tracking OpenAI API costs and tracking Anthropic API costs show how, with each provider’s own tools or with Tellgan.

2. Use the smallest model that does the job

Larger models can cost many times more per token than smaller ones. For simple tasks like classifying, pulling out fields or short summaries, try a smaller model and compare the results on real examples. Keep the large model for the work that needs it.

3. Send fewer input tokens

  • Trim the system prompt: cut instructions and examples the model doesn’t need.

  • Limit the context: send the relevant parts of a document or chat history, not all of it.

  • Watch retries: a failed call that’s retried with the full context gets paid for twice.

4. Cap the output

Output tokens usually cost more than input tokens, often several times more. Set a maximum output length, and ask for short answers or a structured format when that’s all you need.

5. Use prompt caching

If many requests start with the same long prompt, like instructions or a reference document, caching means you pay less for that repeated part. Put the parts that don’t change at the start of the prompt.

  • OpenAI: caching is automatic on supported models for prompts over 1,024 tokens, and cached input is billed at a discount.

  • Anthropic: you mark what to cache. Reading from the cache costs a small fraction of the normal input price, while writing to it costs a little more, so it pays off when the same prompt is reused often.

6. Batch work that can wait

OpenAI and Anthropic both offer a Batch API at 50% off normal prices. You send a set of requests and collect the results later, within 24 hours on OpenAI. It suits reports, evaluations, backfills and other jobs nobody is waiting on.

7. Watch for loops and forgotten keys

  • Runaway loops: an agent or script stuck retrying can spend a lot overnight.

  • Old keys: test keys and side projects keep spending until someone turns them off.

  • Budget alerts: a monthly limit with an alert tells you before a spike turns into a big bill.

8. Check your spend every week

Costs drift. A weekly look at spend by model catches a change while it’s still small. Tellgan shows your OpenAI and Anthropic spend together, by model and over time, at your real per-token rates, so the weekly check is quick.

Tellgan chart of monthly AI spend from January to November

See where your AI budget goes.