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

Cut API Costs 50-90% Without Switching Models: Caching, Batching, and Token Hygiene

A bloated AI bill is rarely the model's fault. Prompt caching, batch APIs, and token hygiene can cut costs 50-90% without touching quality.

Cut API Costs 50-90% Without Switching Models: Caching, Batching, and Token Hygiene

A costly assumption circulates among developers: if your API bill balloons, the fix must be switching to a cheaper model. In reality, for most applications the biggest waste is not which model you picked but how data is sent — long instructions resent thousands of times, non-urgent work paid at full price, and answers that run far longer than needed. All three leaks can be sealed without rewriting your architecture or dropping answer quality.

This guide covers four cost levers that work across OpenAI, Anthropic, and Gemini: prompt caching, Batch APIs, token hygiene, and output control — plus two supporting habits: budget monitoring and quality testing. Most of it fits into a single afternoon, and the results show up directly in your billing dashboard. These are official provider discounts, not promotional promises.

Audit First: Find Where Your Tokens Go

Savings you never measure never last. Before touching any code, download the last 30 days of usage from your billing dashboard — OpenAI and Anthropic export usage reports, and Gemini offers equivalent monitoring in AI Studio and Vertex AI. Group the data by endpoint or job name, then identify the top three cost drivers. The usual pattern: one or two automated processes — a data-enrichment cron, a document indexer, a daily summarizer — consume over half the bill, while user-facing requests barely register.

Paste that data into an AI chat and ask for a diagnosis:

Here is my 30-day API usage data (columns: endpoint, request_count,
input_tokens, output_tokens, cost_usd).
1. Rank the five largest cost sources with their percentages.
2. Identify waste patterns: repeated context, overly long outputs,
   or schedules that run too often.
3. Recommend three concrete changes with estimated savings.
[PASTE YOUR CSV HERE]

Keep the result as your baseline — those numbers will prove the next steps actually cut costs.

Turn On Prompt Caching: Stop Paying Twice for the Same Instructions

The classic leak: a two-thousand-token system prompt plus reference documents, resent in full with every request. Prompt caching fixes this: the provider stores the start of your prompt on its servers, and every later request that opens with that identical section pays only a fraction of the price.

On Anthropic, cache hits cost about 10% of the regular input price — a 90% discount — with a one-time 25% write premium and a five-minute default TTL that refreshes on every hit. OpenAI enables caching automatically once the stable prefix of your prompt exceeds 1,024 tokens. Gemini offers implicit caching plus explicit context caching with a per-hour storage fee.

The rule of thumb fits in one sentence: rarely-changing content goes first, frequently-changing content goes last. Never place timestamps, random IDs, or unique filenames at the start of a prompt — one different character can void the entire hit. On Anthropic, mark the breakpoint explicitly:

system=[{
    "type": "text",
    "text": LONG_RARELY_CHANGING_INSTRUCTIONS,
    "cache_control": {"type": "ephemeral"}
}]

Not Real-Time? Send It to the Batch API

Much of your AI workload never waits in front of a user: backfilling old records, enriching thousands of database rows, summarizing archives, tagging content in bulk. For this kind of work, all three providers offer Batch APIs with roughly 50% off every token — the trade-off being results within a 24-hour window.

The migration is mechanical. Collect non-urgent jobs into a JSONL file, submit once, and collect the results the next morning:

{"custom_id": "req-001", "params": {"model": "YOUR_MODEL",
  "messages": [{"role": "user", "content": "Classify this ticket..."}]}}
{"custom_id": "req-002", "params": {"model": "YOUR_MODEL",
  "messages": [{"role": "user", "content": "Classify this ticket..."}]}}

The rule any team can apply: if a user is not actively waiting for the answer, the job belongs in the batch queue. For overnight processes, this discount is pure free money.

Token Hygiene: Stop Resending Long History

Caching saves you from repetition, but the most powerful lever is not sending excess data at all. Three habits are worth building.

First, stop resending the full conversation history. After 10-15 turns, have the AI compress it into a current-state summary, then continue from that summary:

Summarize the conversation below into: (1) decisions already made,
(2) key facts and preferences, (3) outstanding tasks.
Maximum 150 words. This summary will replace the original history.
[CONVERSATION HISTORY]

Second, store large documents once and send only a chapter summary plus the excerpts relevant to the current question. Third, strip data before sending: scraped results and database exports often carry two-thirds of fields the model never uses — cut them before they become tokens.

Control Your Outputs: Most Bills Leak Through Verbosity

Output tokens generally cost more than input tokens, and this is where bills leak most often unnoticed. A model asked to "explain in full detail" will charge for its generosity. Three antidotes.

Set a realistic max_tokens on every call instead of leaving it at maximum. Ask for structured formats, because JSON and short bullets are cheaper and easier to process than prose:

Respond ONLY with JSON fields: decision, reasoning (max 2 sentences),
top_risk. No intro, no closing, no markdown.

And when requesting revisions to code or documents, ask for a diff or just the changed sections — not a full rewrite. A three-line change should not be billed across four hundred lines.

Set the Brakes: Limits, Alerts, and a Weekly Review

Savings can collapse overnight because of one runaway loop or one leaked API key. Treat your budget like infrastructure. Set a hard monthly spend limit on each provider's dashboard, enable alerts at 50% and 80% of quota, and separate API keys per project so a spike traces straight to its source. Then schedule a 10-minute review every Monday: rerun the audit prompt, compare against the baseline, and investigate deviations before they compound.

Test Quality Before You Celebrate

Savings that damage output are not savings — they are deferred losses. After trimming context, moving jobs to batch, or shortening outputs, run a small regression test: keep 20-50 sample inputs with proven-good old answers, rerun them under the new configuration, and compare pairs:

Compare answer A (old) and B (new) for the same input.
Score 1-10 on accuracy and completeness. List any important
information missing from B. If B is equal or better, write: SAFE.

If quality drops on specific cases, restore full context for those cases only. This usually protects quality while keeping most of the savings.

Start with the audit and caching today — both take under an hour and touch nearly every application. Let your billing dashboard report the results; next month's invoice speaks more honestly than any estimate.

References

Partner Spotlight Explore today’s curated technology offers