comfyui-api

Connect to a running ComfyUI instance, queue workflows, monitor execution, and retrieve results. Supports both online (REST API) and offline (JSON export) modes. Use when executing ComfyUI workflows or checking server status.

By mckruz · 1,744 installs

npx skills add mckruz/comfyui-expert --skill comfyui-api

Source repository · Upstream listing

ComfyUI API Skill Connect to ComfyUI's REST API to execute workflows, monitor progress, and retrieve outputs. Configuration Default URL : http://127.0.0.1:8188 Custom URL : Set in project manifest or pass as parameter Timeout : 30s for API calls, no timeout for generation polling Two Modes Online Mode (ComfyUI Running) Full API access. Preferred mode for interactive work. 1. Test connection : GET /system stats 2. Discover capabilities : Use comfyui inventory skill 3. Queue workflow : POST /prompt 4. Poll for results : GET /history/{prompt id} every 5 seconds 5. Retrieve outputs : GET /view?filename=... Offline Mode (No Server) Export workflow JSON for manual loading in ComfyUI. 1. Generate workflow JSON following ComfyUI's format 2. Save to projects/{project}/workflows/{name}.json 3. Instruct user to drag drop into ComfyUI API Operations Check Server Status Response fields: system.os : Operating system system.comfyui version : Version string devices[0].name : GPU name devices[0].vram total : Total VRAM bytes devices[0].vram free : Free VRAM bytes Queue a Workflow WORKFLOW JSON format: Each node is keyed by a string ID. Inputs reference other nodes as ["{node id}", {output index}] . Response: Poll for Completion Incomplete : Returns {} (empty object) Complete : Returns execution data with outputs: Retrieve Output Image Upload Reference Image Cancel Current Generation Free VRAM Polling Strategy ComfyUI doesn't support WebSocket in CLI context. Use REST polling: 1. Queue workflow via POST /prompt → get prompt id 2. Poll GET /history/{prompt id} every 5 seconds 3. On empty response: generation in progress, continue polling 4. On populated response: check status.completed 5. If completed: true , extract outputs 6. If error in status, route to comfyui troubleshooter Timeout : Warn user after 10 minutes of polling. Video generation (Wan 14B) can take 15 30 minutes. Workflow Validation Before queuing any workflow: 1. Read state/inventory.json (via comfyui inventory ) 2. For each node in workflow: verify class type exists in installed nodes 3. For each model reference: verify file exists in installed models 4. Flag missing items with: Node: suggest ComfyUI Manager install command Model: provide download link from references/models.md Version mismatch: suggest update Error Handling Error Cause Action Connection refused ComfyUI not running Switch to offline mode, save JSON 400 Bad Request Invalid workflow JSON Validate node connections 500 Internal Error ComfyUI crash Suggest restart, check logs Timeout (no response) Server overloaded Wait and retry once Reference Full API documentation: foundation/api quick ref.md