Browser-as-a-Service vs Self-Hosted Playwright: The Real Cost

A worked cost model for running Playwright browsers yourself versus a hosted browser API, including the engineering time most comparisons leave out.

Spectrae team · · 6 min read

Everyone underestimates the cost of running browsers in production.

You need a scraper. You spin up a server, install Playwright, and get it working. It looks cheap — one small VM. But three months in, an engineer is spending a real slice of their week on infrastructure that has nothing to do with your actual product.

This article lays out a way to do the math on self-hosting Playwright, what Browser-as-a-Service (BaaS) actually solves, and when each option makes sense. The numbers below are assumptions to replace with your own, not quotes.


The hidden complexity of production browsers

Running one Playwright script on your laptop is trivial. Running 20 parallel sessions reliably, 24/7, with auto-recovery, version management, and proper isolation is a different problem entirely.

Here's what production browser infrastructure actually requires:

  • Server provisioning — Browsers are memory-hungry. Chromium commonly needs hundreds of megabytes per instance, and a stealth Firefox build can need far more under real pages. Ten concurrent sessions can easily need a machine with several gigabytes free just for browsers
  • Docker configuration — Chromium inside Docker needs the right sandbox settings and enough shared memory (/dev/shm). Getting this wrong causes crashes that are hard to diagnose
  • Dependency management — Chrome on Linux pulls in dozens of system libraries. A fresh slim container will be missing many of them
  • Version pinning — Playwright and its browser builds must stay in sync. An unplanned upgrade can break your entire fleet at 3am
  • Session isolation — Without proper containerization, one rogue script can affect all running sessions
  • Crash recovery — Browsers crash. Your infrastructure needs to detect, restart, and not lose in-flight work
  • Monitoring — You need metrics on session counts, memory usage, browser crashes, and request queues

Each of these is a manageable problem on its own. Together, they add up to a significant ongoing maintenance burden.


The self-hosted math

Self-hosting has two cost lines: the machines and the people.

Infrastructure

Size for peak concurrency, not average. If each browser needs roughly 0.5–1 GB of RAM with headroom, 50 concurrent sessions means something like 25–50 GB of RAM across your fleet, plus CPU for rendering. Add a second machine if you need the service to survive one going down, plus storage for logs and screenshots and network egress.

Price that against your cloud provider's current rates. The important part is the shape: you pay for peak capacity all month, whether or not the browsers are busy.

Engineering time

This is the cost most teams leave out of the "build vs buy" calculation. A reasonable set of assumptions for a small fleet:

Task Frequency Assumed engineer-hours
Initial setup and Docker config One-time 20–40 hrs
Version upgrades (Playwright + browsers) Quarterly 4–8 hrs each
Crash debugging and incident response Monthly 4–10 hrs
Monitoring setup and maintenance One-time + ongoing 8–16 hrs
Scaling during traffic spikes Ad hoc 2–6 hrs

If that averages out to around 10–20 hours a month, multiply by what an hour of your engineers' time actually costs. For most teams that line is larger than the servers.


What BaaS actually solves

Browser-as-a-Service platforms like Spectrae take over the browser layer. You get a WebSocket endpoint. You connect. You use a browser. You disconnect.

The platform handles:

Isolation — Each session gets its own browser process and profile, so cookies and state don't leak between jobs, and the browsers run away from your application servers.

Version management — The provider keeps the browser server current and tested. You pin your client version and update on your schedule.

Recovery and cleanup — Crashed or abandoned sessions are cleaned up for you. No zombie processes on your machines.

Idle cost — You pay for session time, not for servers waiting for work.

Fingerprinting options — Spectrae gives you a standard Chromium browser and a Camoufox-powered stealth browser (an anti-detect Firefox build) on the same API. Switching is a one-line endpoint change.

What a BaaS does not do is remove capacity limits. Every provider caps concurrent sessions per account in some way; on Spectrae, accounts include 2 concurrent sessions and extra slots are an optional monthly add-on. Check the limit against your peak before you commit.


Cost comparison: self-hosted vs Spectrae

Spectrae bills by engine: $0.003/min for the standard browser and $0.05/min for the stealth browser, billed per second with a 20-second minimum per session. There is no per-session fee. Here is what that means for a workload of sessions averaging 3 minutes:

Monthly sessions (3 min avg) Browser minutes Standard browser Stealth browser
10,000 30,000 $90 $1,500
100,000 300,000 $900 $15,000

Compare those against your self-hosted total (machines plus engineering hours).

Two things fall out of this:

  • Standard browsing is cheap to buy. At $0.003/min, even a fairly busy workload costs less than most teams spend on an engineer's time keeping a fleet healthy.
  • Stealth browsing is priced for the sites that need it. Use the stealth engine only for protected targets and the standard engine for everything else. If you run stealth sessions around the clock at high volume, self-hosting Camoufox can become the cheaper option — provided you have the team to keep it working.

When self-hosting makes sense

Self-hosting isn't always the wrong call. There are situations where it's genuinely the better option.

You're running very high, steady volume. At serious, predictable scale, the usage costs of any BaaS add up faster than infrastructure. If your browsers are busy around the clock, do the math carefully — owning the fleet may win.

You have strict data residency requirements. Some industries (healthcare, finance, certain government contracts) require that all browser activity stays within a specific geographic or network boundary. Self-hosting gives you that control.

You already have the DevOps muscle. If your team runs a mature Kubernetes cluster and has people who think Docker networking is fun, the ongoing maintenance cost is much lower. A good platform team can absorb browser infra without much friction.

You need deep customization. Custom browser flags, proprietary fingerprint management, specialized proxy routing — if you need to modify the browser environment in ways a BaaS doesn't expose, you need to own the stack.


When BaaS is clearly better

For many teams, BaaS wins on the dimensions that matter.

You're moving fast. The fastest path from "I need a scraper" to "my scraper works in production" is a WebSocket URL and an API key. No Docker. No Linux dependency hell. No OOM debugging.

Your team is small. A two-person startup doesn't have bandwidth to own browser infrastructure. Every hour spent on that is an hour not spent on the product.

Volume is variable. If your load spikes unpredictably — a new data pipeline, a customer import job, a one-time crawl — usage pricing means you don't pay for peak capacity all month.

You've been burned before. If you've already spent weeks debugging Chrome crashes in Docker, you know the real cost. BaaS trades that time for a predictable usage bill.

You want anti-detection without building it yourself. Keeping a stealth browser maintained is ongoing work. Spectrae's stealth engine gives you a maintained, Camoufox-powered Firefox with one URL change.


The real question to ask

Don't ask "is BaaS or self-hosted cheaper?" Ask: "what is my team's time actually worth, and how busy will these browsers really be?"

If an engineer spends 15 hours a month on browser infrastructure, put a real number on those hours. Then price your actual browser minutes at the rates above. For bursty or modest workloads the answer is usually clear. For sustained, high-volume stealth workloads, run the numbers — it may favour owning the stack.


Try it for yourself

Spectrae gives you a standard Chromium browser and a stealth browser over a WebSocket, billed per second, with a $1 free credit to start. No contracts and no plan to buy.

Connect in a few minutes:

import { chromium } from 'playwright';

const browser = await chromium.connect(
  `wss://browser.spectrae.dev/standard/playwright?key=${process.env.SPECTRAE_API_KEY}`
);

const page = await browser.newPage();
await page.goto('https://example.com');
console.log(await page.title());

await browser.close();

Get your API key and see the docs for every endpoint.