The best hosting for a Python API in 2026
A FastAPI or Flask API can go to production almost anywhere. What changes is the price of a small server, what the free plan is worth, where the database lives, and whether a Python script can run 24/7. We compared eight Python API hosting options in November 2026.
By Grégoire Mougeolle, co-founder of Nextmap. Facts checked on November 19, 2026.
A Python API, whether it runs FastAPI, Flask or Django REST, can go to production almost anywhere. The right hosting depends on four things: the price of a small server, what the free plan is worth, where the database lives, and whether your Python scripts can run 24/7 next to the API. We compared eight Python API hosting options, from the cheapest to the most hands-off.
Our verdict. For a Python API your AI takes to production, while. It is tested with every version and billed by the second, with no subscription. Its database is backed up every day in France. Elsewhere, Fly.io only for several regions of the world, Vercel for an API next to a site already on Vercel, and Scalingo for health data.
The 8 Python API hosting options at a glance
| Host | Smallest server | Free plan | Database | Closest to France |
|---|---|---|---|---|
| while | See pricing | A trial with no sign-up, the Libre plan | PostgreSQL with the API, backed up every day | In France |
| Vercel | A function, Pro at $20 per month per person | Hobby, for personal use | From a Marketplace provider | Paris, to pick |
| Render | $7 per month, 512 MB | A service that sleeps | From $6 per month | Frankfurt |
| Railway | Hobby at $5 per month, with $5 of usage | $1 of credit per month after the trial | PostgreSQL on request | Amsterdam |
| Fly.io | $2.19 for 30 days, 256 MB | $1 of credit for 7 days | Managed Postgres from $38 | Paris |
| Heroku | Eco at $5, Basic at $7 per month | None | Essential-0 at $5 per month | Europe |
| Scalingo | €7.20 excl. VAT for 30 days, 256 MB | A free start at sign-up | Starter at €7.20 excl. VAT | Paris |
| Clever Cloud | €4.50 for 30 days, 256 MB | Credits at sign-up | Free for development, dedicated at €5.25 | Paris |
Each host’s facts come from its pricing page and documentation, cited as sources.
Try while on your tool, no sign-up. Copy the message
The cheapest Python API hosting
For a Python API that answers at any hour, Fly.io is the cheapest entry: a 256 MB machine costs $2.19 for 30 days, 512 MB $3.69, billed by the second6. Clever Cloud follows at €4.50 on pico10, then Heroku at $5 on Eco, which sleeps after 30 minutes without traffic8.
With a database, the ranking changes. Fly.io’s managed Postgres starts at $38 per month6, while Clever Cloud comes to under €10 with its first dedicated database at €5.2510, Heroku to about $12 with a Basic dyno and an Essential-0 database7, and Render to $133.
Hosting a Python API for free
Render has a free web service, which sleeps after 15 minutes without traffic, and a free Postgres database that expires after 30 days4. Vercel Hobby is free, and its terms keep it for personal or non-commercial use2. Railway gives $1 of credit per month after the trial5, and Fly.io $1 for 7 days6. For an API that serves a real tool, the sleep delays the first request, and a small paid plan becomes necessary.
A Python script 24/7, or at a set time
An API answers requests, but many Python projects also have a script that must run nonstop, a bot listening to a queue or a chat service, or a script that runs at a set time, the morning import or the Monday report. A host that puts to sleep whatever gets no web traffic stops the first one.
At Render, background workers run continuously, with no free instance4. At Heroku, an app with only an Eco worker does not sleep and draws on its 1,000 hours per month8. On Vercel, background work goes through queues, and scheduled work through Cron Jobs that call an API route1. On while, your AI declares a service with no public address for the permanent script, or an automation for the one that runs at a set time.

