Skip to content

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.

View as Markdown

Best Python API hosting in 2026 compared: host a FastAPI or Flask API and its PostgreSQL database on Vercel, Render, Railway, Fly.io, Heroku, Scalingo, Clever Cloud or while, cheap Python hosting in Europe

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

HostSmallest serverFree planDatabaseClosest to France
whileSee pricingA trial with no sign-up, the Libre planPostgreSQL with the API, backed up every dayIn France
VercelA function, Pro at $20 per month per personHobby, for personal useFrom a Marketplace providerParis, to pick
Render$7 per month, 512 MBA service that sleepsFrom $6 per monthFrankfurt
RailwayHobby at $5 per month, with $5 of usage$1 of credit per month after the trialPostgreSQL on requestAmsterdam
Fly.io$2.19 for 30 days, 256 MB$1 of credit for 7 daysManaged Postgres from $38Paris
HerokuEco at $5, Basic at $7 per monthNoneEssential-0 at $5 per monthEurope
Scalingo€7.20 excl. VAT for 30 days, 256 MBA free start at sign-upStarter at €7.20 excl. VATParis
Clever Cloud€4.50 for 30 days, 256 MBCredits at sign-upFree for development, dedicated at €5.25Paris

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.

Host a Python script 24/7 or at a set time: a Python script that stops with the laptop, then the same script on an always-on worker and an automation that starts it every morning, its credential kept out of the AI's reach, in France
A script that runs nonstop, another that runs every morning, and their credentials kept safe.

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 situationOur pick
Pay by the second for what runs, with no subscriptionwhile
A preview per branch, with its own datawhile
The team signed in with their email account, a client with a passwordwhile
Your AI takes the API to production, in Francewhile
A FastAPI app next to a Next.js siteVercel
Health dataScalingo

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.

The message to give your AI
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

  1. Vercel, Deploy a FastAPI app on Vercel, accessed November 19, 2026
  2. Vercel, Pricing, accessed November 18, 2026
  3. Render, Pricing, accessed November 19, 2026
  4. Render, Deploy for free, accessed November 19, 2026
  5. Railway, Pricing, accessed November 19, 2026
  6. Fly.io, Fly.io Resource Pricing, accessed November 18, 2026
  7. Heroku, Pricing, accessed November 19, 2026
  8. Heroku, Eco Dyno Hours, accessed November 19, 2026
  9. Scalingo, Pricing, accessed November 19, 2026
  10. Clever Cloud, Pricing and estimator, accessed November 18, 2026

Questions

What is the cheapest Python API hosting?

For a server that runs all the time, Fly.io, at $2.19 for 30 days with 256 MB6. With a database, Clever Cloud comes to under €10 per month, with €4.50 for the app and €5.25 for the database10.

Can you host a Python API for free?

Yes, with limits. Render has a free web service that sleeps after 15 minutes without traffic, and a free database that expires after 30 days4. Vercel Hobby is free for personal use. On while, the trial is free with no sign-up.

How to run a Python script 24/7?

In a service that does not sleep: a lone Heroku worker, a Fly.io machine, a paid Render background worker, or a service with no public address on while. A script that only needs to run at a set time can run as an automation.

Does a FastAPI app run on Vercel?

Yes. The API becomes a single Vercel Function that scales with traffic. WebSockets follow function duration limits, and shutdown cleanup gets 500 milliseconds1.

Do I need a Dockerfile for FastAPI or Flask?

No, at most hosts. On while, your API is installed from requirements.txt and started with uvicorn when its main file is at the root. Otherwise, your AI writes the command.

Do my pytest tests run?

On while, at every production release, and a failing version does not replace the previous one.

Give your AI the message, and it takes care of the rest

Give this to your AI

Read while.sh/agents and help me get started with while.

Copy the message

In 3 minutes, with no sign-up, the tool has its own address. To keep it, create your account.

For a company project, write to the while team: hello@while.sh