beam-logo
← All use cases

Run Stable Diffusion and Flux as an API

Host SDXL, Flux, or any diffusion checkpoint behind a cloud API.

Why Beam

Fast inference for image generation

Everything you need to serve generative models at scale.

Switching to Beam has been really helpful. It has addressed all the pain points we had with Replicate, enabling us to provide a better, more reliable service to our customers.
Simon BramiFounder, Gepetto
Read the case study
5xfaster cold boots than their previous provider
$1,000ssaved monthly
>99.9%production uptime
How it works

Ship an image API in three steps

01

Load the pipeline once

Load your checkpoint when the container boots — requests reuse the warm pipeline instead of reloading weights.

02

Deploy the endpoint

beam deploy gives you an authenticated HTTPS URL backed by autoscaling GPUs.

03

Generate over HTTP

POST a prompt, get back a hosted image URL. Beam handles queuing, scaling, and auth.

terminal
$ beam deploy app.py:generate
=> Deployed 🎉
=> https://sdxl-abc123.app.beam.cloud

$ curl -X POST https://sdxl-abc123.app.beam.cloud \
    -H 'Authorization: Bearer YOUR_TOKEN' \
    -d '{"prompt": "isometric voxel city at dusk"}'

{"url": "https://app.beam.cloud/output/id/8b0d..."}
FAQ

Frequently asked questions

Which models can I host?

Anything diffusers can load: SDXL, SD 1.5, Flux, plus your own fine-tuned checkpoints and LoRAs.

How does this compare to per-image APIs like Replicate or fal?

Per-image platforms charge a markup on every generation, and your model options are limited to their catalog. On Beam you deploy your own checkpoints and LoRAs, pay per-second for the GPU while it's generating, and your code stays private.

How are images returned?

Save them with Output and return a hosted public URL, or base64-encode them into the JSON response.

What about cold starts with large checkpoints?

Keep weights on a volume so containers skip the download, and use on_start so each container loads the pipeline exactly once.

Can I keep an endpoint warm?

Yes — set keep_warm_seconds to hold containers hot for latency-sensitive apps, and let everything else scale to zero.

Do I need to manage queues for burst traffic?

No. Autoscaling is managed by Beam — set your scaling policy and containers are added as request volume grows.

$30 free creditrefreshed monthly

Start shipping on infra
you won’t outgrow.

Run sandboxes and GPU workloads on your cloud, and scale out to ours when you need to. No infra to manage.