ComfyUI Extension: comfy-portal-endpoint
This is a ComfyUI extension that provides additional API endpoints functionality, primarily designed to support Comfy Portal - a modern iOS client application for ComfyUI.
Custom Nodes (0)
README
ComfyUI Portal Endpoint Extension
This is a ComfyUI extension that provides additional API endpoints functionality, primarily designed to support Comfy Portal - a modern iOS client application for ComfyUI. These endpoints enable seamless integration between the mobile app and ComfyUI server, providing features like workflow conversion, listing, and saving capabilities.
Installation
- Navigate to ComfyUI's custom_nodes directory:
cd custom_nodes
- Clone this repository:
git clone https://github.com/ShunL12324/comfy-portal-endpoint
- Restart the ComfyUI server
API Endpoints
Workflow Conversion
- Endpoint:
/api/cpe/workflow/convert
- Method: POST
- Description: Converts a ComfyUI workflow JSON format to API-compatible JSON format for programmatic API calls
- Request Body: ComfyUI workflow JSON data (the format you get when you save a workflow in the UI)
Example Call
curl -X POST "http://localhost:8188/api/cpe/workflow/convert" \
-H "Content-Type: application/json" \
-d '{
"workflow": "<workflow_json_string>"
}'
List Workflows
- Endpoint:
/api/cpe/workflow/list
- Method: GET
- Description: Lists all available workflows in the user's workflows directory
- Response: List of workflow files with their metadata (filename, size, modified time)
Example Call
curl "http://localhost:8188/api/cpe/workflow/list"
Save Workflow
- Endpoint:
/api/cpe/workflow/save
- Method: POST
- Description: Saves a workflow JSON to the workflows directory
- Request Body:
workflow
: Workflow JSON string (required)name
: Filename to save as (optional, will generate timestamp-based name if not provided)- Note:
.json
extension will be automatically added if not present in the name
Example Call
curl -X POST "http://localhost:8188/api/cpe/workflow/save" \
-H "Content-Type: application/json" \
-d '{
"workflow": "<workflow_json_string>",
"name": "my_workflow"
}'
Development Notes
- This extension focuses on providing API endpoints, no custom nodes included
- All API endpoints are prefixed with
/api/cpe/
- Uses aiohttp framework for handling API requests
- Implements a task queue system for workflow processing
- Includes error handling and timeout mechanisms
License
MIT