Skip to main content

1 + 1 Now Has an Invoice

Structured engineering, unstructured convenience, and the bill nobody reads

Updated 10 min readMarkdown
Part of seriesStructured Engineering in the Age of AI
1 + 1 Now Has an Invoice

I asked a real model what 1 + 1 is. Five times. Here is the receipt.

INVOICE #1+1                         (measured, not imagined)
-----------------------------------------------------------
Question ......................... "What is 1 + 1?"
Tokens sent to ask it ............ 606
Tokens received .................. 12
Time to answer ................... ~740 ms (median of 5)
Cost per ask ..................... $0.0000122  (cheapest model, cache warm)
Answer ........................... "1 + 1 = **2**"
-----------------------------------------------------------
Same addition in plain Python .... 43 nanoseconds, no inference fee

Read the answer again. Not 2. 1 + 1 = **2**, in markdown bold. Correct, polite, well formatted, and any code expecting a bare number just broke. Yes, structured output would fix that. But notice what that fix is: adding structure back.

About 17 million times slower than the line of code it replaced. (I checked that math twice. Without a model.)

Nobody gets fired for this. That's the problem.

How I ended up questioning my own work

I'm an AI-driven engineer myself. This isn't someone outside the AI wave pointing fingers. I've been very much part of it.

Recently I did a retrospective on some of my own work. Not because anything was broken, but because I wanted to know whether I was building it the best way.

There's a personal reason too. Coming from a middle-class family, I've always questioned even small expenses, and apparently that habit followed me into engineering. At home it's called being careful. In the cloud it's called FinOps. I started checking the cost of individual model calls. The numbers were ridiculously small. But each time I asked: could ordinary code have done this? Then I multiplied by users, requests, retries and days. It stopped being small.

Money was only the first question. Others followed. Why does a microsecond job wait most of a second? If this step is wrong, will anything tell me? Can I prove it works, or only that it worked this time? If the model changes next quarter, would I even notice? And the one that stung: could I explain what this step does without the model?

Cost is easy to measure. Understanding is easy to lose.

I still use AI extensively, more deliberately than before. The output I deliver might not look very different. But what I carry behind it has changed: a better understanding of the system, more confidence in my decisions, and a greater ability to explain, challenge and defend them. The improvement isn't always visible in the deliverable. Sometimes it's in the engineer delivering it.

I'm not trying to become an engineer who uses less AI. I'm trying to become one who knows exactly why he's using it.

The deal software used to run on

For thirty years, software ran on one quiet deal: think once while building, so the machine never has to think while running.

Messy input came in: vendor CSVs, free text, payloads documented mostly by vibes. We understood it once. We wrote the schema, the parser, the mapping table, the state machine. After that, everything downstream was allowed to be beautifully dumb.

A switch statement has never had an existential crisis. A SQL query has never asked what you really meant. They're fast and cheap because the thinking was already paid for.

Structure was never bureaucracy. Structure is thinking you only pay for once.

What changed: we stopped deciding

AI didn't break that deal. We did, because AI made it so easy to skip.

A model can take raw input and return something useful with no schema, no parser, no design meeting. The demo works in an afternoon. That speed is real progress for genuinely fuzzy problems.

But speed also creates hope. Hope that we'll never need to understand the input. Hope that "the model will figure it out" is a design. It isn't. It's a prayer with an API key. And hope is what makes engineers stop checking.

So the same pipe gets used for everything:

  • a long, free-written incident timeline that has to become "what happened, when, and what we still don't know" — a good use;
  • a log line whose format hasn't changed since 2019 — paying a model to re-read it every time;
  • formatting a date, mapping field A to field B, checking a threshold — paying a model for 1 + 1.

The problem isn't that we use AI. It's that there's no combination happening. All structure or all model, and lately mostly model.

When abstraction becomes debt

Engineering is abstraction. I don't need to understand transistors to write Python, or build a container runtime to deploy on Kubernetes. Good abstractions hide complexity behind a predictable contract.

But abstracting complexity is different from outsourcing understanding. I can read a parser's rules. I can reason about a database's guarantees. When I hand a whole decision to a model, the reasoning behind it may no longer exist anywhere in my codebase.

That gap, between what a system does and what its engineers can explain, verify and maintain, is what I think of as abstraction debt. The system works perfectly today. The debt shows up the day it doesn't.

A good abstraction hides complexity. A dangerous one hides responsibility.

There's a human version too: cognitive debt. AI can grow how much software I ship faster than it grows my understanding of it. More features, more tickets closed, and slowly less able to explain what I built. Productivity shows up immediately. Cognitive debt shows up during an incident.

A lot of "unstructured" data isn't

For Part 2 I generated a week of production-style log traffic (synthetic, but shaped like the real thing). 88% of the lines came from just 10 formats. Only 12% were genuinely free-form.

