Thursday, 3 Dec 2026 Global Edition
Live Wire
AI Today Daily AI journalism & intelligence
Front Page Tips & Tutorials Baca versi Indonesia

API Bills Without the Shock: How to Cut AI Costs Without Losing Quality

A bloated API bill usually comes from habits, not model prices. Seven practical steps to cut your AI costs by up to 90 percent.

API Bills Without the Shock: How to Cut AI Costs Without Losing Quality

When your AI API bill triples in a single month without any new feature shipping, the cause is almost never the price of the model. The cause is habit: conversation history stacked without pruning, rambling answers billed token by token, and heavyweight models happily assigned to tasks a mini model could handle just as well.

The good news: these patterns can be fixed within days — many teams cut API costs by 50-90 percent without any meaningful drop in quality. This guide walks through seven practical steps you can apply today. No provider switch required, no application rewrite required.

1. First, Understand Where Your Money Flows

Everything is billed per token. One token is roughly three-quarters of a word, and there are three rates you need to know:

  • Input: the text you send (prompt, documents, chat history).
  • Output: the model's answer. Typically 4-5 times more expensive per token than input.
  • Cached input: parts of your prompt that were sent before and stored by the provider. Charged at a steep discount.

Open with a 10-minute exercise: visit your provider's pricing page, write down the three rates for the model you use, then compute the cost of one typical request. The classic finding: a 2,000-token system prompt re-sent on every request is the biggest hidden cost — at 50,000 requests a month, that is 100 million tokens paid repeatedly for identical text.

2. Use the Smallest Model That Still Gets the Job Done

The 80/20 rule applies: most daily tasks, such as classification, data extraction, reformatting, copy editing, or short summaries, do not need a flagship model. Small models are typically 10-30 times cheaper, and for simple tasks the difference is nearly impossible to notice. Reserve the big model for work that genuinely requires reasoning: multi-step analysis, planning, or complex code.

The cheapest way to sort tasks is to use the model itself as a router:

You are a task router. Classify the following request:
- LIGHT: classification, extraction, reformatting, editing, summaries < 300 words
- HEAVY: multi-step analysis, planning, complex reasoning, code > 100 lines
Reply with ONE word only: LIGHT or HEAVY.

Request: {input}

If the result is LIGHT, route to the small model. If HEAVY, escalate to the flagship. One nearly-free routing call can save a large number of expensive model calls.

3. Prune Your Context: Stop Paying for Words You Never Needed

The most common mistake is pasting an entire document when only two pages are relevant, or carrying 40 turns of chat history to answer a question that needs one fact. Build two new habits.

First, summarize before you send. For long documents you will query repeatedly, make one dedicated call to compress them, then use the compact brief in every follow-up conversation. Second, summarize history. After 10-15 turns, ask the model to condense the conversation into key points, then restart from that summary.

A compression prompt you can copy as-is:

Summarize the following transcript into a brief of at most 400 tokens.
Must keep: numbers, names, dates, decisions, action items.
Discard: greetings, repetitions, filler.
Output bullets, no extra commentary.

Transcript: {transcript}

4. Control Answer Length, Because That Is Where the Money Is

Since output costs 4-5 times more than input, verbose answers are the most expensive leak in your entire system. Install three brakes at once. Set the max_tokens parameter to the real need of each endpoint, not a large default. Write length limits directly into the prompt. And request structured formats, because JSON, tables, and bullets naturally cut connective words.

A budget-conscious system prompt:

ANSWER RULES:
1. Answer in at most 120 words unless asked otherwise.
2. Use bullets, not long paragraphs.
3. Do not repeat my question. Do not apologize. Do not add a closing line.
4. If information is missing, ask at most 1 clarifying question.

This simple combination often cuts output tokens by 30-50 percent on chatbot workloads. The bonus: shorter answers are frequently easier for users to read.

5. Turn On the Two Official Discounts Everyone Ignores: Prompt Caching and Batch

These are the two most lucrative discounts and, ironically, the least used.

Prompt caching stores the repeated prefix of your prompt — system prompt, reference documents, tool definitions — so that portion is not billed in full on subsequent requests. At Anthropic, cache reads are charged at roughly 10 percent of the normal input price (90 percent savings), with a 25 percent surcharge on cache writes that quickly pays for itself. OpenAI also discounts cached input, applied automatically when requests share a long prefix. The requirement is one: stable content at the start of the prompt, changing content at the end.

Batch API serves work that does not need to finish this second. Submit jobs together, get them processed within a 24-hour window, at a 50 percent discount on both OpenAI and Anthropic. Daily summaries, bulk archive processing, mass embeddings, and scheduled content are ideal candidates. Best of all, the two discounts stack.

The rule is simple: user waiting on the answer → real-time path with caching; result only needs to land in an inbox tomorrow morning → send it through batch.

6. Install Meters and Brakes Before the Bill Arrives

Optimization without measurement will leak again within a month. Three things must be in place.

First, set a monthly budget and notification thresholds in your provider dashboard, for example via OpenAI's usage limits, so anomalous spikes get caught before they become invoices. Second, log input and output tokens per request in your application; a single print statement is enough to start. Third, compute cost per feature, not just the monthly total. The formula per request:

cost = (input_tokens * input_price + output_tokens * output_price) / 1.000.000

In practice, one feature alone — say an internal chatbot whose context was never bounded — often consumes 70 percent of the budget. Without a per-feature breakdown, that finding is invisible.

7. A 15-Minute Weekly Audit: Hunt Down Wasteful Tokens

Close the loop with a light weekend habit. Answer four questions from your log data:

  1. Which feature or endpoint was the most expensive this week?
  2. What percentage of requests got a cache hit? If it is low, restructure your prompts: stable content must sit at the beginning.
  3. Is the expensive model still handling tasks labeled LIGHT?
  4. Run a small A/B test: take 20 sample tasks, run them on a cheaper model, compare quality. If nine out of ten results are on par, migrate permanently.

The principle: API cost = tokens × price × frequency. A weekly audit makes all three visible, and what is visible can be managed.

You do not need a new provider or lower quality. The order: measure, prune context, downsize models, control output, use caching and batch, then guard it all with meters and a weekly audit. Start with step 1 this afternoon, and next month's bill will look different.

References

Partner Spotlight Explore today’s curated technology offers