I Cut My AI Inference and GPU Costs in Half With One Line of Code
I built an AI product and forgot about the inference costs. For about a month.
When I launched AIVory Guard - a compliance scanner that runs inside your IDE - the inference costs were a rounding error. A handful of beta users, maybe fifty scans a day, all hitting the same model on the same provider. The bill was predictable, and I was busy with other things.
Then usage went up. Not dramatically, not in the “we’re going viral” sense. Just steadily. And the inference line item on my monthly bill went from something I ignored to something I stared at.
The obvious fix was to switch to a cheaper provider. So I did what everyone does: I opened a spreadsheet, listed the providers, compared their prices per million tokens, picked the cheapest one, and switched. Bill went down.
For about a week.
What a price comparison misses
Providers change their prices. Not once a quarter - sometimes weekly. Spot GPU pricing changes by the hour. That spreadsheet I made was accurate on Tuesday and wrong by Friday.
Worse, the cheapest provider was also the least reliable. Requests would time out during peak hours, and my scanner would sit there waiting while a developer stared at a loading spinner. I switched back to the expensive one for reliability, and the bill went back up.
So I did the only reasonable thing and started building a router. Change one line in your code - the API base URL - and the router sends each request to whichever provider is cheapest right now and actually responding.
That became Smart Inference.
Why “cheapest” is not a strategy
The first version of the router was dumb. It sorted providers by price and picked the top one. This broke in interesting ways.
A provider would go down for ten minutes. The router would keep sending requests there because it was still the cheapest on paper. Meanwhile, three other providers were up and slightly more expensive. Fixing this meant tracking not just price but whether the provider was actually healthy - response times, error rates, timeouts over a sliding window.
Then there was the margin problem. I was routing requests but had no idea what each one actually cost me. The provider’s rate card said one thing, but the actual cost per request depended on token count, model version, and whatever the provider charged that day. So I started tracking provider cost on every single inference request. Not estimated - measured.
That is when Smart Inference stopped being a side project. The moment you know your actual cost per request, you can price your own product properly instead of guessing.
The GPU side
The other half of the platform is the spot GPU marketplace. Same idea, different layer: live pricing across clouds, per-second billing, automatic fallback when spot is unavailable. The pricing reports per-GPU cost, not per-VM cost, which changes what a comparison actually means.
I will not quote you a spot price in this article because it will be wrong by the time you read it. That is kind of the point - the price moves, and the system handles it.
What I actually learned
Building an AI product on top of other AI products means your cost structure depends on someone else’s pricing page. And those pricing pages change without warning.
The fix is not a better spreadsheet. It is a system that checks the prices continuously, scores the providers by cost and reliability together, and moves the traffic. Not revolutionary - just the plumbing that nobody wants to build themselves.
If you run inference at any real volume and you are still hardcoding a single provider, you are probably leaving money on the table. And you will find out the hard way when that provider has a bad week.
Smart Inference is at aivory.net/smart-inference if you want to see how it works.