One synthetic stream isn't a law of nature, but check your own. Logs, webhooks, form submissions, invoices from the same five vendors: a lot of "unstructured" input is structured input we never bothered to write down. Send all of it to a model and you aren't paying for intelligence. You're paying the model to rediscover your structure, on every request.

Convenience interest

"But it's $0.00001 a call." Sure. And chai is only ₹15. Now drink two million cups a day.

Per call What it is At 2M requests/day, per year
$0.0000122 my measured "1 + 1", cheapest model, warm cache $8,906
$0.000143 measured average in Part 2's experiment $104,390
$0.001 illustrative: longer prompt, mid-size model $730,000
$0.01 illustrative: big model, real context $7,300,000

Somewhere, a finance team just felt a chill. Cheap individually. Expensive collectively. And tokens are only the first line. Then come retries, validators for every output, evals (you can assert a model's answer, but one pass doesn't prove consistent behaviour), and model versions that retire on someone else's schedule.

I call this convenience interest: you borrowed thirty minutes of design work, and now you pay EMI on it with every request.

It's not quite technical debt. Technical debt mostly charges interest through slower development and harder maintenance. Convenience interest puts a recurring charge directly in the execution path: you don't even have to touch the code to receive the invoice, and the more successful your system gets, the bigger it grows. (Part 2 is about the prepayment option.)

The combination nobody builds

The answer isn't "less AI." It's a ladder, and most teams jump straight to the top rung:

cheap, fast, testable                           expensive, slow, flexible
  ─────────────────────────────────────────────────────────────────────▶
  lookup table → rules/regex → parser + schema → small model → big model

Each request should climb only as high as it needs to. That's the combination we should be building: deterministic execution for what we can formalise, probabilistic inference for what genuinely requires interpretation. The mistake isn't using a probabilistic system. It's using one where a deterministic solution already exists.

In DevOps we spent years shifting left: moving testing and security earlier, into design and build. Intelligence deserves the same treatment. Use the model while building: to understand the problem, generate the parser, find the edge cases. Then encode what you learned. Pay for intelligence once when making the decision; execute it cheaply on every request. Keep runtime inference for input that genuinely needs interpretation. And when inference is necessary, use it to turn messy input into validated structure at the boundary, rather than making every downstream component ask the model again.

The 1 + 1 Test

Before any request goes to a model:

  1. Is the answer deterministic? Can the behaviour be written as explicit rules?
  2. Is the input pattern recurring? Can its structure be formalised once?
  3. Can correctness be verified without another model's judgment?
  4. What's the lifetime cost? Per-call cost × daily requests × average attempts × 365 × years.

If the first three are yes, write the code. If the fourth makes you wince, revisit the architecture: an expensive problem doesn't automatically become deterministic, but it deserves better than sending every request to a model. And code can be quietly wrong too (Part 2 has a real example), but its mistakes are written down and fixable in one place.

Use AI to write the solution. Don't automatically make AI the solution.

The model wasn't on call. You were.

AI made building faster. It didn't automatically make systems cheaper, faster or more predictable.

A great demo proves something can work. Day two asks whether it keeps working. And that question usually arrives at 3 AM: a function starts timing out, a queue keeps growing, a connection pool runs dry. Nobody cares how quickly the original code was generated. Your pager certainly doesn't. What matters is whether someone understands the system well enough to fix it.

AI can help investigate that incident too. But someone still has to judge whether its explanation makes sense, whether its fix is safe, and what happens if it's wrong.

The model can write the code. You still own it.

Decide once

The goal of engineering was never to write less code. It was to build systems we can understand, predict, trust, and afford to run.

AI should make engineers more capable without making them understand less, and make systems smarter without making every request unnecessarily expensive.

Use models where the world is fuzzy. Use code where the answer is 2.

1 + 1 is still 2. It just shouldn't come with an invoice.


Next — Part 2: "Your LLM Is an Interpreter. Where's the JIT?" I ran a week of traffic through a model and let the system compile its own hot paths into code. The bill fell 85% in a day, and the worst bug turned out to be mine, not the model's.

Method notes: Claude Haiku 5.5 via a CLI wrapper (input tokens include its short framing), 5 runs, API-reported cost; the first call cost $0.000127 (cache write), the rest $0.0000122. Python timed with timeit on a + b with variables, not the literal 1 + 1, which Python pre-computes. Yearly = per-call × 2M × 365; last two rows illustrative.

No comments yet. Be the first to comment.

Structured Engineering in the Age of AI

Part 1 of 1

AI made building faster. It didn't make systems cheaper, predictable, or easier to understand on its own. This series is about using models where the world is fuzzy and code where the answer is 2: measured experiments, real receipts, and the engineering judgment behind them.