R&D · researched 2026-12-05

Serverless and Cloudflare for live speech

Can a CPU speech service (a Go front and Python workers, about 1 GB of models) run on Cloudflare's serverless products, and what changes when the audio is live instead of a file? Short answer: serverless is a good fit for batch and for bursts, and a poor fit for the first caller of a live stream. The design that works is an always-on base with serverless as the overflow.

  • measured our own runs: solid lines and bars, data files linked
  • sourced a price or fact read from a vendor page, with the page and date
  • modelled theory or a what-if: dashed lines, hatched bars, a dashed frame, its assumptions listed under the chart and the model script linked
  • assumption an input we chose, editable in the data

Verdict

Live streaming

Run it warm, not scale-to-zero. Cloudflare Containers can carry the service, but only as many small always-on boxes: 4 vCPU at most, amd64 only, public beta, no autoscaling, two to three streams each, about $0.125 per busy stream-hour estimate against $0.040 on EC2 Graviton4 measured capacity and $0.288 on Deepgram sourced.

Batch

A good fit. A container job that wakes, drains a queue and sleeps costs about $0.65 per 1,000 audio minutes estimate, against Deepgram's $4.30 sourced. A cold start does not matter for a file.

The first caller

"Slow first, then fine" is half true. Once the service is up, the first session is as fast as any later one measured. But an idle instance goes back to sleep and repeats the whole start on the next wake-up: about 10 to 20 seconds for a Cloudflare container estimate.

Base plus burst

The right shape. An always-on base sized for the normal load, burst capacity warmed ahead of need and only given calls after it passes a test, live calls never moved, a hosted provider as the last overflow. It saves about 70% on spiky traffic against sizing for the peak estimate, and EC2 spot is about five times cheaper than Cloudflare containers as the burst tier.

Any base plus overflow design beats sending everything to Deepgram from about 51,000 minutes a month estimate; a serverless or spot burst tier beyond Deepgram overflow starts to pay at about a million minutes a month. Below 50,000 minutes a month, a hosted provider alone is simpler and cheaper.

What Cloudflare offers today

Everything here was read from Cloudflare's own pages on 2026-12-05 sourced; the date in brackets is each page's own last modified date. "Not found" means the page does not say.

Containers: the only product that can run our workers
ItemWhat the documentation saysSource
StatusAvailable on the Workers Paid plan; launched in beta in June 2025; the newer scheduling policy is "in public beta". No page read says generally available.containers (2026-12-03), scheduling policy (2026-12-03)
Largest instance4 vCPU, 12 GiB, 20 GB disk (standard-4); custom sizes allowed within the account limits (15,000 vCPU and 60 TiB memory in total; 50 GB of images).limits (2026-12-03)
CPU"Containers should be built for the linux/amd64 architecture." No ARM. What a vCPU is, and its speed: not found.architecture (2026-12-03)
Cold start"Can often be in the 1-3 second range, but this is dependent on image size and code execution time." With the newer policy, a benchmark of small sandboxes gave a median of 648 ms.faq (2026-12-03), blog (2026-09-30)
SleepAn inactivity timeout of up to 6 hours; without one the container stops shortly after its Durable Object goes idle; billing stops when it sleeps. An open WebSocket keeps the Durable Object active.API (2026-12-03), WebSocket example (2026-12-03)
Autoscaling"Not today", planned. Routing over a pool is the developer's job; max_instances defaults to 20.faq (2026-12-03), rollouts (2026-12-03)
PlacementChosen by Cloudflare from request routing, capacity and image availability. The Durable Object and its container "are not guaranteed to run in the same location".faq (2026-12-03)
PriceCPU $0.000020 per vCPU-second, billed on active use; memory $0.0000025 per GiB-second and disk $0.00000007 per GB-second, billed on what is provisioned while the container runs; egress $0.025 per GB in North America and Europe (1 TB included). Some allowances are included on the Workers Paid plan.pricing (2026-11-13)
GPUNot found on any Containers page.limits, pricing, faq (2026-11-13 to 2026-12-03)
Workers, Durable Objects and the network in front of them
ItemWhat the documentation saysSource
Workers limits128 MB memory per isolate; CPU time per request 30 s by default, 5 minutes at most on the paid plan; no limit on how long a client stays connected. A 0.6-billion-parameter model (our final worker alone uses 1.4 GB) does not fit.limits (2026-11-25)
Workers price$5 a month minimum; a WebSocket is one request, and messages routed through a Worker are not billed; no charge for duration.pricing (2026-12-03)
Durable Objects$12.50 per million GB-seconds after 400,000; a WebSocket accepted by an object is billed on its duration for as long as it is connected; hibernation stops billing only for objects that are WebSocket servers and idle. A proxy in front of a container cannot hibernate while streams are open.pricing (2026-11-13), WebSockets (2026-11-18)
WebSocket idle timeoutCloudflare closes a WebSocket with no data "for a period of time"; no number is published. The "100 seconds" often quoted comes from a forum post, not the documentation. A release of Cloudflare's network "may restart servers, which terminates WebSockets connections".websockets (2026-08-14), connection limits (2026-11-13)
Tunnel"Available on all plans"; up to 25 replicas (100 connections) per tunnel, traffic to the closest replica. No page states a price.tunnel (2026-11-18), configuration (2026-12-03)
Load Balancing"Starting at $5/mo"; pools tried in order with a fallback pool; an unhealthy endpoint gets no new requests but existing WebSocket connections "are not terminated"; session affinity by cookie, cookie plus IP or header; monitors can match status code or a body substring (minimum interval 15 s on the limits page, 60 s on Pro on the monitor page: the two disagree).plans, health details (2026-04-16), planned maintenance (2026-07-23), session affinity (2026-11-04)
R2$0.015 per GB-month, egress free. Download speed into a container: not found; a mounted bucket is "not native SSD-like performance". Baking the models into the image is the safe choice.pricing (2026-10-30)
Hosted speech on Cloudflare: not our models
ItemWhat the documentation saysSource
Speech to textWhisper (three sizes), Deepgram Nova-3 (REST $0.0052 and WebSocket $0.0092 per audio minute) and Deepgram Flux (WebSocket $0.0077). Deepgram's own streaming price for Nova-3 is $0.0048. Rate limit for speech recognition: 720 requests per minute.pricing (2026-11-18), limits (2026-09-17)
Text to speechDeepgram Aura-1 and Aura-2 (English, Spanish) at the same price as Deepgram direct; MeloTTS is listed as deprecated from 2026-11-20.models (2026-08-12)
Realtime, voice agentsThe WebRTC SFU is $0.05 per GB of egress (first 1,000 GB free); RealtimeKit's transcription uses Deepgram Nova-3; the Agents voice SDK (beta) plugs in speech providers but offers no bring-your-own-model pipeline. None of it hosts our workers.SFU (2026-09-22), RealtimeKit (2026-11-05), voice (2026-11-21)

