Docs / Serverless

Deploy ComfyUI

The prebuilt ComfyUI worker runs any ComfyUI workflow as a serverless job. Keep checkpoints on a network volume, send the workflow JSON, and get images back as files or base64.

Put models on a network volume

Create a network volume and upload models in ComfyUI's folder layout. The worker reads /volume/models in addition to the models baked into the image.

Terminal
$ aws s3 cp flux1-schnell-fp8.safetensors s3://vol_c7d2h4ke/models/checkpoints/ \
    --endpoint-url https://s3.eu-nl-1.apipods.com
$ aws s3 ls s3://vol_c7d2h4ke/models/ --recursive --endpoint-url https://s3.eu-nl-1.apipods.com
2026-11-17 18:20:41 17246524772 models/checkpoints/flux1-schnell-fp8.safetensors
2026-11-17 18:24:03   335304388 models/vae/ae.safetensors
2026-11-17 18:25:10   151112696 models/loras/watercolor-v2.safetensors

See the S3-compatible API for credentials. You can also upload from a pod that mounts the same volume.

Deploy the worker

curl -X POST https://api.apipods.com/v1/endpoints \
  -H "Authorization: Bearer $APIPODS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "comfyui-flux",
    "image": "apipods/worker-comfyui:v1.7.1",
    "gpuPoolIds": [
      "L40S",
      "L4"
    ],
    "maxWorkers": 5,
    "networkVolumeId": "vol_c7d2h4ke"
  }'

Export the workflow

Build the workflow in ComfyUI on a pod or locally, then use Workflow → Export (API). The API format is a flat object of nodes keyed by ID, which is what the worker expects. The regular UI export, with node positions, is not accepted.

Send a request

cURL
curl -X POST https://run.apipods.com/v1/ep_4n8wq2zt/runsync \
  -H "Authorization: Bearer $APIPODS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "input": {
      "workflow": {
        "6": {
          "class_type": "CLIPTextEncode",
          "inputs": {
            "text": "a lighthouse on a cliff at dusk",
            "clip": [
              "30",
              1
            ]
          }
        },
        "30": {
          "class_type": "CheckpointLoaderSimple",
          "inputs": {
            "ckpt_name": "flux1-schnell-fp8.safetensors"
          }
        },
        "31": {
          "class_type": "KSampler",
          "inputs": {
            "seed": 42,
            "steps": 4,
            "cfg": 1,
            "model": [
              "30",
              0
            ],
            "positive": [
              "6",
              0
            ]
          }
        },
        "…": "remaining nodes from the exported workflow"
      },
      "images": [
        {
          "name": "reference.png",
          "image": "iVBORw0KGgoAAAANSUhEUgAA…"
        }
      ]
    }
  }'

images is optional: each entry is written to ComfyUI's input folder so LoadImage nodes can reference it by name.

Response

200 OK
{
  "id": "job_3x9wq2mt",
  "status": "COMPLETED",
  "delayTime": 702,
  "executionTime": 3410,
  "workerId": "wrk_8q3m2x9k",
  "output": {
    "images": [
      {
        "filename": "ComfyUI_00001_.png",
        "type": "s3_url",
        "data": "https://s3.eu-nl-1.apipods.com/vol_c7d2h4ke/outputs/job_3x9wq2mt/ComfyUI_00001_.png"
      }
    ]
  }
}

When the endpoint has a network volume, images are written to /volume/outputs/{jobId}/ and returned as s3_url. Without a volume they are returned inline as base64, which counts toward the output size limit.

Custom nodes

Custom nodes must be installed in the image. Extend the worker image and install them at build time:

Dockerfile
FROM apipods/worker-comfyui:v1.7.1

RUN comfy node install comfyui-impact-pack comfyui_controlnet_aux