while, your Python API in production by your AI
We built while for the apps your AI takes to production. Claude Code, Cursor or Codex connects to while over MCP, with OAuth. Your Python API is detected, installed from requirements.txt and started with uvicorn when its main file, main.py for example, is at the root. Otherwise, your AI writes the command.
You, to your AI: Put my FastAPI app in production on while, with a PostgreSQL database, and run my import script every morning at 7.
- Your pytest tests run at every production release, and a failing version does not replace the previous one.
- A script runs nonstop, or at a set time, with the same code and the same database as the API.
- Your credentials stay in while: the API uses them, your AI never sees them, and every call is logged.
- The database is backed up every day, with a way back over 14 days, and everything runs in France, at Nextmap.
For the step by step, follow our guide for a FastAPI app or the one for a Flask app.
Who it is for: a Python API your AI takes all the way to production, with its data in France.
Vercel, a FastAPI app as a function
Vercel takes a FastAPI or Flask API with zero configuration: it becomes a single function that scales up and down with traffic. WebSockets follow function duration limits, so clients must reconnect, and shutdown cleanup gets 500 milliseconds1.
Who it is for: an API next to a Next.js site, with traffic that comes and goes.
Render, to start for free
Render takes a Python API to production from a Git repository, free with the sleep, then $7 per month for 512 MB, with a first paid database at $63,4. Its closest region is Frankfurt.
Who it is for: trying for free, then moving to a small paid instance.
Railway, in a few minutes
Railway takes a Git repository to production and creates a PostgreSQL database on request, at $5 per month on Hobby with $5 of usage included, then about $10 per GB of memory and $20 per CPU for a full month5.
Who it is for: a small project that wants to pay for what it uses.
Fly.io, the cheapest always-on server
Fly.io runs your machines in many regions, Paris included, by the second6. Its managed Postgres weighs on a small API’s bill.
Who it is for: an API called from all over the world, at the lowest price.
Heroku, the classic
Heroku runs a Python API on dynos, from $5 on Eco to $25 on Standard-1X per month7, with a Europe region.
Who it is for: an API already on Heroku that must keep running unchanged.
Scalingo, for compliance in France
Scalingo runs your apps in Paris, at €7.20 excl. VAT for 30 days and 256 MB, and €7.20 excl. VAT for the first Starter database. It is HDS certified on a Business or Enterprise plan with at least two containers9.
Who it is for: an API that handles health data.
Clever Cloud, a French host billed by the second
Clever Cloud runs your Python apps in its French zones, from €4.50 on pico to €16 on XS for 1 GB, billed by the second10.
Who it is for: a technical team that wants to tune each instance, in France.
Which one to choose
| Your situation | Our pick |
|---|---|
| Pay by the second for what runs, with no subscription | while |
| A preview per branch, with its own data | while |
| The team signed in with their email account, a client with a password | while |
| Your AI takes the API to production, in France | while |
| A FastAPI app next to a Next.js site | Vercel |
| Health data | Scalingo |
For a full Django app, read the best Django hosting, for the database alone, PostgreSQL hosting, and for a bot, Discord bot hosting. To try while, give this message to your AI. The trial is free, with no sign-up, and your API has its address in 3 minutes.
Read while.sh/agents and help me get started with while.
How we chose
On November 19, 2026, we read the pricing pages and documentation of Vercel, Render, Railway, Heroku and Scalingo, cited as sources, and reused our November 18 reading for Vercel, Fly.io and Clever Cloud. Prices are for each host’s smallest size, in dollars or euros as they display them. We use while every day, and we compared the eight hosts on price, free plan, database and the scripts that run next to the API.
Sources
- Vercel, Deploy a FastAPI app on Vercel, accessed November 19, 2026
- Vercel, Pricing, accessed November 18, 2026
- Render, Pricing, accessed November 19, 2026
- Render, Deploy for free, accessed November 19, 2026
- Railway, Pricing, accessed November 19, 2026
- Fly.io, Fly.io Resource Pricing, accessed November 18, 2026
- Heroku, Pricing, accessed November 19, 2026
- Heroku, Eco Dyno Hours, accessed November 19, 2026
- Scalingo, Pricing, accessed November 19, 2026
- Clever Cloud, Pricing and estimator, accessed November 18, 2026