This topic describes how to use the Developer Center to validate your ComfyUI API integration.
Log on to the PAI ArtLab console.
Validate ComfyUI API integration
API edition
The ComfyUI API edition lets you make API calls across multiple ComfyUI instances. This edition is designed for developer integration and does not have a web-based graphical user interface. Because ComfyUI is a stateful service, you must use the EAS asynchronous queue service to call the ComfyUI service when multiple instances are deployed.
Prerequisites
A Python environment is set up and the EAS software development kit (SDK) for the asynchronous queue is installed: pip install eas_prediction
Procedure
-
Log on to the PAI ArtLab console. On the Developer Center page, click the Custom Services tab, and then click Create Custom Service.
For Service Version, select ComfyUI (API Edition).
-
When the Service Status changes to Running, click Call Information. On the Reponse URL (Internet) tab, obtain the request URL, token, Endpoint, and service ID.
The domain name part of the URL, such as
cn-shanghai.pai-eas.aliyuncs.com, is the Endpoint. The last segment of the URL path, such asai4d_comfyuiapi_, is the service ID. Click the copy button next to the URL to copy the address. The token is hidden by asterisks by default. Click the eye icon to view the token. -
Replace the corresponding content in the code with the information you obtained, and then run the code.
-
After the code runs, obtain the file name from the output.
send 0 success,index is b'1' index 1 task_id is txt2img_test index 1 data is b'{"status_code":200},{"type":"executed","data":{"node":"9","display_node":"9","output":{"images":[{"filename":"ComfyUI_00000000_174427782695938_599ffc33-edea-4e64-bb60-28e834940f5c_..png"}]}}}' -
On the PAI ArtLab page, hover over the
icon in the upper-right corner and click Storage to access the OSS Bucket and obtain the storage path.In the OSS file list, the folder name, such as
26*/and its subfolderdata-115*/, is the storage path. -
Construct and access the OSS image URL. The format is as follows: OSS Bucket path/output/file name
For example, 26**/data-115**************/output/ComfyUI_00000000_174427782695938_599ffc33-edea-4e64-bb60-28e834940f5c_.png
Dedicated edition
The ComfyUI Dedicated edition supports both API calls and web-based debugging. For the testing and validation procedure, refer to the API edition section.
Prerequisites
A Python environment is set up.
Procedure
-
Log on to the PAI ArtLab console. On the Developer Center page, click the Custom Services tab, and then click Create Custom Service.
For Service Version, select ComfyUI (Dedicated Edition).
-
When the Service Status changes to Running, click Call Information. On the Public network address call tab, obtain the request URL and token.
The Synchronous Call Information dialog box indicates that only Standard Edition services support synchronous calls.
-
Replace the corresponding content in the code with the information you obtained, and then run the code.
-
After the code runs, obtain the file name from the output.
Get data:{'prompt_id':'d086402a-7454-43c5-a753-b338e4870be2','number':6,'node_errors':{}}get prompt ID:d086402a-7454-43c5-a753-b338e4870be2 {'d086402a-7454-43c5-a753-b338e4870be2':{'prompt':[6,'d086402a-7454-43c5-a753-b338e4870be2',{'3':{'inputs':{'seed':156680208700286,'steps':20,'cfg':8.0,'sampler_name':'eu1er','schedu1er':'normal',...}}}]}} Node ID: 9, Image file name: ComfyUI_00000000_174427782695938_599ffc33-edea-4e64-bb60-28e834940f5c_.png -
On the PAI ArtLab page, hover over the
icon in the upper-right corner and click Storage to access the OSS Bucket and obtain the storage path. -
Construct and access the OSS image URL. The format is as follows: OSS Bucket path/output/file name
For example, 26**/data-115**************/output/ComfyUI_00000000_174427782695938_599ffc33-edea-4e64-bb60-28e834940f5c_.png