RunComfy offers two API approaches to suit various integration needs:
RunComfy Server API and ComfyUI Backend API These APIs lets you spin up and fully control a dedicated ComfyUI backend. Start by using the Server API to manage machines through simple calls: POST to generate a server_id, poll the status endpoint until it reaches "Ready", and then access the **ComfyUI Backend API** directly for tasks like executing workflows, managing nodes, and retrieving outputs. This approach is perfect when you need complete oversight of the ComfyUI backend, such as for in-depth integrations with creative software like Krita, Photoshop, Blender, iClone, or other tools.
RunComfy Serverless API This API turns any ComfyUI workflow into an on-demand, autoscaling endpoint, enabling simple API calls without any server setup or maintenance. It includes asynchronous job monitoring and versioning for rapid updates, making it ideal for efficient, scalable production setups that can be easily integrated into your apps. For more details, check our Serverless API documentation.
https://www.runcomfy.com/comfyui/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/servers/yyyyyyy-yyyy-yyyy-yyyyyyyyyyyy
.https://yyyyyyy-yyyy-yyyy-yyyyyyyyyyyy-comfyui.runcomfy.com
.Note: Please use this ComfyUI URL in a trusted environment, DO NOT SHARE IT publicly.
Ensure that "Enable Development Mode Options" is activated in the Settings menu.
Download the workflow_api.json
file by clicking on the Save (API Format)
button.
The following file is AnimateDiff + ControlNet + Auto Mask | Restyle Video, which will be used as an example.
import requests
url = "<https://yyyyyyy-yyyy-yyyy-yyyyyyyyyyyy-comfyui.runcomfy.com/upload/image>"
payload = {'overwrite':'true', 'type':'input', 'subfolder':''} # you can safely remove the subfolder field here if you don't need it
files=[
('image',('zzzz.png',open('/folder_path/zzzz.png','rb'),'application/octet-stream'))
]
headers = {}
response = requests.post(url, headers=headers, data=payload, files=files)
print(response.json())
import requests
url = "<https://yyyyyyy-yyyy-yyyy-yyyyyyyyyyyy-comfyui.runcomfy.com/upload/image>"
payload = {'overwrite':'true', 'type':'input', 'subfolder':''} # you can safely remove the subfolder field here if you don't need it
files=[
('image',('zzzz.mp4',open('/folder_path/zzzz.mp4','rb'),'application/octet-stream'))
]
headers = {}
response = requests.post(url, headers=headers, data=payload, files=files)
print(response.json())
The response will be something like: