Get ComfyUI Backend URL

  1. From RunComfy website in the browser
    1. The url appears as https://www.runcomfy.com/comfyui/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/servers/yyyyyyy-yyyy-yyyy-yyyyyyyyyyyy.
    2. The actual ComfyUI URL can be found in here, in a format of https://yyyyyyy-yyyy-yyyy-yyyyyyyyyyyy-comfyui.runcomfy.com.
  2. From RunComfy API
    1. It is the main_service_url in this response.

Note: Please use this ComfyUI URL in a trusted environment, DO NOT SHARE IT publicly.

Activate Development Mode

Ensure that "Enable Development Mode Options" is activated in the Settings menu.

Screenshot 2024-02-23 at 10.32.22.png

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.

workflow_api.json

Upload Video/Image as Input

import requests

url = "<https://yyyyyyy-yyyy-yyyy-yyyyyyyyyyyy-comfyui.runcomfy.com/upload/image>"

payload = {}
files=[
  ('image',('zzzz.mp4',open('path_to_video/image','rb'),'application/octet-stream'))
]
headers = {}

response = requests.post(url, headers=headers, data=payload, files=files)

print(response.json())

The response will be something like:

{
    "name": "zzzz.mp4",
    "subfolder": "",
    "type": "input"
}

The zzzz.mp4 is the file you uploaded via the API in the input folder. Sometimes it may contain suffixes like '(1)' or '(1)(1)' if a file with the same name already exists.

Queue prompt

Basic HTTP API: