# Turn ComfyUI workflows into production APIs

Export your ComfyUI workflow as JSON and Beam serves it as an API endpoint on cloud GPUs.

Load CheckpointCLIP EncodeCLIP EncodeKSamplerVAE DecodeSave Imageoutput.png

## ComfyUI in production

Run Comfy on cloud GPUs without managing your own infrastructure.

**Workflow JSON in, image out**  
Export workflow_api.json from the ComfyUI menu and host the same workflow behind a REST API.  
Explore docs

**Custom nodes supported**  
Install any node pack with comfy node install while building your image. What runs locally runs on Beam.  
Explore docs

**The full UI, hosted in minutes**  
Spin up interactive ComfyUI on a managed GPU Pod and open it in your browser.  
Explore docs

**Autoscaling included**  
Beam scales API containers with request volume.  
Explore docs

**Hosted outputs**  
Save generated images and get back public URLs you can return straight to your users.  
Explore docs

**Flux, SDXL, or anything**  
Point at any checkpoint on Hugging Face — Flux1 Schnell, SDXL, SD 1.5 — and swap models by changing a variable.  
Explore docs

## How it works

### From workflow to API in minutes

01

### Build ComfyUI into an image

Install ComfyUI with comfy-cli, add your custom nodes, and bake model weights into the image or a volume.

02

### Export your workflow as JSON

Use ComfyUI's export menu to save workflow_api.json.

03

### Deploy it as an API

Wrap the workflow in an endpoint, deploy, and generate images over HTTP.

```python
# Wrap an exported workflow in an API (api.py)
workflow = json.loads(WORKFLOW_FILE.read_text())
workflow["6"]["inputs"]["text"] = item["prompt"]

subprocess.run(
    f"comfy run --workflow {workflow_file} --wait",
    shell=True, check=True,
)

output = Output(path=latest_image)
output.save()
return {"output_url": output.public_url()}

# Deploy it
$ beam deploy api.py:handler

# Generate images over HTTP
$ curl -X POST https://comfy-xyz.app.beam.cloud/generate \
    -H 'Authorization: Bearer YOUR_TOKEN' \
    -d '{"prompt": "A cat in a spacesuit"}'
```

## Frequently asked questions

**Can I use custom nodes?**  
Yes. Install node packs with comfy node install as part of your image build — the same nodes you use locally work in the cloud.

**How do model weights get loaded?**  
Bake them into the container image with huggingface-cli download, or store them on a persistent volume shared across containers.

**Can I run the ComfyUI interface itself?**  
Yes. A Pod hosts the full web UI behind an SSL-terminated URL, backed by whatever GPU you pick.

**Which GPU do I need for my model?**  
SD 1.5 and SDXL run comfortably on 24Gi cards like the A10G or RTX 4090. Flux-scale checkpoints want an H100 with 80Gi.

**How fast does a workflow start generating?**  
Once your image is built, containers boot in seconds with weights already cached — there's no template to initialize and no models to install by hand through the UI.
