Unlimited Open Source Models

Get Plan
Skip to main content
Imagen

ComfyUI API Run Workflows via REST

Run ComfyUI workflows via REST API without local GPU. Cloud-hosted nodes for SDXL, Flux, ControlNet, and LoRA — execute workflows from any language with a single HTTP request.

What is the ComfyUI API?

ComfyUI as a hosted REST API

ComfyUI is the most popular node-based workflow tool for Stable Diffusion, SDXL, Flux, and ControlNet image generation. The ComfyUI API exposes the same workflow execution layer as a hosted REST endpoint so developers can run complex pipelines from any language without installing ComfyUI, downloading model weights, or provisioning a GPU.

Submit a workflow JSON (the same format ComfyUI exports) plus runtime inputs, and the API loads the required models on warm GPU infrastructure, executes every node in order, and returns hosted URLs for the generated outputs. No WebSocket protocol, no custom event loop — just standard HTTP requests with JSON payloads.

When to use the ComfyUI API

Use the ComfyUI API when you have a workflow built in the ComfyUI desktop app and need to run it at scale from a backend service, mobile app, or serverless function. It is the right fit for production workflows that previously required keeping a local ComfyUI server running 24/7.

  • Run ComfyUI workflows from Python, Node, Go, PHP — any HTTP client
  • Execute the workflow JSON exported from the ComfyUI desktop app directly
  • Cloud-hosted models for SD 1.5, SDXL, Flux, ControlNet, IPAdapter, and LoRA
  • No GPU provisioning, no CUDA, no model weight management
  • Webhook callback for long-running workflows
  • Integrated with the rest of ModelsLab — pair with the Real-ESRGAN, Face Swap, and Voice APIs

Trusted by

Google logo
Salesforce logo
Amazon logo
IBM logo
Adobe logo
Sony logo
Google logo
Salesforce logo
Amazon logo
IBM logo
Adobe logo
Sony logo
Google logo
Salesforce logo
Amazon logo
IBM logo
Adobe logo
Sony logo
Google logo
Salesforce logo
Amazon logo
IBM logo
Adobe logo
Sony logo
1B+

Images Processed Monthly

500K+

Active Developers

5K+

Discord Community Members

300+

Available AI APIs

ComfyUI API quick start

Run a ComfyUI workflow programmatically with one POST request. Returns a hosted URL once execution completes.

Python — text-to-image with Flux

Python
1import requests
2
3response = requests.post(
4 "https://modelslab.com/api/v7/images/text-to-image",
5 json={
6 "key": "YOUR_API_KEY",
7 "model_id": "flux",
8 "prompt": "a cinematic close-up portrait, soft daylight, 35mm film grain",
9 "negative_prompt": "low quality, blurry",
10 "width": 1024,
11 "height": 1024,
12 "samples": 1
13 }
14)
15
16print(response.json()["output"][0])

JavaScript — ControlNet pose conditioning

JavaScript
1const response = await fetch('https://modelslab.com/api/v5/controlnet', {
2 method: 'POST',
3 headers: { 'Content-Type': 'application/json' },
4 body: JSON.stringify({
5 key: 'YOUR_API_KEY',
6 model_id: 'sdxl',
7 controlnet_model: 'openpose',
8 init_image: 'https://example.com/pose-reference.png',
9 prompt: 'a softly-lit fashion photo of a model in a red dress',
10 width: 1024,
11 height: 1024,
12 samples: 1,
13 }),
14});
15
16const data = await response.json();
17console.log(data.output[0]);

cURL — LoRA on top of SDXL

bash
1curl -X POST 'https://modelslab.com/api/v6/images/text2img' \
2 -H 'Content-Type: application/json' \
3 -d '{
4 "key": "YOUR_API_KEY",
5 "model_id": "sdxl",
6 "lora_model": "your-lora-id",
7 "lora_strength": 0.8,
8 "prompt": "a portrait in your trained style",
9 "width": 1024,
10 "height": 1024,
11 "samples": 1
12 }'

ComfyUI API capabilities

Execute ComfyUI node-based workflows via a clean REST API — no local installation, no WebSocket protocol, no GPU hardware needed.

Cloud-hosted ComfyUI nodes

Run ComfyUI workflows on cloud GPUs without installing ComfyUI locally. ModelsLab hosts the infrastructure so your team focuses on building workflows and applications instead of GPU plumbing.

REST API interface

Access ComfyUI capabilities through a clean REST API. No WebSocket connections or custom protocols — standard HTTP requests with JSON payloads. Works from any language with an HTTP client.

