Explore / Build the product / Cloud and AI costs

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.

    Claude API: Per million tokens, input / output: Opus 5.5 $4 / $20; Sonnet 5.5 $2 / $10; Haiku 5.5 $0.10 / $0.50 for prompts up to 100,000 tokens, read from platform.claude.com on 10 November 2026

  • 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.

    OpenAI API: Per million tokens, input and output: GPT-6 Astra $10 and $50, GPT-6.1 Sol $2 and $10, GPT-6.1 Terra $1 and $5, GPT-6 Luna $0.10 and $0.50, read from developers.openai.com on 10 November 2026

  • 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

  1. Log tokens and cost per request, tagged by feature, and find the costliest call.

  2. Build a small test set from real requests and try cheaper models against it.

    The official page on platform.claude.com

  3. Move stable content to the start of the prompt and turn on caching.

    The official page on platform.claude.com

  4. Send background work through the Batch API.

    The official page on developers.openai.com

  5. Cap output length and trim history in long conversations.

    The official page on developers.openai.com

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 API, read 24 November 2026
  • 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 Claude API pricing (Anthropic), read 24 November 2026
  • OpenAI discount on cached input tokens up to 95% Prompt caching (OpenAI), read 24 November 2026
  • Batch API discount at Anthropic and OpenAI, and OpenAI's completion window 50%; within 24 hours Batch API (OpenAI), read 24 November 2026
  • Claude Sonnet 5.5 input price a million tokens $2 Claude API pricing (Anthropic), read 24 November 2026
  • 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 Claude API pricing (Anthropic), read 24 November 2026

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.