For most AI agents the real question isn't "VPS or serverless?" but "how many seconds does each request spend waiting?" A VPS costs the same whether it handles ten requests or ten thousand. Serverless costs nothing at ten and bills you for every second an agent sits waiting on a model at ten thousand.
I wrote a small script, ran it on 2026-10-09 with prices I checked that day, and pasted its real output below. LLM API spend is excluded because it's identical on both sides. If you want that number, my worked examples of LLM API cost per 1,000 requests cover it.
What prices does the calculator use?
| Item | Price used | Source, checked 2026-10-09 |
|---|---|---|
| Hostinger KVM 2 (2 vCPU, 8 GB) | $8.99/mo promo, $14.99/mo renewal | hostinger.com/vps-hosting |
| Hostinger KVM 4 (4 vCPU, 16 GB) | $12.99/mo promo, $28.99/mo renewal | same page |
| AWS Lambda, x86, US East | $0.20 per 1M requests, $0.0000166667 per GB-second | aws.amazon.com/lambda/pricing |
| Lambda free tier | 1M requests and 400,000 GB-seconds a month | same page |
| Cloudflare Workers Paid | $5/mo minimum, 10M requests and 30M CPU-ms included, then $0.30 per 1M requests and $0.02 per 1M CPU-ms | developers.cloudflare.com/workers/platform/pricing |
Caveats you should read before trusting any number here. Hostinger's page says each renewal price applies "for 2 years" and that all plans are paid upfront, but doesn't state the length of the promotional term, so check checkout. Prices are in USD and exclude whatever tax applies to you. The Lambda page I fetched didn't give Arm prices or say whether the free tier is permanent, so I modelled x86 and applied the free tier as written. I did not check Google Cloud Run: my fetch returned a truncated page, and I'm not going to quote its prices from memory.
How do you calculate the break-even yourself?
Lambda bills requests plus GB-seconds, where a GB-second is memory in GB times seconds the function ran. For an agent the seconds are wall time, including the time your code spends awaiting an LLM response. The core of my script:
LAMBDA_REQ = 0.20 / 1e6
LAMBDA_GBS = 0.0000166667
LAMBDA_FREE_REQ, LAMBDA_FREE_GBS = 1_000_000, 400_000
def lambda_cost(reqs, wall_s, mem_gb):
r = max(0, reqs - LAMBDA_FREE_REQ)
g = max(0.0, reqs * wall_s * mem_gb - LAMBDA_FREE_GBS)
return r * LAMBDA_REQ + g * LAMBDA_GBS
def breakeven(price, wall_s, mem_gb):
lo, hi = 0, 200_000_000 # bisection on requests per month
while hi - lo > 1000:
mid = (lo + hi) // 2
if lambda_cost(mid, wall_s, mem_gb) < price:
lo = mid
else:
hi = mid
return lo
Spot check by hand: 100,000 requests at 20 seconds and 0.5 GB is 1,000,000 GB-seconds. Subtract the 400,000 free, leaving 600,000, times $0.0000166667 is $10.00. The request charge is zero because 100,000 is inside the free million. The script agreed.
Swap in your own memory size, your own measured wall time per request, and the current price pages.
What does Lambda cost at different traffic levels?
Output from the script for a 0.5 GB function, free tier applied:
reqs/mo 3 s 20 s 60 s
10,000 0.00 0.00 0.00
100,000 0.00 10.00 43.33
500,000 5.83 76.67 243.33
1,000,000 18.33 160.00 493.33
3,000,000 68.73 493.73 1493.74
10,000,000 245.13 1661.80 4995.14
Read the columns, not just the rows. Moving from 3 to 20 seconds per request, the same million requests go from $18.33 to $160.00. Nothing about the work changed, only how long the code waited. An agent that makes three sequential LLM calls can easily live in the 20 second column. A quick classifier that makes one fast call lives in the 3 second column.
At what traffic does a VPS win?
wall 3s vs KVM2 promo $ 8.99: break-even about 625,609 requests/month
wall 3s vs KVM2 renewal $14.99: break-even about 865,936 requests/month
wall 3s vs KVM4 promo $12.99: break-even about 785,827 requests/month
wall 3s vs KVM4 renewal $28.99: break-even about 1,422,881 requests/month
wall 20s vs KVM2 promo $ 8.99: break-even about 93,841 requests/month
wall 20s vs KVM2 renewal $14.99: break-even about 129,699 requests/month
wall 20s vs KVM4 promo $12.99: break-even about 117,492 requests/month
wall 20s vs KVM4 renewal $28.99: break-even about 213,622 requests/month
wall 60s vs KVM2 promo $ 8.99: break-even about 31,280 requests/month
wall 60s vs KVM2 renewal $14.99: break-even about 42,724 requests/month
wall 60s vs KVM4 promo $12.99: break-even about 38,909 requests/month
wall 60s vs KVM4 renewal $28.99: break-even about 70,953 requests/month
Translate into something you can picture. At 20 seconds per request, the $8.99 plan breaks even at about 94,000 requests a month, which is roughly 3,100 a day or 130 an hour, round the clock. If your agent handles 200 tasks a day, serverless is almost certainly cheaper. If it handles 5,000, a VPS is.
Notice that the break-even moves when the promotional price ends. At renewal, KVM 2 at $14.99 pushes the 20 second break-even up to about 130,000. That cuts both ways: renewal makes the VPS dearer, so serverless stays attractive longer. Always compare against the price you'll pay in year two.
The fixed-price side of the ledger, for the record:
KVM2 promo $ 8.99/mo = $0.0125/hour = $107.88/year
KVM2 renewal $14.99/mo = $0.0208/hour = $179.88/year
KVM4 promo $12.99/mo = $0.0180/hour = $155.88/year
KVM4 renewal $28.99/mo = $0.0403/hour = $347.88/year
What about Cloudflare Workers?
Workers bills differently, which changes the picture. Per the pricing page, the Paid plan charges for requests and for CPU time, and says there is "no charge or limit for duration." If that holds for your code path, waiting on an LLM isn't billed the way Lambda bills it. The page I fetched did not say how waiting on fetch counts toward CPU time, so verify that against Cloudflare's docs before relying on it. I assumed 50 ms of CPU per request, which is a guess, not a measurement:
100,000 reqs: $5.00
1,000,000 reqs: $5.40
10,000,000 reqs: $14.40
30,000,000 reqs: $40.40
On those assumptions Workers is cheaper than the $8.99 VPS up to roughly 4 million requests a month (the 50 ms CPU assumption, 5 + 0.02 per million CPU-ms over 30 million, solved by hand) and cheaper than Lambda once you pass Lambda's free tier (at 3 seconds and low volume Lambda's free tier keeps it at $0, so Workers' $5 minimum loses there). At 30 million requests it costs more than any VPS plan above. The catch is what you give up: Workers is a restricted runtime built around JavaScript and TypeScript, so your existing Python agent framework and a long-lived local model won't just move over. Check which languages, libraries and limits apply to your agent on Cloudflare's docs before this table tempts you. The right comparison is rarely price alone.
What does cost not capture?
The numbers say nothing about the following, and these usually decide the matter:
| Question | Points to |
|---|---|
| Does the agent hold a websocket, run a cron schedule, or keep state in memory between calls? | VPS |
| Is traffic spiky, with long quiet stretches? | Serverless |
| Do you need Postgres, Qdrant, n8n or Ollama on the same box? | VPS |
| Will nobody patch a server this month? | Serverless |
| Does the agent run longer than a platform's maximum duration? | VPS (check each platform's current limit) |
| Do you need data to stay in one jurisdiction or on one machine? | VPS, or a regional serverless setup |
If you run n8n or a private Ollama chat, you'll want a server anyway, and then the incremental cost of adding an agent to it is close to zero. In that case the break-even above doesn't apply. The marginal cost of one more container is what matters.
The last column of hidden cost is the LLM bill. At 20 seconds and several model calls per task, API spend can exceed hosting by a wide margin, so spend your optimisation effort there first. AI agent cost optimization for multi-agent systems is the next read, and the GPU rental comparison applies the same fixed-versus-pay-per-use thinking to model hosting.
Which should you pick?
A decision rule I'd use. Estimate your monthly requests and your measured wall time per request (log it; don't guess). Compute the Lambda cost with the script. If it's below the VPS price and you don't need the right-hand column of the table above, go serverless and set a billing alarm. If it's close, or you already need a server for other services, take the VPS and stop thinking about it. Whichever you choose, put a hard cap on concurrent runs and tokens per task, because a runaway agent loop is the one thing that can make either option cost far more than this page suggests.
If you choose a VPS, Hostinger is one of several sensible sources: I used its plan prices above because they're public and the Hostinger VPS review explains how I judge it, and you can get KVM 2 here. Some links on this page are affiliate links; they cost you nothing and I only link tools I'd mention anyway. Hetzner, DigitalOcean, Linode and a home server compete on price, and the serverless platforms above are the better pick for spiky or tiny traffic. For a first deployment walkthrough, see deploying Next.js on a Hostinger VPS and the hardening checklist.