All popular models supported

Use Stable Diffusion 1.5, SDXL, Flux, SD 3, ControlNet, IPAdapter, and LoRA adapters — all models available in ComfyUI are reachable through the API with no extra configuration.

Scalable inference

Scale from single requests to thousands of concurrent generations. Cloud infrastructure handles auto-scaling, GPU management, and load balancing automatically.

Webhook callbacks

Submit long-running workflows and receive a webhook when the result is ready. Avoid long-polling status endpoints from your backend — the API delivers the final URLs straight to your event handler.

Cloud-hosted ComfyUI nodes
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result

Run complex ComfyUI workflows programmatically through ModelsLab's cloud-hosted infrastructure. Built for SaaS, mobile, and serverless backends.

ComfyUI API vs running ComfyUI locally

What you trade off when you replace a local ComfyUI install with a hosted API.

Workflow factorModelsLab ComfyUI APILocal ComfyUI on your GPUGeneric image API
Setup timeMinutes (sign up + API key)Hours (GPU + CUDA + weights)Minutes
GPU hardware requiredNoneRTX 3090 / 4090+None
ControlNet, IPAdapter, LoRAYesYesSometimes
Custom workflow JSON supportYesYesFixed pipelines
Auto-scaling under loadYesSingle GPUYes
Cold-start timeNone — warm GPUsNone — always on5–60s on serverless
Cost modelPay per generation$1500+ GPU + electricitySubscription or per-second

Comparison based on a typical RTX 3090 / 4090 local install vs. ModelsLab cloud API as of 2026.

How the ComfyUI API works

Execute ComfyUI workflows in the cloud in three simple steps.

STEP 01
STEP 01

Step 1: Get your API key

Create a ModelsLab account, subscribe to a plan (from $21/month), and grab your API key from the dashboard. The same key works across image, video, audio, and LLM endpoints.

STEP 02
STEP 02

Step 2: Define your workflow

Specify your generation parameters — model, prompt, dimensions, ControlNet conditioning, LoRA adapters — as JSON in your API request. Or paste a workflow JSON exported from the ComfyUI desktop app.

STEP 03
STEP 03

Step 3: Submit and retrieve

Submit the request via REST. Receive output URLs in the response (or via webhook for long jobs). No polling required for fast workflows.

Why developers use the ModelsLab ComfyUI API

Key advantages that set us apart

Run ComfyUI workflows via REST API — no WebSocket protocol
No local GPU, no CUDA, no model-weight management
All popular SD 1.5, SDXL, Flux, and SD 3 base models
ControlNet, IPAdapter, and LoRA adapter support
Inpainting and outpainting endpoints
Batch and parallel generation built in
Pay-per-generation pricing — no subscription required
Python and JavaScript SDKs plus full OpenAPI spec
Dedicated GPU infrastructure — no cold starts
Automatic model loading and caching across requests
Webhook callbacks for long-running workflows
Integrated with Real-ESRGAN, Face Swap, and Voice APIs

Our Popular Use Cases

Developers use the ComfyUI API for:

Replace local ComfyUI setups with cloud API calls for production image generation. Scale without managing GPU servers or maintaining ComfyUI installs.

Production image pipelines

ComfyUI API — frequently asked questions

The ModelsLab ComfyUI API is a REST endpoint that runs ComfyUI workflows on cloud GPU infrastructure. Submit a workflow JSON (the same format the ComfyUI desktop app exports) plus runtime inputs, and the API executes every node and returns hosted URLs for the outputs. No local GPU, no CUDA, no WebSocket protocol — just HTTP and JSON.

Yes. Export your workflow as JSON from the ComfyUI desktop app and POST it to the workflow execution endpoint. The API parses the node graph, loads required models, and executes the pipeline server-side. Workflows that work locally work the same way on the API.

Stable Diffusion 1.5, SDXL, SD 3, Flux 1.dev, Flux 1.schnell, plus all major ControlNet variants (openpose, depth, canny, scribble, lineart, segment), IPAdapter, and any LoRA adapter you have access to. Custom-trained models can be uploaded and called by ID.

Local ComfyUI gives you full control but requires a $1500+ GPU, CUDA, and ongoing model management. The API gives the same execution layer at pay-per-call pricing with no hardware. For production workloads or teams without dedicated GPU access, the API is dramatically cheaper than amortizing a local GPU. For exploratory R&D on a single workstation, local ComfyUI is fine.

