Skip to content
mathbehind

How to Reduce LLM API Costs: 6 Levers That Work

Model choice, history length, caching, batching, output limits and routing. Here's how much each lever can save on a real chatbot workload.

By Muhammad Ahmad. Published . 1 min read.

Want to run your own numbers?AI Feature Cost CalculatorOpen the calculator

An AI feature's bill grows with users, conversation length and model price. The good news is that each of those has a lever, and most can be pulled without users noticing.

1. Pick the smallest model that passes your tests

The same chatbot workload costs $391.20 a month on Claude Sonnet 5 and $42.72 on GPT-5.6 Luna. Test the cheaper tiers on real examples before assuming you need a flagship model.

2. Limit chat history

Every message re-sends the conversation so far, so input grows quickly with length.

The same chat at 12 messages instead of 6
  1. Input tokens

    12 × 800 + 12 × 60 + 360 × 12 × 11 ÷ 2equals34,080

  2. Output tokens

    12 × 300equals3,600

  3. Per conversation

    34,080 ÷ 1M × $2.00 + 3,600 ÷ 1M × $10.00equals$0.1042

  4. Per month

    $0.1042 × 10,000 conversationsequals$1,041.60

Doubling conversation length raised the monthly bill from $391.20 to $1,041.60. Keeping only recent turns, or summarizing older ones, caps that growth.

3. Cache repeated input

Long system prompts and documents are sent with every message. Providers discount cached input heavily; OpenAI bills cached reads at 10% of the standard input rate on current models.

4. Batch work that can wait

Batch APIs typically halve the price for jobs that can finish within 24 hours, such as nightly summaries or classification.

5. Cap output length

Output tokens cost several times more than input. Ask for concise answers and set a maximum output length.

6. Route by difficulty

Send simple requests to a cheap model and only hard ones to an expensive model. Even routing half of the traffic can cut the bill substantially.

Sources

  1. OpenAI API pricing in 2026 (CloudZero)