Cut Your LLM API Bill: 5 Techniques With Measured Savings
- Authors

- Name
- Nino
- Occupation
- Senior Tech Editor
Cutting your LLM API bill means paying only for the tokens that change the answer. Most teams pay full price for the same system prompt thousands of times a day, run flagship models on trivial tasks, and let reasoning tokens run unchecked. Five techniques—prompt caching, batch APIs, model routing, semantic caching, and output discipline—can cut a typical bill by half or more. The mathematics below uses one real workload throughout, so you can see exactly where the money goes. When scaling enterprise workloads through an infrastructure provider like n1n.ai, optimizing these token parameters directly correlates with massive cost savings.
Why Do LLM Bills Explode?
LLM APIs charge per million tokens, and the two sides of the bill are priced very differently. Output tokens typically cost about five times input tokens: Gemini 4 Argon lists 10 per million output tokens through 30 November 2026, according to Google's Gemini API pricing page. Output pricing includes thinking tokens, so reasoning you never see is billed at the highest rate.
The second problem is repetition. A support assistant that re-sends the same 7,500-token product manual with every question pays to read the manual ten thousand times a day.
Percentages without a workload are marketing, so here is the one every number here is computed from. A documentation question-answering service handles 10,000 requests a day, 300,000 a month. Each request sends an 8,000-token prompt—7,500 tokens of shared system prompt and documentation plus 500 tokens of user question—and receives a 600-token answer.
At baseline, the monthly bill is 2 per million, or 10 per million, or 13,200. Every figure below is arithmetic from published list prices, not a vendor benchmark.
1. Prompt Caching
Prompt caching is the cheapest saving here because it needs no model change and no quality trade-off. When the same prefix of a prompt repeats, the provider charges a fraction of the normal input price for it. Google's implicit caching on Gemini 4 Argon discounts cached input by 95%, charging 2, and switches on automatically for prompts of at least 4,096 tokens.
On our workload, 7,500 of the 8,000 input tokens are identical every time. Cached, those cost 0.001. Input per request falls from 0.00175, and the monthly input bill falls from 525. Output is untouched at 2,325, a 65% saving from a change that is mostly about prompt structure.
The cache keys on the exact prefix, so stable content must come first and changing content last; putting the question before the documentation defeats it. Prompts under 4,096 tokens do not qualify, so small, chatty workloads gain little here. Developers can easily manage these prefixes when querying endpoints via n1n.ai to ensure cache hits.
# Cache-friendly prompts: stable content first, changing content last.
SYSTEM_PROMPT = open("system.md").read()
PRODUCT_DOCS = open("docs.md").read()
def build_prompt(user_question: str) -> str:
return SYSTEM_PROMPT + "
" + PRODUCT_DOCS + "
" + user_question
# Anti-pattern: a timestamp or the question before the docs breaks
# the cache prefix on every single request.
2. Batch APIs
Batch APIs trade latency for price: you submit a file of requests, collect the results hours later, and the provider charges half the standard rate. Google lists Gemini 4 Argon batch rates at 5 per million output tokens through November, and Anthropic offers the same 50% discount. On our workload, batching everything cuts input from 2,400 and output from 900, for a total of $3,300, exactly half the baseline.
Batching only fits work that can wait. Nightly reports, bulk classification, evaluation runs, and data enrichment are ideal; a live chat reply is not. Split traffic by deadline: anything with a service level above a few hours goes to batch by default. Batching also combines with caching: the cached-input rate on Argon's batch tier is 1,162 a month, an 82% reduction.
// Batch request file (JSONL): one request per line, custom_id for matching.
\{"custom_id": "doc-0001