← Blog

· 3 min read

When NOT to Use an LLM: Replacing $0.05 API Calls with $0.00 Algorithms

Some of the best AI decisions I've made were to not use AI. The summariser on this site has no model in it, costs nothing per run and cannot invent a sentence.

A large language model (LLM) is the right tool when the input is messy and the answer needs judgement. When the rules are known, ordinary code is faster, cheaper and gives the same answer every time.

1. Summaries that must stay true: graph theory

TextRank ranks sentences by how strongly they connect to the rest of a document, the way PageRank ranks web pages (Mihalcea, 2004). It returns sentences from the source word for word, so it can't hallucinate. Our free Document Summarizer uses it and runs in a fraction of a second.

2. Formats and validation: regular expressions

Checking that a PAN, GST number, pin code or email has the right shape is a pattern match. A regular expression does it instantly, offline, and never has an off day.

3. Routing and dependencies: graph algorithms

Shortest delivery routes, approval chains and "what breaks if this changes" are graph problems with exact answers. An LLM will give you a plausible answer; an algorithm gives you the correct one.

4. Calculations and policy: plain rules

Tax, discounts, leave balances and eligibility come from written rules. Code them once, test them, and audit them line by line.

What the API version would cost

One call to gpt-5.4 that reads 10,000 tokens (about a long contract) and writes 1,500 costs about $0.05 at standard rates (OpenAI, 2026). At 1,000 documents a day:

30,000 summaries a month (OpenAI standard rates, 2026)
ApproachPer callMonthly≈ ₹
gpt-5.4$0.0475$1,425₹1,36,800
gpt-5.4-mini$0.0143$427.50₹41,040
gpt-5.4-nano$0.0039$116.25₹11,160
TextRank on your server$0$0₹0 extra

At ₹96 to the dollar, rounded. Batch prices are half, if you can wait for results.

Monthly cost, 1,000 documents a day

The algorithm's cost is the server you already pay for.

Should this task use an LLM?

Score each question 0 (no), 1 (sometimes) or 2 (yes):

  • Is the input unstructured, like free text or images?
  • Does the answer need judgement rather than a rule?
  • Is a slightly wrong answer acceptable, or easy to catch?
  • Is the volume low enough that per-call cost doesn't matter?
  • Have you tried a rule, a regular expression or an algorithm first?

My threshold: 7 or more, try an LLM. Below that, write code. A score of 0 on the last question means you're not ready to decide.

Your next step

List every AI call your product makes today. Mark each one "rule", "pattern", "graph" or "judgement". Replace one non-judgement call with code this sprint and compare the bill.

Sources

  1. Mihalcea (2004). TextRank: Bringing Order into Text. Rada Mihalcea and Paul Tarau, EMNLP 2004.
  2. OpenAI (2026). API pricing. Standard rates, checked 10 October 2026.

NEW CODE EVERY MONTH.

Get a note when new Claude Code templates, code recipes or tools go live.

No account required

We email once to confirm. Unsubscribe anytime — it deletes your address.

New drops, every week

Free tools & Claude templates, landing regularly.

We keep shipping new free tools, code recipes and Claude Code templates. Follow @freeyantra on Instagram or join the newsletter so you never miss one.

Follow @freeyantra

or get them by email

Double opt-in. Unsubscribe any time. Privacy