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

Shocked by Your AI API Bill? A Practical Guide to Cutting Costs by Up to 90 Percent

AI API bill ballooning? Seven saving habits: pick the right model, trim tokens, use prompt caching and batch APIs. Costs drop, quality stays.

Shocked by Your AI API Bill? A Practical Guide to Cutting Costs by Up to 90 Percent

Two weeks after launching your chatbot feature, has the API bill already landed in the “suspicious transactions” category of your bank statement? You are not alone. Many developers and small business owners are stunned to see AI usage costs multiply within days, while the product barely has any users yet. The good news: most ballooning bills are not caused by expensive AI, but by wasteful usage habits. This article distills seven cost-saving practices you can apply today, complete with copy-paste-ready prompts. Done right, this combination can cut costs by 50-90 percent without sacrificing answer quality.

1. First, Find Out Where Your Money Flows

Every major provider—OpenAI, Anthropic, Google—bills by tokens: chunks of text of roughly four characters. There are two components: input tokens (what you send) and output tokens (what the model writes). Output tokens are pricier, often three to four times the input rate. So before touching any code, open the usage dashboard, download the last 30 days of details, and rank which feature is the greediest. More often than not, one old endpoint left running without limits is the main culprit.

Paste your usage log into the AI and ask it to analyze:

Here is my 30-day API usage CSV
(columns: date, endpoint, model, input_tokens, output_tokens, cost_usd).
[paste data]
1. Identify the 3 biggest waste patterns.
2. Compute the average cost per request for each endpoint.
3. Recommend cost-saving actions, sorted by impact.

With numbers in hand, the next steps become targeted instead of guesswork.

2. Match the Model to the Weight of the Task

The most common mistake: using the biggest, most expensive model for everything. Yet many everyday jobs—classifying emails, extracting names and dates, tidying up text—run perfectly well on small models that cost ten to twenty times less. The principle is simple: big models for complex reasoning and long analysis; small models for repetitive, high-volume tasks.

Build a simple “router”: one cheap call on a small model to gauge difficulty, then escalate to the big model only when needed. The routing instruction can be as simple as:

Classify the following user request as SIMPLE or COMPLEX.
SIMPLE: short Q&A, reformatting, data extraction.
COMPLEX: multi-step analysis, complex calculations, long-form writing.
Answer with one word only.
Text: {user_input}

One cheap output token can save you from a large, unnecessary call.

3. Send Summaries, Not Entire Archives

The longer the prompt, the more every call costs. The classic mistake: re-pasting a 20-page document or the whole chat history into every request. The AI does not need all of it—only the relevant parts. The essential saving habit: trim long text before it enters the prompt.

Ask the model to condense the raw material itself:

Summarize the following text into at most 150 words for later use.
Keep all numbers, names, dates, and main conclusions.
Remove repetition and filler.

Text: {long_document}

Store the summary, then reuse it. For long conversations, routinely “compact” the history: every 10-15 turns, ask the model to summarize the conversation so far and continue from that summary instead of stacking every message.

4. Turn On Prompt Caching: Pay Full Price Once, Discount the Rest

Prompt caching is the most overlooked saving feature. Providers charge full price for the repeated parts of your prompt unless you mark them as a cache. Anthropic gives a 90 percent discount on cache reads (the first write costs only 25 percent more), while OpenAI saves 50-95 percent on cached input tokens depending on the model.

How to do it: arrange the prompt so the static parts—system instructions, knowledge base, few-shot examples—come first, and the dynamic part (the user's question) comes last. On the Anthropic API, add a cache_control marker to the block you want stored:

{
  "system": [
    {
      "type": "text",
      "text": "Your long system instructions here...",
      "cache_control": { "type": "ephemeral" }
    }
  ]
}

The cache lives for about five minutes and refreshes each time it is used. A high-traffic app can cut input costs roughly tenfold just by reordering the prompt. For workloads with longer gaps, Anthropic offers a one-hour TTL—the write costs more, but it pays off when your base prompt is large.

5. Hand Non-Urgent Work to the Batch API

Some jobs do not need answers in seconds: nightly report summaries, tagging 10,000 product reviews, processing an archive of transcripts. For this kind of load, the Batch API is the official discount machine: OpenAI and Anthropic both offer 50 percent off input and output, with a 24-hour completion window. You collect requests into a JSONL file, upload it, then pick up the results a few hours later.

Rule of thumb: if no user is staring at a screen waiting for the answer, send it through the batch. A bonus on Anthropic's side: the batch discount stacks with prompt caching—a combination that can push input costs below ten percent of the normal price.

6. Lock Output Length From the Start

Because output tokens cost more, long-winded answers burn the budget directly. Two switches must be set: the max_tokens parameter as the hard brake, and style instructions as the soft brake. Without limits, models tend to repeat your question, add polite openers, and close with an unrequested summary.

Install strict instructions for structured output:

Answer in JSON format with three keys: answer, basis, risks.
At most 60 words per key. No opening or closing sentences.

Structured output is not only cheaper—it is also easier for your application to consume without extra cleanup, which means no paid “fix the format” follow-up calls.

7. Install a Meter and Budget Alarms

Saving once is not enough; AI costs leak at any moment—a new feature, a bug looping calls endlessly, or a mischievous user sending book-length prompts. Build three layers of defense: cost logging per feature and per user, a daily budget with notifications, and a weekly review.

Set up automatic alerts, then ask the AI to act as your routine auditor:

Here is this week's API cost summary per feature. [paste table]
Compare it with last week. Flag any feature that grew more
than 30 percent and the likely cause. Summarize it into
five bullets for a non-technical manager.

With this habit, cost spikes are detected within days—not when the bill has already arrived.

There is no need to apply all seven steps at once. The proven order: audit first, match models to tasks, arrange prompts for caching, then move slow work to the batch. The first three steps alone usually cut the bill in half. The rest is keeping the habit—and from that moment on, your API bill stops being an end-of-month surprise.

References

Partner Spotlight Explore today’s curated technology offers