DEV Community

How I Cut My AI Image Costs 24x by Reading the Pricing Page Properly

For weeks I planned around a number I had read somewhere.

The number was the cost of generating one image, in whatever internal units the provider billed in. I believed it was around 1363 units per image. On my free tier, that worked out to roughly five to seven images a day. My whole production plan was shaped by that ceiling.

It was wrong. The real figure for the model I was actually calling was 57.6 units per image. I had overestimated by a factor of twenty four.

Where the wrong number came from

The 1363 figure was real. It just belonged to a different model on the same platform, a heavier one I was not using. I had grabbed a number from a pricing table without checking which row it was on.

This is a very easy mistake to make and a very expensive one to keep making. When you plan around a cost that is 24 times too high, you make 24 times too many compromises. You shrink your batches. You skip the second attempt on a bad generation. You treat a non-constraint as if it were the whole problem.

How I found the real number

I read the provider's own pricing documentation, the actual page, for the specific model in my config. Not a blog post about it. The page.

There it was, per model, in a table: 57.6 units per image for the one I used. Not 1363. The number I had been planning around was someone else's number for someone else's model.

What changed once the number was right

The ceiling moved from five to seven images a day to a couple of hundred. That is the difference between a hobby and a pipeline.

Concretely, it meant I could afford to do things I had been rationing:

  • Regenerate when a generation came out bad, instead of shipping the best of a thin batch.
  • Produce full themed sets instead of sampling a few images.
  • Test ideas that might fail, because failure was now cheap.

None of the code changed. The cost per image did not change. Only my belief about the cost changed, and that belief was the thing throttling production.

The lesson

Before you optimise a pipeline around a constraint, confirm the constraint is real.

Find the source. Read the actual row in the actual table for the actual thing you are using. Cost estimates get copied between posts and tools until nobody remembers which model they came from, and you end up rationing a resource you were never short of.

The whole pipeline runs on a free tier of image generation, on a 1 CPU server with no GPU, and the reason it can is that I finally checked the real number.

The scripts and the setup are in the Pipeline Starter Kit:

The Pipeline Starter Kit

Top comments (0)