Why is AI-written code cheap to write but expensive to maintain?

Short answer

Language models brought the cost of writing code close to zero: in autumn 2026 a million lines from the cheapest models costs about a dollar. The cost of keeping it stayed where it was, because every line remains an obligation that has to be read, checked whenever something next to it changes and carried along with the system. Writing became almost free, and not writing what is not needed became an expensive skill.

Mikhail Savchenko

A dollar for a million lines

A line of ordinary code takes a language model about ten tokens. In autumn 2026 the cheapest models charge about 13 cents per million output tokens, so a million lines costs roughly a dollar. A model you would trust with real work costs some thirty times more, which is still the price of dinner for two (chapter “A Million Lines for a Dollar”).

For comparison, in 1996 the Space Shuttle’s flight software ran to 420,000 lines, and the group behind it spent 35 million dollars a year on it. That is more than 80 dollars per line, every year, for as long as the program exists (same chapter). The gap is almost a hundred million times, and the experiment “Writing a line and keeping it” shows where it goes.

Lines spent, not lines produced

In 1988 Edsger Dijkstra suggested counting lines of code as spent rather than produced, and noted that current practice books them on the wrong side of the ledger (same chapter). Once a line exists it becomes an obligation. Someone has to read it when something breaks, it has to be checked every time something nearby changes, and it can clash with lines its author never knew about. Writing used to be so expensive that the cost of keeping was forgotten. Now writing costs a dollar per million lines, and keeping costs about what it always did.

Back in 1980 Manny Lehman stated a law: as a program is changed, its complexity grows and its structure decays unless effort is spent on keeping order. Models lean towards disorder for a simple reason. Finding and reusing an existing piece is costly; writing a similar new one is cheap. GitClear, looking at 211 million lines of code, counted eight times more duplicated blocks in 2024, while the share of code that was moved and restructured fell from a quarter of all changes in 2021 to under a tenth (same chapter). The DORA report for 2024 linked a 25 percent rise in AI use to a 1.5 percent drop in delivery throughput and a 7.2 percent drop in stability (same chapter).

One change, seven links

In 1986 Fred Brooks divided the difficulties of programming into accidental ones, like translating a thought into code, and essential ones, the complexity of the problem itself. Models have nearly abolished the first kind and at the same time started producing accidental complexity on an industrial scale (same chapter). The essential complexity has not moved.

In the book I show this on a nail salon’s website. Clients are allowed to give several phone numbers, the agent is done in about three minutes, and the change touches the data schema, the migration, the logic, the links to other programs, permissions, screens and tests. The agent’s change touched two of the seven (chapter “Change One Thing Without Breaking Everything”). You can walk the chain in the experiment “Seven links behind one phone number”. The Google engineer Hyrum Wright observed that with enough users, every observable behaviour of a program will be depended on by somebody, whether it was promised or not (same chapter).

The most expensive illustration came on 1 August 2012. Knight Capital reused the switch of an old piece of code called Power Peg, installed the new version on seven of eight servers, and in forty-five minutes the system sent more than four million orders to the market. The firm lost more than 460 million dollars (same chapter). You can live through it in the experiment “Knight Capital’s forty-five minutes”. Hence the formula I consider central to the whole book: writing became almost free, and not writing what is not needed became an expensive skill. How people get there through vibe coding is in the answer on vibe coding.

More questions

How much does it cost to write code with AI?
A line of code takes about ten tokens. In autumn 2026 the cheapest models charge about 13 cents per million tokens, so a million lines costs roughly a dollar; with a strong model, a few dozen dollars.
What is Hyrum's law?
An observation by the Google engineer Hyrum Wright: with enough users, somebody will depend on every behaviour of a program that can be observed from outside, regardless of what was promised.
Nobody Writes Code Anymore

Book

Nobody Writes Code Anymore

Software development once writing became free

Writing code became almost free. What is scarce now is knowing what not to write.