Founder Insight

Why Startups Run £200K Backends for Free on Go (And When to Pick FastAPI)

Ali Parandeh, Head of Engineering / Author at Building Generative AI Services with FastAPI (O'Reilly)

Listen on TL;Listen Prefer to listen? Hear this article read aloud.

A startup charges enterprises £200,000 a year for a SaaS product. Their entire backend — 80 tables, hundreds of endpoints — runs on a free-tier cloud instance. They have not paid for compute. They are not subsidizing the customer. They are running production on what most teams consider a hobby resource.

The story sounds apocryphal until you ask what they wrote it in. Go. The binary compiles to a few megabytes. It boots in milliseconds. It runs in the memory budget of a free instance. The economics aren’t magic — they’re a runtime choice.

Ali Parandeh — chartered mechanical engineer turned AI engineer, head of engineering at a London AI consultancy, and author of Building Generative AI Services with FastAPI (O’Reilly, ~500 pages) — has seen this stack pattern several times. He builds his own services in FastAPI. He’s increasingly exploring Go for new backends. The two languages are not interchangeable, and the choice depends on more than performance.

The free-tier startup story is about binary size, not Go’s reputation

Most discussions of Go vs Python focus on benchmarks. Go is faster. Go has better concurrency. These are true but they aren’t the operational story for early-stage startups. The operational story is binary size and cold-start behavior.

“I’ve seen startups run their entire backends on a free instance on cloud environments,” Ali says. “These startups are charging enterprises 200 grand a year, but their entire backend runs for free. They have 80 tables and they have hundreds of endpoints on these backends, and they are running it, the entire thing for free because it’s been written in Go.”

Go compiles to a single static binary. No interpreter. No runtime dependency tree. The whole service is a file you can ship to a free cloud tier and start instantly. The math: free-tier instances have tight memory and CPU caps, but Go’s footprint fits inside them. Python’s interpreter plus a few AI libraries doesn’t.

That’s the entire infrastructure trick. Not exotic engineering — just a language choice that compounds into a runway extension.

FastAPI’s pitch isn’t speed — it’s the AI ecosystem

So why does Ali keep building in FastAPI? Because the choice isn’t only about runtime efficiency. It’s about what libraries you can pull in without rewriting them.

“FastAPI is really good for general purpose backends that also can be built into AI services,” he says. “Because it also comes with all the ecosystem of AI libraries. So if you need to do custom ML, saving custom ML models, serving open source models from Hugging Face, which has 2.5 million models on there, you can just pick one and start serving it.”

The Python ecosystem for AI is the whole pitch. Hugging Face transformers, scikit-learn, NumPy, PyTorch, the entire data science stack — all native Python. If your AI service does anything more than call OpenAI’s API, you need that ecosystem. Go does not have it. You’d be writing wrappers or shelling out to Python processes anyway.

Ali’s framing: Python lets you do both data science and application development in one stack. That matters when the AI engineer who designs the model is also the engineer who ships it. The handoff between “model” and “service” disappears.

The actual tradeoff is what your team can ship in three months

Most pick-a-language debates ignore the team. The right answer for a four-person AI startup with a Python-trained ML engineer is FastAPI. The right answer for a six-person backend team shipping high-throughput services with simple AI calls is probably Go. The right answer for a solo founder who already knows TypeScript is Next.js with serverless functions calling external models.

The pattern Ali keeps coming back to: build with the stack your team can ship in. Optimize for ship velocity in the first 18 months. Re-platform later if the economics or performance demand it.

He’s explicit about his own stack. “These days I just use backends mostly in FastAPI, but I’m also exploring looking at backends written in Go because Go can compile into a binary, a very small binary.”

The exploration matters. He isn’t ditching FastAPI. He’s adding Go to the toolkit for the cases where the binary-size economics matter more than the AI ecosystem. Most production teams should be doing the same calculation honestly instead of picking sides.

Where each stack fits the AI workload

A rough heuristic for picking between them on an AI service:

  • Pick FastAPI when: You’re running custom models, doing meaningful preprocessing or postprocessing, using Hugging Face directly, integrating multiple AI libraries, or your team’s strongest skills are Python. The OpenAPI-spec-by-default, async-by-default, type-checked behavior of FastAPI gets you most of the production hygiene you’d otherwise build by hand.
  • Pick Go when: Your AI calls are thin wrappers around external APIs (you’re paying OpenAI or Anthropic for inference, not running your own models), you need to fit inside tight cloud budgets, you’re optimizing for low latency at high request volumes, or your team already knows Go and can move fast in it.
  • Pick neither and use Next.js when: You’re a solo founder, the frontend is half the product, and serverless functions calling a model are enough for the early stack. The integration cost between a Python backend and a TypeScript frontend isn’t worth paying yet.

The wrong answer is choosing the language for ideological reasons. The right answer is choosing for the workload, the team, and the cost curve.

FAQ

Is Go faster than FastAPI for AI services?

For thin AI services that mostly proxy requests to external model APIs, Go is faster and uses less memory. For services that do real ML work — custom models, embeddings, preprocessing — FastAPI’s access to the Python AI ecosystem outweighs raw runtime speed. The right answer depends on whether the workload is API orchestration or actual model serving.

Why is FastAPI popular for AI backends?

FastAPI gives you async-by-default request handling, automatic OpenAPI documentation, type validation through Pydantic, and direct access to the Python ML ecosystem — Hugging Face, scikit-learn, PyTorch, NumPy. For teams shipping production AI services, the combination of production-grade web hygiene and native AI libraries is hard to beat.

Can I run an AI startup on free-tier cloud infrastructure?

Some can. If your backend compiles to a small static binary (Go is the most common example) and your AI inference happens externally on a model provider’s infrastructure, your own compute footprint can fit inside free-tier limits. The economics break when you need to host your own models — then you’re paying for GPUs regardless of language.

Should I use Go or Python for a new AI startup in 2026?

Use what your team can ship fastest. If your team is Python-strong, FastAPI gets you to production with the entire AI ecosystem available. If your team is Go-strong and your service is mostly orchestration around external model APIs, Go gets you smaller binaries and cheaper infrastructure. Don’t pick the language for ideology.

What does FastAPI give me that Flask doesn’t?

Native async support, automatic OpenAPI/Swagger docs, Pydantic-based request validation, dependency injection, and modern type hints throughout. Flask is older, simpler, and slower for high-concurrency workloads. For new AI services in 2026, FastAPI is the default. Flask is fine for small internal tools where async doesn’t matter.

How does the Python AI ecosystem compare to Go’s?

The Python ecosystem includes Hugging Face transformers, scikit-learn, NumPy, pandas, PyTorch, TensorFlow, and most AI research code. Go has near zero of this — Go AI work usually means calling external APIs or shelling out to Python. If your service does any local model work, Python wins by default.

When should I split my stack — Python for ML, Go for serving?

When the ML work and the serving work have different scaling characteristics. ML training runs on GPU instances batched over hours. API serving runs on small CPU instances handling thousands of requests per second. Separating them lets each part scale independently. Many production teams end up here even if they started with one stack.

Is Next.js a real backend for AI products?

For early-stage products where the frontend is half the product, yes. Next.js with serverless functions or API routes calling external model APIs can carry a startup from prototype through several million in revenue. The limit shows up when you need real backend hygiene — long-running jobs, complex auth, custom ML, observability. Then you add a Python or Go service alongside.

Does FastAPI work for high-concurrency AI workloads?

Yes, especially for I/O-bound workloads — calling external model APIs, streaming responses, handling many concurrent users. FastAPI’s async support means a single worker can handle hundreds of concurrent requests waiting on external calls. CPU-bound workloads (local inference, heavy preprocessing) still need horizontal scaling, but that’s true in any language.

Where can I learn how to build production-grade AI services in FastAPI?

Ali Parandeh’s Building Generative AI Services with FastAPI (O’Reilly, ~500 pages) covers the full stack — async handlers, auth, OWASP-style security, behavioral testing, observability, and FastAPI-specific patterns for LLM integration. The companion site is buildinggenai.com, which Ali plans to expand with deeper material on concurrency, streaming, and MCP.

Full episode coming soon

This conversation with Ali Parandeh is on its way. Check out other episodes in the meantime.

Visit the Channel

More from Ali Parandeh

Founder Archetype

Read Ali Parandeh's archetype profile

The Creator · Classical: Hephaestus · The Return

Related Insights