Why Is My LLM Bill So High? 7 Fixes With Real Numbers
A student doubt-solving bot on a flagship model costs about $1,444 a month at 1,000 questions a day. Five changes bring the same workload to about $89. Here is each fix, the arithmetic behind it, and the code.
Most LLM bills are not high because AI is expensive. They are high because of a handful of defaults nobody questioned: the biggest model for every request, answers with no length limit, the whole chat history resent on every turn, and the same question answered from scratch a hundred times a day. This article prices one realistic workload with current list prices, then applies seven fixes one by one so you can see exactly where the money goes. Every number below comes from arithmetic you can rerun, not from a vendor's marketing page.
The Workload We Are Pricing
Picture a doubt-solving assistant for a college course: students ask questions, the bot answers using the course notes. It handles 1,000 questions a day, about 30,000 a month. Each request sends a 4,000-token system prompt (instructions plus course notes), the conversation so far, and a 150-token question. Answers average 600 tokens because nobody set a limit. Conversations run about 6 turns.
Prices are OpenAI's list prices per 1 million tokens as of December 2026. GPT-5.5: $5.00 input, $0.50 cached input, $30.00 output. GPT-5.4 mini: $0.75 input, $0.075 cached input, $4.50 output. Other providers differ in the details, but the same seven levers exist everywhere.
# Prices per 1M tokens: (input, cached_input, output)
GPT_55 = (5.00, 0.50, 30.00)
GPT_MINI = (0.75, 0.075, 4.50)
def request_cost(price, prefix, rest, out, cache_hit=0.0):
inp, cached, outp = price
prefix_cost = prefix * (cache_hit * cached + (1 - cache_hit) * inp)
return (prefix_cost + rest * inp + out * outp) / 1_000_000
# Baseline: 4,000 prefix + 1,875 avg history + 150 question, 600 out
per_request = request_cost(GPT_55, prefix=4000, rest=1875 + 150, out=600)
print(per_request * 30_000) # => 1443.75 dollars per month| Version | Released | Status | Key highlights |
|---|---|---|---|
| Baseline | $1,444/mo | Start | GPT-5.5 for every question, no output limit, full history, no caching |
| Fix 1: Route to a small model | $339/mo | -77% | 90% of questions to GPT-5.4 mini, 10% hard ones to GPT-5.5 |
| Fix 2: Cap the answer length | $234/mo | -31% | Answers average 250 tokens instead of 600 |
| Fix 3: Prompt caching | $133/mo | -43% | The 4,000-token prefix is billed at 10% on 80% of requests |
| Fix 4: Trim chat history | $119/mo | -11% | Send only the last 2 turns, not the whole conversation |
| Fix 6: Cache repeat answers | $89/mo | -25% | A quarter of questions are repeats, served from Redis for free |
Same workload, same quality bar for the hard questions, about 94% cheaper. Fixes 5 and 7 are measured separately below because they apply to different kinds of requests.
Fix 1: Stop Using the Flagship Model for Everything
GPT-5.5 costs 6.7 times more than GPT-5.4 mini for both input and output. Most student questions ("what is overfitting", "difference between list and tuple") do not need a frontier model. Send everything to the small model by default and escalate only the requests that need deep reasoning. In our workload, routing 90% of traffic to the mini model takes the bill from $1,444 to $339. This is the single biggest lever, and it is usually the one teams pull last.
HARD_SIGNALS = ("prove", "derive", "debug this", "time complexity",
"why does this code", "step by step solution")
def pick_model(question: str, attached_code: bool) -> str:
q = question.lower()
if attached_code and len(q) > 300:
return "gpt-5.5"
if any(signal in q for signal in HARD_SIGNALS):
return "gpt-5.5"
return "gpt-5.4-mini"
# Log which model answered, and sample 50 mini answers a week.
# If quality drops for a topic, add that topic to HARD_SIGNALS.A keyword router is crude, and that is fine as a start. The important part is the logging: measure where the small model fails, then route only those cases up. Some teams later replace the keyword list with a tiny classifier call, which costs a fraction of a cent per request.
Fix 2: Cap the Answer Length
Output tokens cost 6 times more than input tokens on both models. An assistant that writes 600 tokens when 250 would do is burning money on padding: restating the question, three-level headings, a summary of the answer it just gave. Set a hard limit in the API call and a soft limit in the prompt. The hard limit stops runaway answers; the soft limit makes the model plan a shorter answer instead of getting cut off mid-sentence.
Before — Unbounded (avg 600 tokens)
response = client.responses.create(
model=model,
instructions=SYSTEM_PROMPT,
input=question,
)After — Bounded (avg 250 tokens)
response = client.responses.create(
model=model,
instructions=SYSTEM_PROMPT
+ "\nAnswer in at most 150 words unless asked for more.",
input=question,
max_output_tokens=400, # hard ceiling, never reached normally
)Shorter answers also shrink the history you resend on the next turn, which is why this fix saves on input as well. On our workload: $339 down to $234.
Fix 3: Put the Stable Part First and Let the Cache Work
Every request in our workload starts with the same 4,000 tokens of instructions and course notes. Providers cache a repeated prompt prefix and bill it at a steep discount: on OpenAI's current models, cached input is 10% of the normal input price. On Anthropic's Claude models, a cache read costs 0.1 times the base input price on most models (even less on the newest ones), but writing to the default 5-minute cache costs 1.25 times the base price. It pays off from the first reuse.
The catch: caching works on the exact beginning of the prompt. If anything that changes per request (the date, the student's name, a request ID) appears before the stable content, the prefix is different every time and you get zero cache hits.
Before — Cache-hostile (0% hits)
prompt = f"""Today is {today}. Student: {student_name}.
{INSTRUCTIONS}
{COURSE_NOTES}
Question: {question}"""
# The first line changes every request,
# so the 4,000 tokens after it are never cached.After — Cache-friendly
prompt = f"""{INSTRUCTIONS}
{COURSE_NOTES}
Today is {today}. Student: {student_name}.
Question: {question}"""
# Identical first 4,000 tokens on every request.
# Check the usage object: cached tokens should be > 0.Assuming 80% of requests hit the cache (some misses happen when traffic is quiet and the cache expires), the bill drops from $234 to $133. Always verify in the API response's usage numbers that cached tokens are actually being reported. A cache you think you have but do not is a common, silent bug.
Fix 4: Stop Resending the Entire Conversation
Chat APIs are stateless, so every turn resends the whole conversation. Cost grows with every turn: in a 6-turn chat with 400-token exchanges, the sixth request carries 2,000 tokens of history. Across the conversation that averages 1,000 history tokens per request. Most doubt-solving questions only need the last exchange or two for context.
MAX_TURNS = 2 # one turn = one question + one answer
def build_messages(history, question):
recent = history[-MAX_TURNS * 2:] # last 2 Q&A pairs
return recent + [{"role": "user", "content": question}]
# For long tutoring sessions, replace older turns with a
# 2-3 sentence summary instead of dropping them completely.With a 2-turn window, average history falls from 1,000 to 600 tokens per request, and the bill from $133 to $119. The saving is smaller here because the earlier fixes already shrank each turn. In products with long sessions (coding agents, long tutoring chats), this is often the biggest fix of all.
Fix 5: Send Data in Compact Formats
If your prompts include data, the format you choose changes the token count far more than people expect. I took a table of 50 student records (roll number, name, subject, marks, attendance) and counted tokens with OpenAI's cl100k_base tokenizer. Newer models use a different tokenizer, so exact counts vary, but the ratios hold.
| Version | Released | Status | Key highlights |
|---|---|---|---|
| Pretty-printed JSON (indent=2) | 2,445 tokens | Baseline | Every key repeated 50 times, plus indentation |
| Minified JSON | 1,495 tokens | -39% | Same data, whitespace removed |
| CSV with one header row | 870 tokens | -64% | Column names appear once |
| Wordy system prompt | 139 tokens | Baseline | "Please always make sure that you answer every question in a very detailed..." |
| Tight system prompt | 36 tokens | -74% | Same rules, no filler words |
A 103-token saving on a system prompt looks tiny until you multiply it: at 30,000 requests a month, it is 3.1 million input tokens you no longer pay for. For tabular data, CSV is the easy win. For nested data, minified JSON with short key names is a good middle ground. Keep pretty-printing for logs and humans.
Fix 6: Never Pay Twice for the Same Answer
In a course assistant, the same questions arrive again and again, especially before exams. If a quarter of questions are repeats, a quarter of your bill pays for answers you already have. An exact-match cache in Redis costs almost nothing and removes those calls completely. On our workload: $119 down to $89.
import hashlib, json, redis
r = redis.Redis.from_url(REDIS_URL)
def normalize(q: str) -> str:
# Same idea as log sanitization: strip, lowercase, collapse spaces
return " ".join(q.strip().lower().split())
def cached_answer(question: str, course_id: str):
key = "ans:" + hashlib.sha256(
f"{course_id}|{normalize(question)}".encode()
).hexdigest()
if (hit := r.get(key)) is not None:
return json.loads(hit) # cost: $0
answer = ask_llm(question) # cost: tokens
r.set(key, json.dumps(answer), ex=7 * 24 * 3600) # expire after a week
return answerOnly cache answers that do not depend on the person asking. "What is backpropagation?" is safe to share across students. "Why did my code fail?" with their own code attached is not. Include the course or notes version in the key, so updating the notes does not serve stale answers.
Fix 7: Batch Everything That Can Wait
Not every LLM call needs an answer in two seconds. Grading assignments overnight, tagging a question bank, generating weekly summaries: these can wait hours. Both OpenAI and Anthropic offer a Batch API that processes requests asynchronously, usually within 24 hours, at 50% off both input and output tokens.
Example: grading 5,000 assignment submissions on GPT-5.4 (2,000 input tokens and 300 output tokens each) costs $47.50 through the normal API and $23.75 through the Batch API. Nothing else changes: same model, same prompt, same quality. Batch and prompt caching discounts can also stack when the requests share a long common prefix, such as the same grading rubric.
| Do | Don’t |
|---|---|
| Log model, input tokens, cached tokens and output tokens for every request, per feature. | Look only at the monthly total on the provider's dashboard and guess what caused it. |
| Default to the smallest model that passes your quality checks, and escalate on evidence. | Use the flagship model everywhere because it was what you prototyped with. |
| Put stable instructions and documents first, and variable details last. | Start the prompt with a timestamp, user name or request ID. |
| Set max output tokens on every call and ask for concise answers in the prompt. | Let the model decide how long every answer should be. |
| Set a hard monthly spending limit and an alert at 50% of it. | Discover a retry loop or a bot attack when the invoice arrives. |
Interview Talking Points: Cost-Aware AI Engineering
As more teams ship LLM features to production, cost questions now come up in AI engineering and backend system design rounds. These are the questions worth preparing.
- Why are output tokens priced higher than input tokens, and how does that change your prompt design?
- How does prompt caching work, and why does the order of prompt content matter?
- How would you decide which requests go to a small model and which to a large one?
- Why does chat cost grow with conversation length, and what are two ways to limit it?
- When is it unsafe to cache an LLM answer and share it between users?
- Design a cost dashboard for an LLM feature. Which four numbers would you track per request?
Summary and Core Takeaway
LLM cost is an engineering problem, not a pricing problem. In our example, the same assistant went from about $1,444 to about $89 a month without changing providers or giving up the big model for the hard questions. Two numbers drive almost everything: how many tokens you send and receive, and which model processes them. Measure both per feature, and the right fix is usually obvious.