Cold start: where the time goes

We started the service from nothing on a spare set of cores and a separate port (never the running service), with the model files evicted from the operating system's cache so that they came from disk, and timed it measured. Process start to ready took 8.0 to 8.7 seconds (6.2 s with a warm cache). The service reports healthy only after every worker has loaded, so ready means "can take a stream". The critical path is the final worker loading Whisper small (5.2 s) and then Parakeet (2.6 s) one after the other; the streaming workers load in parallel in 3.9 s.

Then the first stream was no slower than later ones: first partial 0.90 to 0.91 seconds on the very first session and on the second. There is no warm-up inside the service.

On Cloudflare the container start (1 to 3 s from the documentation) and an image pull come first. Our image is about 2 GB; pulling it to a host that does not have it is not documented and was not measured, so the Cloudflare columns are an estimate of 10 to 20 seconds for the first caller after an idle period.

Models loaded against time in the measured cold-disk run (docs/data/cloudflare_load_timeline.csv)
eventsecondsmodels loaded of 7status
process start00measured
three fast workers loaded4.63measured
Whisper small loaded in both final workers6.15measured
Parakeet loaded in both final workers: ready8.77measured
Cold start runs and the Cloudflare estimate (docs/data/cloudflare_coldstart.csv)
runstatuscontainer start simage pull smodel load stotal sfirst partial s
local cold disk run 1measured008.78.70.91
local cold disk run 2measured00880.9
local warm page cache run 1measured006.26.20.9
local warm page cache run 2measured006.26.20.9
Cloudflare container first caller (low)modelled118100.95
Cloudflare container first caller (high)modelled388.719.70.95

Keeping warm, and what it costs

There is no "minimum instances" setting in the pages read. An instance stays awake while an open WebSocket keeps its Durable Object active, with an inactivity timeout of up to six hours, or with a periodic touch from a cron Worker. Because CPU is billed on active use only, an idle 4 vCPU / 8 GiB container costs only the provisioned memory and disk: about $56 a month (about $83 for the preset 12 GiB size) plus about $4 for the Durable Object that fronts it estimate. Caveat: the pricing page does not define "active"; if a container's whole running time were billed on its vCPUs, the always-warm fleet would cost about three times more. The first invoice of a test settles it.

Real-time fit: size, routing, limits

QuestionAnswerStatus
Does our 24-core layout fit?No. The reference layout is 24 worker processes (18 fast, 6 final) on 24 vCPUs and about 20 GB, carrying 28 streams cleanly on Graviton4 (first partial 1.0 s, final 1.1 s). A container is at most 4 vCPU, so the design becomes six containers of 3 fast and 1 final worker. Memory is not the limit (3.5 to 5 GB per container, 8 GiB is enough); cores are.measured layout and capacity
Streams per containerGraviton4 carries 1.17 streams per vCPU at the knee, AMD c7a 0.83, Intel c7i 0.50. Cloudflare is amd64 only and does not say what its vCPU is, so a 4 vCPU container carries about 1.7 to 2.8 streams after our 0.85 derate: plan on 2. Six containers carry 10 to 17 streams, not 28.measured on EC2, estimate for Cloudflare
Session affinityA stream is one WebSocket that stays on one container for life (decoder state, voice-activity state, the open utterance). Affinity is by Durable Object id; the routing layer that picks a container for a new caller is ours to write.sourced design
Burst of new callersThere is no autoscaling, and each new container pays the full cold start for two or three streams. The platform can start thousands of small containers quickly; our 2 GB image and model load are the slow part.estimate
WebSocket limits and reconnectsNo maximum duration is documented; the idle timeout is unpublished, so clients ping every 20 to 30 s. Connections are not durable (a release of the network can restart servers), and the service has no resume: clients keep a ring buffer and resend the last seconds after reconnecting.sourced
Edge hopThe client reaches Cloudflare's edge in 21 to 59 ms here (TCP connect, three samples). The extra Worker, Durable Object and container legs are not measured; the object and container may be in different places. We estimate 10 to 60 ms each way, 20 to 120 ms in all, 2 to 13% of a 0.95 s first partial.measured to the edge, estimate beyond
Long connections against batchLive: a Worker bills no duration; the Durable Object in front of a container is a fixed few dollars a month, shared by its streams; memory and disk are billed all the time the container is awake, CPU only for the audio decoded. Batch: the container is awake only while it works.sourced prices

Streams per instance, capacity curves and latency

Measured on EC2 (the left chart's first three bars and the capacity curves), against an assumed Cloudflare container. A server is full at the knee, where the lag of the finals starts to climb; the planning value keeps 15% back.

Time to first partial, direct and through the edge (docs/data/cloudflare_latency_budget.csv)
pathstatusservice first partial sextra path stotal snote
direct to the servicemeasured0.9500.95median first partial after speech starts
through the Cloudflare edge: lowmodelled0.950.020.9710 ms each way
through the Cloudflare edge: highmodelled0.950.121.0760 ms each way

Cost model

The model is docs/data/costs.py with the prices and assumptions in docs/data/costs.csv; every row carries its status, source and the date it was read (table at the end of this section). Cloudflare is modelled as 4 vCPU / 8 GiB containers carrying two streams, CPU billed on active use, the included allowances applied, a Durable Object per container and the $5 Workers plan. Operations hours are left out of every column.

Break-even points, the first monthly volume at which the first option costs less than the second (docs/data/cloudflare_breakevens.csv; the grid starts at 2,000 minutes, so 2100 means cheaper from the start)
trafficoptioncheaper thanminutes per monthstatus
roundclockCloudflare containers (scale to zero)deepgram2100modelled
roundclockCloudflare containers (always warm)deepgram37700modelled
roundclockEC2 Graviton4 on-demanddeepgram59700modelled
roundclockEC2 Graviton4 1-year plandeepgram44800modelled
roundclockOwn desktopsdeepgram10600modelled
roundclockEC2 Graviton4 on-demandcf_scale_to_zero94600modelled
roundclockEC2 Graviton4 on-demandcf_always_warm106200modelled
businessCloudflare containers (scale to zero)deepgram2100modelled
businessCloudflare containers (always warm)deepgramnever under 31Mmodelled
businessEC2 Graviton4 on-demanddeepgram112500modelled
businessEC2 Graviton4 1-year plandeepgram44800modelled
businessOwn desktopsdeepgram10600modelled
businessEC2 Graviton4 on-demandcf_scale_to_zeronever under 31Mmodelled
businessEC2 Graviton4 on-demandcf_always_warm71000modelled
Monthly cost, traffic round the clock (docs/COSTS.md section 11a; Cloudflare columns are a model, the others use measured capacity and list prices read 2026-12-04 and 2026-12-05)
Minutes/monthPeak streamsDeepgram PAYGWorkers AI Nova-3 WSCloudflare Containers always-warmCloudflare Containers scale-to-zeroEC2 c8g on-demandEC2 c8g 1-yr SPi9 desktop class (amortised)
10,0000.3$48.0$92.0$138 (2x)$32.0 (up to 1x)$275 (2x xlarge)$209 (2x xlarge)$48.2 (1x)
100,0003.4$480$920$268 (2x)$296 (up to 2x)$277 (2x xlarge)$211 (2x xlarge)$48.2 (1x)
1,000,00034$4,800$9,200$2,530 (18x)$2,970 (up to 18x)$1,239 (5x 2xlarge)$909 (5x 2xlarge)$241 (5x)
10,000,000342$48,000 (over concurrency limit)$92,000$24,789 (172x)$29,709 (up to 172x)$11,849 (49x 2xlarge)$8,619 (49x 2xlarge)$2,074 (43x)
The same with traffic in business hours (Cloudflare always-warm cannot be scheduled off, so it does not fall)
Minutes/monthPeak streamsDeepgram PAYGWorkers AI Nova-3 WSCloudflare Containers always-warmCloudflare Containers scale-to-zeroEC2 c8g on-demandEC2 c8g 1-yr SPi9 desktop class (amortised)
10,0001.1$48.0$92.0$138 (2x)$32.0 (up to 1x)$275 (2x xlarge)$209 (2x xlarge)$48.2 (1x)
100,00011$480$920$510 (6x)$296 (up to 6x)$510 (2x 2xlarge)$378 (2x 2xlarge)$96.5 (2x)
1,000,000114$4,800$9,200$4,884 (57x)$2,970 (up to 57x)$4,082 (17x 2xlarge)$2,961 (17x 2xlarge)$724 (15x)
10,000,0001136$48,000 (over concurrency limit)$92,000$48,746 (569x)$29,709 (up to 569x)$38,856 (163x 2xlarge)$28,109 (163x 2xlarge)$6,898 (143x)
Pre-recorded audio, estimated, with the Cloudflare container row
Option (pre-recorded audio)$ per audio minute$ per 1,000 audio minutesStatus of the number
Deepgram Nova-3 PAYG$0.0043$4.30published
Deepgram Nova-3 Growth$0.0036$3.60published
Deepgram Whisper Large$0.0048$4.80published
Amazon Transcribe batch$0.006$6.00from AWS's own example; tiers not read
Cloudflare Workers AI Whisper (large-v3-turbo)$0.0005$0.50published; audio leaves our machines
Our service on Lambda, Parakeet, container image$0.00159$1.59estimate from our CPU numbers; no cold-start or idle cost
Our service on c8g.4xlarge on-demand, queue, 90% busy$0.00043$0.43estimate
Our service on a Cloudflare container (4 vCPU / 8 GiB, scale-to-zero, queue)$0.00065$0.65estimate; amd64 only, vCPU speed not stated, needs the proof
Same on spot$0.00023$0.23estimate; spot price is third party

Reading it: scale-to-zero containers are cheaper than Deepgram at any volume shown and cheaper than EC2 Graviton below about 95,000 minutes a month on round-the-clock traffic; always-warm containers undercut Deepgram from about 38,000 minutes round the clock but never on business-hours traffic; Graviton on a 1-year plan undercuts Deepgram from about 45,000; and at volume containers cost about twice EC2 Graviton and five to fifteen times our own hardware. All of this assumes capacity we have not measured on Cloudflare.

Every Cloudflare price, limit and assumption in the model, with status, source and date read docs/data/costs.csv
Cloudflare prices, limits and model assumptions, from docs/data/costs.csv: each with its status, source and the date it was read
itemvalueunitstatussourcedate read
cf_wai_whisper_min0.0005USD per audio minuteverifiedhttps://developers.cloudflare.com/workers-ai/platform/pricing/ (dateModified 2026-11-18)2026-12-04
cf_wai_nova3_min0.0052USD per audio minuteverifiedhttps://developers.cloudflare.com/workers-ai/platform/pricing/2026-12-04
cf_wai_nova3_ws_min0.0092USD per audio minuteverifiedhttps://developers.cloudflare.com/workers-ai/platform/pricing/2026-12-04
cf_wai_flux_ws_min0.0077USD per audio minuteverifiedhttps://developers.cloudflare.com/workers-ai/platform/pricing/2026-12-04
cf_wai_aura2_1k0.03USD per 1000 charactersverifiedhttps://developers.cloudflare.com/workers-ai/platform/pricing/2026-12-04
cf_wai_melotts_min0.0002USD per audio minuteverifiedhttps://developers.cloudflare.com/workers-ai/platform/pricing/2026-12-04
cf_wai_neuron_1k0.011USD per 1000 neuronsverifiedhttps://developers.cloudflare.com/workers-ai/platform/pricing/2026-12-04
cf_workers_paid_month5USD per monthverifiedhttps://developers.cloudflare.com/workers/platform/pricing/2026-12-03
cf_container_vcpu_s0.00002USD per vCPU-secondverifiedhttps://developers.cloudflare.com/containers/platform/pricing/ (dateModified 2026-11-13; billed on active CPU)2026-12-04
cf_container_gib_s0.0000025USD per GiB-secondverifiedhttps://developers.cloudflare.com/containers/platform/pricing/ (provisioned memory)2026-12-04
cf_container_standard4_vcpu4vCPUverifiedhttps://developers.cloudflare.com/containers/platform/limits/2026-12-04
cf_container_standard4_gib12GiBverifiedhttps://developers.cloudflare.com/containers/platform/limits/2026-12-04
cf_container_egress_gb0.025USD per GBverifiedhttps://developers.cloudflare.com/containers/platform/pricing/ (North America and Europe; 1 TB included)2026-12-04
cf_do_request_million0.15USD per millionverifiedhttps://developers.cloudflare.com/durable-objects/platform/pricing/2026-12-04
cf_do_gb_s_million12.5USD per million GB-secondsverifiedhttps://developers.cloudflare.com/durable-objects/platform/pricing/2026-12-04
cf_r2_gb_month0.015USD per GB-monthverifiedhttps://developers.cloudflare.com/r2/pricing/2026-12-04
cf_tunnel_month0USD per monthmodelledTunnel docs say available on all plans; no pricing page was read2026-12-04
cf_container_disk_gb_s7e-8USD per GB-secondverifiedhttps://developers.cloudflare.com/containers/platform/pricing/ (dateModified 2026-11-13; provisioned disk)2026-12-05
cf_container_incl_gib_h25GiB-hours per monthverifiedhttps://developers.cloudflare.com/containers/platform/pricing/2026-12-05
cf_container_incl_vcpu_min375vCPU-minutes per monthverifiedhttps://developers.cloudflare.com/containers/platform/pricing/2026-12-05
cf_container_incl_disk_gb_h200GB-hours per monthverifiedhttps://developers.cloudflare.com/containers/platform/pricing/2026-12-05
cf_do_incl_gb_s400000GB-seconds per monthverifiedhttps://developers.cloudflare.com/durable-objects/platform/pricing/ (dateModified 2026-11-13)2026-12-05
cf_lb_month5USD per monthmodelledhttps://www.cloudflare.com/plans/network-cdn.md (Starting at $5/mo; per-origin and per-request prices not found)2026-12-05
cf_container_custom_gib8GiBassumptioncustom instance sizes are allowed within the account limits (https://developers.cloudflare.com/containers/platform/limits/)2026-12-05
cf_container_ref_typec7a.2xlargeinstance typeassumptionCloudflare does not state the vCPU model or speed (amd64 only); we plan with the measured AMD c7a figure per vCPU2026-12-05
cf_streams_per_container2streamsassumptionfloor(4 vCPU x 0.83 measured streams per vCPU x 0.85 derate) = 2 on c7a-like vCPUs; 1 on c7i-like2026-12-05
cf_fill0.5fractionassumptionaverage fill of the containers that are awake under scale-to-zero (streams are not packed perfectly)2026-12-05
cf_session_min5minutesassumptionaverage call length2026-12-05
cf_wake_fraction0.1fractionassumptionshare of sessions that arrive at a sleeping container and wake it2026-12-05
cf_sleep_after_min2minutesassumptioninactivity timeout kept as a tail after the last session (the docs example uses 2 minutes)2026-12-05
cf_cold_start_local_s8secondsmeasuredlocal test instance on i9-14900K desktop efficiency cores 16-22 2026-12-05 with the model files evicted from the page cache (8.0 and 8.7 s; 6.2 s with a warm cache): process start to /health 200 (docs/CLOUDFLARE-SERVERLESS.md)2026-12-05
hy_hour_peak1.25factorassumptionpeak concurrency inside an hour against the hour's mean (capacity must cover the peak; the earlier tables use 1.5 against a window average)2026-12-05
hy_warm_lead_cf_min0.5minutesassumptionpre-emptive start of a Cloudflare container until health check and test transcript pass (docs: 1-3 s container start; 8 s model load measured; image pull unmeasured: this is optimistic)2026-12-05
hy_warm_lead_ec2_min2minutesassumptionEC2 launch from a pre-baked AMI in an Auto Scaling group until the same checks pass (launch 60-90 s plus 8 s model load)2026-12-05
hy_drain_min2minutesassumptiontime a burst instance stays after its last session before it is released (the hysteresis against flapping)2026-12-05
hy_burst_fill0.7fractionassumptionfill of burst instances that were started on purpose (sessions are steered to them)2026-12-05
hy_base_threshold0.65fractionassumptionbase utilisation at which the router starts warming burst capacity2026-12-05
hy_spot_discount_note0n/aassumptionc8g spot price per vCPU is taken from c8g.4xlarge ($0.349 an hour; third-party Vantage figure) and scaled linearly to c8g.xlarge2026-12-05
hy_handoff_replay_cpu_s_per_audio_s0.59cpu-s per audio-smeasuredsame as the streaming cost: a replay is decoded like live audio2026-12-05
hy_min_base_share0.25fractionassumptionwith a Cloudflare or spot burst tier the base always carries at least this share of the peak (spot and warm-up capacity cannot be trusted to be the whole fleet: spot pools run dry and give 2 minutes notice)2026-12-05

Base plus burst: an always-on server in front, serverless behind it

The idea: an always-on base, our own machines or EC2, takes the traffic. When it passes a utilisation threshold (65% here) a serverless tier is warmed in advance; new sessions go to it only after a health check and a test transcript; it is drained and released after the burst. New sessions are routed; live ones are never moved. A call that finds everything full falls back to a hosted provider, which our clients already support. It is the only way serverless makes sense for live audio, because the cold start is hidden behind capacity that is already running.

Base plus burst: new calls go to the always-on base first, to warm burst capacity second and to a hosted provider last1. below 65%2. when READYstart, test, mark READYCallers and clientsCloudflare edge:hostname, TLS, ratelimitRouter: pools in orderBase pool, always onBurst pool, warmWarm-up controller:reads sessions andcapacity3. Hosted provider, whenall is full
A burst instance is started before it is needed, tested, and only then given calls; a call that finds everything full goes to the hosted providerClientRouterBaseControllerBurst instanceopen streambase at 58%: use the basebase reaches 65%start two instances nowload models, about 8 shealth check, then test clip200 and the expected textmark readyopen stream (base at 90%)new call goes to the burst instanceopen stream (everything full)503 CAPACITY: use the hosted provideridle 2 min: drained, released

Readiness gate and warm-up arithmetic

Instance up is not ready. The controller waits for the health check (the service answers healthy only after every worker has loaded) and then streams a 6.5-second sample and compares the text. Only then does the router see the instance. Warm-up must finish before the base fills: the base can take (1 minus the threshold) times its capacity while the burst tier warms, so the arrival rate it can absorb is that headroom divided by the warm-up time. For a 28-stream base at 65%, about 10 streams of headroom: a 20-second warm-up covers about 30 new sessions a minute, a 2-minute EC2 launch about 5 a minute estimate. A working day's ramp fits both; a flash crowd fits neither, and that is what the hosted provider is for.

The warm pool over a campaign day

A simulated day estimate: a base of 24 streams, a campaign from 13:00 that roughly quadruples the load, and a six-minute flash crowd at 14:30. The controller warms burst instances when the forecast passes 65% of the base; they take calls two minutes later and are released when the load no longer needs them. The numbers are a fluid model (docs/data/burst_sim.py), not a measurement.

modelleda fluid model of streams (burst_sim.py), not a measurement

Base plus burst over a simulated day

An always-on base, burst instances warmed ahead of the load, the hosted provider for what nothing can take. Play, pause, scrub, or pick a scenario.

Interactive animation of the modelled campaign day. On the left, callers arrive as moving dots. A base server of 24 stream slots (six units of four) fills with amber light as demand rises. When the forecast passes 65% of the base, burst instances appear on the right with a green warm-up bar that fills over two minutes; once ready they light blue and take new sessions. During the flash crowd at 14:30 (peak about 70 streams) the hosted-provider cloud at the top right lights red with the streams nothing else could take. After the campaign the instances drain and disappear. Readouts show the simulated clock, streams wanted, served on the base, on burst instances and by the hosted provider, instances ready and starting, and base utilisation. Over the charted day: 53.7 stream-hours on burst instances and 0.6 on the hosted provider.

Modelled: the same simulated day as the charts below (docs/data/burst_sim.py; the scene runs a line-for-line port of it, checked against the CSV). The scenarios are the ones the modelled charts vary: ramp length, warm-up lead, threshold and base size. Nothing here was measured on a cloud; the warm-up time is an assumption.
Modelled: the assumptions behind this animation
  • A simulated day in one-minute steps: business-day demand of 5 to 11 streams, a campaign from 12:40 to 16:20 at about four times the load with 20-minute ramps, and a six-minute flash crowd of 30 extra streams at 14:30.
  • Base 24 streams (six 4-stream Graviton4 units); burst instances of 4 streams, ready 2 minutes after start (assumed; not measured); warm-up at 65% of the base; one spare plus the forecast overflow; release after 2 idle minutes; the hosted provider takes the rest instantly.
  • A fluid model of streams: no individual calls, session lengths or failures. The moving dots are a drawing of the shares, not calls.

Model script: burst_sim.py · re-run: python3 docs/data/burst_sim.py

Two ways to build the router
Cloudflare Load Balancing and TunnelA Worker with a Durable Object registry
How it picksPools in order, base first; a monitor on a readiness URL makes the base "unhealthy" for new sessions above the threshold, so the next pool gets themThe Worker asks a registry (open sessions and readiness per backend) and proxies the WebSocket to the chosen backend
Open streams when a pool flipsNot terminated, per Cloudflare's documentation sourcedUnder our control
Reaction timeMonitor interval, retries and up/down counts: 30 to 120 s estimateSeconds, if the Worker reads each backend's health itself
CostFrom $5 a month plus Tunnel (price not stated)$5 Workers plan plus about $4 for an awake registry object
NeedsA small service change: a readiness URL that fails above a configurable utilisationOur proxy code in the audio path

Recommended: Load Balancing pools for the data path (no code of ours in the audio path) and a small cron Worker for the warm-up controller; move to the Worker router only if the monitor interval proves too slow.

Can a live stream be handed off mid-call? Measured

A stream carries decoder state and the service has no resume, so we tested what a handoff costs: three LibriSpeech clips (10.4, 3.3 and 6.6 s) with pauses, a second fresh session standing in for the new backend, compared with the same audio in one session measured, one machine, no network in the path.

Mid-call handoff test (docs/data/cloudflare_handoff.csv), words that differ from an uninterrupted session and the final lag after the moved utterance
scenarioreplay audio sreplay speedwords differing pctfinal lag sbaseline final lag s
at a pause after the final: no replay0n/a00.570.58
at a pause: replay of the last 1 s1200.560.58
at a pause: replay of the last 3 s3200.560.58
mid-utterance (5 s into 10.4 s): replay from utterance start at 2x5202.12.15
mid-utterance: replay from utterance start at 4x5402.132.15
mid-utterance: no replay0n/a25.9n/a2.15
  • At a pause a handoff is free: after a final and a short silence there is nothing to rebuild; the new backend can start with no replay.
  • Mid-sentence it works if the proxy replays the open utterance: the model state rebuilds from the audio and the result was identical, with the final on time. The glitch is a 1.25 to 2.5 second stall while the audio so far is replayed at 2 to 4 times real time, and about 3 CPU-seconds for 5 s of audio. Keep the replay at 2x or below on a shared host.
  • Without replay, 25.9% of the words of the sentence were lost.
  • Someone has to hold the audio since the last final (a ring buffer of at most one utterance), offset the new session's timestamps and drop duplicate finals. That proxy does not exist yet, so the first version routes new sessions only; handoff becomes worth building for drain-and-deploy and for spot interruptions (two minutes' notice).

Cost: a base for the normal load against sizing for the peak

Base: Graviton4 units of 4 vCPU (about 4 streams each, measured), always on, at least two, behind the Cloudflare front door. Traffic shapes: business hours, round the clock, and business hours plus four three-hour campaigns at four times the load. The size of the base is the cheapest for each case; warm-up waste is included estimate.

Monthly cost by traffic shape and design (docs/COSTS.md section 11b, from docs/data/costs.csv rows hy_*)
TrafficMinutes/monthPeak streamsAll on Deepgram PAYGEC2 c8g sized for the peak, always onBase + Deepgram overflowBase + Cloudflare containers burstBase + EC2 spot burstOwn machines base + Deepgram overflow
business hours100,00011$480$366 (3x)$323 (base 2x, burst 24%)$289 (base 2x, burst 15%)$254 (base 2x, burst 3%)$101 (own base 2x)
business hours1,000,000109$4,800$3,378 (28x)$3,147 (base 22x, burst 16%)$2,334 (base 7x, burst 64%)$1,179 (base 7x, burst 28%)$680 (own base 14x)
business hours10,000,0001089$48,000$33,129 (275x)$31,429 (base 220x, burst 16%)$23,225 (base 69x, burst 64%)$11,646 (base 69x, burst 29%)$6,586 (own base 136x)
round the clock100,0004$480$246 (2x)$246 (base 2x, burst 0%)$246 (base 2x, burst 0%)$246 (base 2x, burst 0%)$101 (own base 2x)
round the clock1,000,00044$4,800$1,450 (12x)$1,340 (base 11x, burst 1%)$1,261 (base 9x, burst 14%)$674 (base 3x, burst 46%)$294 (own base 6x)
round the clock10,000,000445$48,000$13,616 (113x)$13,241 (base 107x, burst 3%)$12,519 (base 92x, burst 11%)$6,648 (base 29x, burst 47%)$2,692 (own base 55x)
business hours plus 4 campaign days100,00037$480$1,209 (10x)$349 (base 2x, burst 29%)$407 (base 3x, burst 10%)$376 (base 3x, burst 2%)$158 (own base 2x)
business hours plus 4 campaign days1,000,000366$4,800$11,207 (93x)$3,421 (base 18x, burst 36%)$3,278 (base 24x, burst 12%)$2,986 (base 24x, burst 3%)$1,330 (own base 12x)
business hours plus 4 campaign days10,000,0003660$48,000$111,180 (923x)$34,082 (base 184x, burst 35%)$31,656 (base 231x, burst 12%)$28,745 (base 231x, burst 3%)$13,127 (own base 115x)
First monthly volume at which each design beats sending everything to Deepgram pay-as-you-go
TrafficBase + Deepgram overflow beats all-Deepgram fromBase + Cloudflare burst fromBase + EC2 spot burst fromPeak-sized always-on EC2 from
business hours51k52k51k51k
round the clock51k51k51k51k
business hours plus campaign days59k56k52knever (under 30M)
  • The saving depends on how spiky the traffic is: steady traffic gains little (round the clock, $1,450 against $1,261 to $1,340 at a million minutes); campaign traffic falls from $11,207 for a fleet sized for the peak to about $3,000 to $3,400, about 70% less.
  • The cost curve is flat around the optimum (a base of 2, 5, 10 or 20 units costs within 25% of each other at a million business-hour minutes): choose the base for resilience and ramp speed, not the last dollar.
  • Hosted overflow needs no warm-up and no router state, but pay-as-you-go caps live streams at 150; a campaign peak of hundreds needs a contract. Own machines as the base are the cheapest base of all.
Burst tiers compared
Burst tierWarm-up to hidePer busy stream-hourFit
Hosted provider (Deepgram)none$0.288 sourcedBest first overflow, already in the clients; concurrency caps; audio leaves our network
EC2 Auto Scaling group, spotabout 1.5 to 2 min assumptionabout $0.031 estimateCheapest burst tier at volume; spot gives two minutes' notice before it reclaims an instance (AWS); warm pools do not support Spot in mixed groups (AWS)
EC2 on-demand groupsameabout $0.057 estimateCan use a warm pool of stopped instances (pay only for the disks)
Cloudflare Containers10 to 20 s estimateabout $0.163 estimateAcceptable as a small pool; 4 vCPU per container; no autoscaling; beta

Scenarios and what-ifs modelled

Everything in this section is theory. These charts are produced by scripts from stated assumptions; none of the dashed lines or hatched bars is a measurement. Each chart lists its assumptions under it and links the script, which is in the repository and downloadable here: scenarios.py, burst_sim.py, costs.py. Change an assumption, re-run (python3 docs/data/scenarios.py), rebuild the site, and the charts redraw.

Cold start under different assumptions

The one measured number is the local start (8.7 s). Everything on Cloudflare depends on how long an image pull takes, which Cloudflare does not document, and on how the service loads its models. Modelled: 9.7 s if the host already has the image, 15.7 s if a 2 GB image is pulled at 400 MB/s, 31.7 s at 100 MB/s. Loading Whisper and Parakeet in parallel saves about 2.6 s; serving the English route first (Parakeet only) saves about 4.1 s. So the cheapest improvement is in our own start-up code, not in the platform.

Cold-start scenarios (docs/data/cloudflare_scen_coldstart_summary.csv)
scenarioplatform overhead sloading sready sbasis
Local service, measured08.78.7measured
Cloudflare, image already on the host (start 1 s)18.79.7modelled
Cloudflare, start 2 s + pull 2 GB at 400 MB/s78.715.7modelled
Cloudflare, start 3 s + pull 2 GB at 100 MB/s238.731.7modelled
As the 400 MB/s case, Whisper and Parakeet loaded in parallel76.113.1modelled
As the 400 MB/s case, English route only (Parakeet, no Whisper)74.611.6modelled

Burst response: a sudden step of 20 streams

What happens in the first five minutes if 20 streams arrive at once while the base is full: the hosted provider catches what no warm instance can take. The slower the controller notices (a Load Balancing monitor takes about 60 s) and the slower the warm-up (a Cloudflare container 20 s, an EC2 spot instance 120 s, both assumed), the longer the spill. Modelled spill in the first five minutes: 8 stream-minutes with a Worker router and containers, 60 with a monitor and spot instances, 17 if three instances were already warm. At Deepgram's $0.0048 a minute that is 4 cents to 29 cents per step: a slow burst tier costs little money when a hosted overflow exists; what it costs is dependence on that overflow.

Burst response summary (docs/data/cloudflare_scen_burst_response_summary.csv)
scenarioreaction delay swarm up sspill stream minutes in 5 minspill cost usdbasis
Worker router, Cloudflare container (2 streams each), warm-up 20 s5208.30.04modelled
Load Balancing monitor, Cloudflare container, warm-up 20 s602026.70.128modelled
Worker router, EC2 spot instance (4 streams each), warm-up 120 s512041.70.2modelled
Load Balancing monitor, EC2 spot, warm-up 120 s60120600.288modelled
Pre-warmed: threshold crossed earlier, 3 spot instances already ready512016.70.08modelled

Warm pool and base plus burst over a simulated day

The campaign-day charts in the section above show one run. Here the same simulation is varied. Lead time only matters when the load ramps fast: with a 5-minute ramp a 10-minute warm-up spills about 2.2 stream-hours to the hosted provider in the day; with a 20-minute ramp about 0.2; with an hour's ramp nothing. A lower threshold helps only when the warm-up is slow (40 to 50% instead of 65% cuts the spill by about a quarter at a 5-minute lead), at the price of more burst instance-hours. The base size is a resilience decision, not a cost one: in the model the cheapest base is the smallest (about $15 a day for 12 streams against $25 for 24 and $61 for 64) because burst capacity covers the campaign, but that assumes the burst tier is ready on time.

Cost across volumes if the Cloudflare vCPU were different

The biggest unknown is the speed of a Cloudflare vCPU. If it is like an Intel c7i (0.5 streams per vCPU), always-warm containers cost about as much as Deepgram at a million minutes a month (about $4,500 against $4,800). If it is like an AMD c7a, about $2,500. If it were Graviton4-class (it is not on offer: Cloudflare is amd64 only), about $1,750, still above EC2 Graviton4's $1,240. A vCPU twice as fast as c7a gets to about $1,150. And if "active CPU" billing turned out to mean the whole running time, the AMD-like always-warm figure roughly doubles, to about $4,900.

Capacity as clock speed or core count changes

Measured knees on 24 vCPUs: 28 streams on Graviton4 (2.7 GHz), about 20 on AMD c7a (3.5 GHz) and 12 on Intel c7i (3.2 GHz, scaled from a smaller run). Fitting a straight proportionality to clock speed times per-clock work through each point gives what faster or slower silicon would do: at 4.5 GHz, about 47, 26 and 17 streams. More cores help linearly up to the 24 we measured; beyond that the model assumes each doubling loses 8% to the shared final-pass pool, which is a guess: a 96-vCPU Graviton4 would carry about 94, not 112. Nothing here is measured away from the measured points.

Re-running the scenarios

Three scripts in docs/data/ (Python 3, no dependencies) write the CSVs that these charts read:

  • python3 docs/data/costs.py: the cost model, the break-even points and the cost curves (reads costs.csv and instances.csv, where each price carries its source and date).
  • python3 docs/data/burst_sim.py: the campaign-day warm-pool simulation (and the functions the grid below uses).
  • python3 docs/data/scenarios.py: cold-start timelines, burst response, the threshold, lead and base-size grid, the vCPU cost what-ifs and the clock and core what-ifs. The assumptions are the constants at the top of the file.

The data files are served under /data/ and the scripts next to them.

Warm-pool grid, hosted overflow and burst instance-hours and day cost (docs/data/cloudflare_scen_threshold_grid.csv)
studythreshold pctlead minramp minbase unitshosted stream hoursburst instance hoursinstance startsday cost usdbasis
threshold_lead_ramp40156026.6825.29modelled
threshold_lead_ramp50156025.5825.19modelled
threshold_lead_ramp65156023.7825.04modelled
threshold_lead_ramp80156023.7825.04modelled
threshold_lead_ramp901560.0123.6825.04modelled
threshold_lead_ramp402560.0326.8925.31modelled
threshold_lead_ramp502560.0325.6925.22modelled
threshold_lead_ramp652560.0423.8925.06modelled
threshold_lead_ramp802560.0423.8925.06modelled
threshold_lead_ramp902560.1123.8925.08modelled
threshold_lead_ramp405560.5527.81525.56modelled
threshold_lead_ramp505560.5526.61425.45modelled
threshold_lead_ramp655560.7624.71425.34modelled
threshold_lead_ramp805560.7624.71425.34modelled
threshold_lead_ramp905560.7624.71425.34modelled
threshold_lead_ramp4010561.6730.32126.09modelled
threshold_lead_ramp5010561.6729.22126modelled
threshold_lead_ramp6510562.2127.22125.98modelled
threshold_lead_ramp8010562.21272025.97modelled
threshold_lead_ramp9010562.21272025.97modelled
threshold_lead_ramp401206024.8725.14modelled
threshold_lead_ramp501206023.7725.04modelled
threshold_lead_ramp651206021.8724.87modelled
threshold_lead_ramp801206021.7724.87modelled
threshold_lead_ramp901206021.7724.86modelled
threshold_lead_ramp402206025825.15modelled
threshold_lead_ramp502206023.9825.05modelled
threshold_lead_ramp652206022824.89modelled
threshold_lead_ramp802206021.9824.88modelled
threshold_lead_ramp902206021.9824.88modelled
threshold_lead_ramp405206025.61025.2modelled
threshold_lead_ramp505206024.3925.09modelled
threshold_lead_ramp655206022.4924.93modelled
threshold_lead_ramp805206022.3924.92modelled
threshold_lead_ramp905206022.3924.92modelled
threshold_lead_ramp40102060.0726.41125.29modelled
threshold_lead_ramp50102060.0725.21125.19modelled
threshold_lead_ramp65102060.223.21125.05modelled
threshold_lead_ramp80102060.26231025.05modelled
threshold_lead_ramp90102060.26231025.05modelled
threshold_lead_ramp401606020.2724.74modelled
threshold_lead_ramp501606019.1724.63modelled
threshold_lead_ramp651606017.1724.46modelled
threshold_lead_ramp801606016.9724.44modelled
threshold_lead_ramp901606016.7724.43modelled
threshold_lead_ramp402606020.4724.75modelled
threshold_lead_ramp502606019.2724.64modelled
threshold_lead_ramp652606017.2724.47modelled
threshold_lead_ramp802606017724.45modelled
threshold_lead_ramp902606016.8724.44modelled
threshold_lead_ramp405606020.8824.79modelled
threshold_lead_ramp505606019.5724.68modelled
threshold_lead_ramp655606017.5724.5modelled
threshold_lead_ramp805606017.3724.48modelled
threshold_lead_ramp905606017.1724.47modelled
threshold_lead_ramp4010606021.7924.86modelled
threshold_lead_ramp5010606020.5924.76modelled
threshold_lead_ramp6510606018.4924.57modelled
threshold_lead_ramp8010606018824.54modelled
threshold_lead_ramp9010606017.9824.53modelled
base_size6522030.6142.82115.39modelled
base_size6522040.6133.62018.42modelled
base_size6522060.6123.81825.22modelled
base_size6522080.6116.71632.26modelled
base_size65220100.619.81439.32modelled
base_size65220120.6151146.55modelled
base_size65220160.211.7861.46modelled

The best Cloudflare-based deployment

Cloudflare as the global edge in front of always-warm backends we control; Containers for batch, and as an optional small overflow pool. TLS ends at Cloudflare, so audio transits its network: fine for general traffic, a decision for sensitive customers, who can use the own-machine install directly.

The best Cloudflare-based deployment: Cloudflare as the global edge in front of always-warm backends, containers for batchTunnelTunneloverflow, kept warmCallersCloudflare edgeLoad Balancing andhealth checksOwn machinesEC2 Graviton4,always onSpot group orcontainersUpload to R2QueueBatch container jobResults in R2

Recommendation by volume

  1. Under about 50,000 minutes a month: a hosted provider alone, or our own machine. No hybrid.
  2. About 50,000 to a million: own machines (or two small Graviton servers) as the base, Cloudflare edge and Tunnel in front, the hosted provider as overflow through the existing client fallback. The burst tier would be at most a quarter of the bill.
  3. Above a million, or with campaign peaks: add an EC2 spot group as the second pool, warmed on a 65% threshold and a schedule, hosted provider last; keep a base of 25 to 50% of the peak.
  4. Cloudflare Containers as the burst tier only if a test shows a short, repeatable warm-up and a vCPU at least as fast as the AMD c7a.
  5. Do not move live streams in the first version.

Drawbacks of serverless for live use, in order of importance

  1. Cold start on every wake-up: about 10 to 20 seconds for us (8 s of model loading measured, plus container start and an unmeasured image pull). Unacceptable for a live caller; avoided only by keeping containers awake, which turns serverless into a provisioned fleet.
  2. No autoscaling and small boxes: a burst means many cold starts of two- to three-stream containers, with a router we must write and run.
  3. 4 vCPU and 12 GiB ceiling, amd64 only, vCPU unspecified: our 24-core layout becomes six containers carrying 10 to 17 streams instead of 28, and the Graviton advantage is unavailable.
  4. Price per stream: about twice Graviton EC2 in the monthly model and three times per busy stream-hour; still half of Deepgram at volume.
  5. Public beta, with moving parts: the default scheduling policy is deprecated and the older container class is maintained only to the end of 2026.
  6. WebSocket reliability is under-documented: no published idle timeout; servers can restart on a release; no resume for a stateful decoder, so clients need replay logic.
  7. The Durable Object and container may be in different places, adding an unmeasured hop.
  8. Billing details are unclear in places: what "active" CPU means, and how a proxied WebSocket's messages are counted.
  9. Audio leaves our network, and Workers AI's Nova-3 and Flux are Deepgram's models, not ours.
  10. Prices not stated: Tunnel and Access on any page read, and Load Balancing beyond "starting at $5 a month".

Not yet measured

No container has been run on Cloudflare yet; every Cloudflare figure above that is not a documented price is an estimate. A one-hour test on a throwaway Worker, torn down afterwards (under three dollars), would measure: what the vCPU is (the biggest unknown); time from first request to ready with a never-used image, after an idle sleep and with a warm host; first partial through the Worker against direct; streams per 4 vCPU container at one to four streams; a WebSocket held for 10 minutes and two hours with and without pings, and a redeploy during a stream; the bill for the hour (what "active CPU" means); and the image pull in a second location. Until then, plan with the numbers on this page and treat the Cloudflare capacity as the least certain input.

Service changes the base-plus-burst design needs, not yet made: a readiness URL with a configurable utilisation ceiling, and a drain mode (stop accepting streams, finish the open ones, exit).

Sources

All read on 2026-12-05; the date in brackets is the page's own last-modified date where it shows one. The full report with every row is docs/CLOUDFLARE-SERVERLESS.md in the repository.

Deepgram, Nova, Flux and Aura are trademarks of Deepgram, Inc.; Cloudflare, Workers and R2 of Cloudflare, Inc.; AWS and Amazon EC2 of Amazon.com, Inc.