Yes — all major ControlNet types (openpose, depth, canny, scribble, lineart, segment, normalbae, mlsd) are supported via the controlnet endpoint. Pass a conditioning image URL plus the controlnet_type parameter; the API loads the matching ControlNet model on the fly.

Yes. Pass lora_model (the LoRA id or URL) and lora_strength (0.0–1.5) in your request. Multi-LoRA stacking is supported by passing an array. Custom LoRAs you have trained on ModelsLab are accessible by their model_id.

A standard SDXL text-to-image at 1024×1024 typically completes in 3–5 seconds. Flux generations take 6–10 seconds. ControlNet conditioning adds 1–2 seconds. Times are consistent across calls — there are no cold starts on the dedicated GPU pool.

Pricing is pay-per-generation at a flat $0.0047 per image across SD 1.5, SDXL, and Flux — no per-model upcharge and no subscription required to start. High-volume teams can switch to the $149/month unlimited plan; contact sales for dedicated pricing above 100k generations per month.

Yes — the API is designed for serverless and edge backends. There are no persistent connections, no WebSocket handshakes, and no model-loading delays. Call it from AWS Lambda, Cloudflare Workers, Vercel Functions, or any HTTP-capable runtime.

Outputs are stored on the CDN for 7 days by default, then deleted. Prompts and workflow JSON are processed in-memory and not retained. For enterprise customers, ModelsLab signs DPAs and offers in-VPC deployments with custom retention policies.

Related developer APIs

Your Data is Secure: GDPR Compliant AI Services

ModelsLab GDPR Compliance Certification Badge

GDPR Compliant

AI Image API Pricing Starting at $0.0047 Per Image

ModelsLab offers subscription plans from $21/month (Basic) and $47/month (Standard, 10,000 API calls) to $149/month (Open Source Unlimited). All plans include access to Flux, SDXL, Stable Diffusion 3, and 10,000+ community models. Choose a paid plan, cancel anytime, 100% refund policy.

Coming Soon

We are making some changes to our pricing, please check back later.

Get Expert Support in Seconds

We're Here to Help.

Want to know more? You can email us anytime at support@modelslab.com

View Docs

Yes. ModelsLab exposes a ComfyUI execution endpoint — POST your workflow JSON (the same JSON ComfyUI saves locally) plus inputs, and the API runs it on managed GPUs and returns generated images. No need to host ComfyUI yourself.

POST to /api/v7/comfyui/execute with body {"workflow": <workflow.json>, "inputs": {<node_id>: <value>, ...}}. The API queues the job, runs it, and returns image URLs. Pass a webhook_url for async notification on long jobs.

Most popular custom nodes (Impact Pack, Was Suite, ControlNet, IP-Adapter, AnimateDiff) are pre-installed. For uncommon nodes, contact support and we will add them — typically within a day. We never auto-install untrusted nodes for security reasons.

Pricing matches the standard image API — $0.0047 per output image on pay-as-you-go or $149/month unlimited. Workflows that produce multiple images per run cost per output, not per workflow execution.

Yes. The "inputs" parameter lets you override any node value (CheckpointLoader, KSampler, CLIPTextEncode, LoadImage) by node ID without rebuilding the JSON. This makes it trivial to expose ComfyUI workflows as parameterised endpoints to your end users.

For most teams, yes. Cold starts are eliminated by warm model caching, and bursty traffic auto-scales across the GPU pool. Self-hosting can match or beat us on steady-state per-image cost, but only if your average GPU utilisation exceeds ~60%.

Yes. Workflows and outputs are scoped to your API key, encrypted at rest, and never used for training. Enterprise plans support VPC deployments and signed URLs with short TTL for output access.

Yes. AnimateDiff and video-output nodes are pre-installed. Workflows that emit MP4 are returned as a video URL in the response. For long-running video workflows, always pass webhook_url so your worker is not blocked.

Yes — many users wrap ComfyUI workflows as parameterised API endpoints for their end users. Best practice: store the workflow JSON in your DB, expose user-friendly inputs, and forward to /api/v7/comfyui/execute. This pattern works because the API treats the workflow as data, not code.

Pass your ModelsLab API key in the request body as "key" or via the Authorization: Bearer header. Same auth as every other ModelsLab endpoint — no separate ComfyUI account or token. Per-key rate limits and budgets apply.
Plugins

Explore Plugins for Pro

Our plugins are designed to work with the most popular content creation software.

API

Build Apps with
ML
API

Use our API to build apps, generate AI art, create videos, and produce audio with ease.