{"openapi":"3.1.0","info":{"title":"ComfyUI API","description":"Image generation with Stable Diffusion workflows","version":"1.0.0","contact":{"name":"ComfyUI Project","url":"https://github.com/comfyanonymous/ComfyUI"},"license":{"name":"GPL-3.0"}},"servers":[{"url":"https://comfyui.haiven.site","description":"Production (via Traefik)"},{"url":"http://comfyui:8188","description":"Internal Docker network"}],"tags":[{"name":"Execution","description":"Workflow submission and management"},{"name":"Queue","description":"Queue status and history"},{"name":"Resources","description":"Generated images and outputs"},{"name":"System","description":"Server information and statistics"}],"paths":{"/prompt":{"post":{"tags":["Execution"],"summary":"Queue workflow","description":"Submit a ComfyUI workflow for execution. The workflow graph is a dictionary\nwhere keys are node IDs and values are node definitions with class_type and inputs.\n","operationId":"queuePrompt","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowSubmission"},"examples":{"simple_txt2img":{"summary":"Simple text-to-image workflow","value":{"prompt":{"1":{"class_type":"CheckpointLoaderSimple","inputs":{"ckpt_name":"sd15.safetensors"}},"2":{"class_type":"CLIPTextEncode","inputs":{"text":"a beautiful landscape","clip":[1,1]}},"3":{"class_type":"KSampler","inputs":{"seed":12345,"steps":20,"cfg":7.0,"sampler_name":"euler","scheduler":"normal","denoise":1.0,"model":[1,0],"positive":[2,0],"negative":[2,0],"latent_image":[4,0]}},"4":{"class_type":"EmptyLatentImage","inputs":{"width":512,"height":512,"batch_size":1}},"5":{"class_type":"VAEDecode","inputs":{"samples":[3,0],"vae":[1,2]}},"6":{"class_type":"SaveImage","inputs":{"images":[5,0],"filename_prefix":"output"}}},"client_id":"client-001"}}}}}},"responses":{"200":{"description":"Workflow queued successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PromptResponse"},"examples":{"success":{"value":{"prompt_id":"550e8400-e29b-41d4-a716-446655440000"}}}}}},"400":{"description":"Invalid workflow structure","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"503":{"description":"Server not ready or queue full","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/queue":{"get":{"tags":["Queue"],"summary":"Get queue status","description":"Retrieve current execution queue and running job information","operationId":"getQueueStatus","responses":{"200":{"description":"Queue information","content":{"application/json":{"schema":{"$ref":"#/components/schemas/QueueStatus"},"examples":{"idle":{"summary":"Queue is idle","value":{"queue_pending":[],"queue_running":null}},"active":{"summary":"Queue with pending jobs","value":{"queue_pending":[["550e8400-e29b-41d4-a716-446655440000",{"prompt":{},"outputs":{}}]],"queue_running":["550e8400-e29b-41d4-a716-446655440001"]}}}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/history/{prompt_id}":{"get":{"tags":["Queue"],"summary":"Get execution history","description":"Retrieve execution results and outputs for a completed workflow.\nReturns null if prompt_id is not found.\n","operationId":"getHistory","parameters":[{"name":"prompt_id","in":"path","required":true,"description":"UUID of the queued workflow","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Execution history","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExecutionHistory"},"examples":{"completed":{"summary":"Completed execution","value":{"550e8400-e29b-41d4-a716-446655440000":{"prompt":[{}],"outputs":{"6":{"images":[{"filename":"output_00001_.png","subfolder":"","type":"output"}]}},"status":{"status_code":100,"completed":true,"messages":[]},"timestamp":1701619200.123}}},"not_found":{"summary":"Prompt not found (returns empty)","value":{}}}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/view":{"get":{"tags":["Resources"],"summary":"View generated image","description":"Retrieve generated images or other files from the output directories.\nSupports streaming for large files.\n","operationId":"viewFile","parameters":[{"name":"filename","in":"query","required":true,"description":"Filename of the image","schema":{"type":"string","example":"output_00001_.png"}},{"name":"subfolder","in":"query","required":false,"description":"Subdirectory within the type folder","schema":{"type":"string","default":""}},{"name":"type","in":"query","required":false,"description":"Directory type","schema":{"type":"string","enum":["output","input","temp"],"default":"output"}}],"responses":{"200":{"description":"Image file","content":{"image/png":{},"image/jpeg":{},"image/webp":{},"image/gif":{}}},"404":{"description":"File not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/system_stats":{"get":{"tags":["System"],"summary":"System statistics","description":"Get GPU, CPU, and memory statistics from the ComfyUI server.\nUseful for monitoring resource usage during generation.\n","operationId":"getSystemStats","responses":{"200":{"description":"System statistics","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SystemStats"},"examples":{"typical":{"value":{"gpus":[{"name":"NVIDIA RTX PRO 6000 Blackwell","vram_total":98304,"vram_free":92160,"vram_used":6144}],"ram":{"total":65536,"used":32768,"available":32768},"uptime":3600.5}}}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}},"components":{"schemas":{"WorkflowSubmission":{"type":"object","required":["prompt"],"properties":{"prompt":{"type":"object","description":"Workflow graph - dictionary of node_id -> node_definition","additionalProperties":{"$ref":"#/components/schemas/WorkflowNode"}},"client_id":{"type":"string","description":"Optional client identifier for tracking","example":"client-001"}},"additionalProperties":false},"WorkflowNode":{"type":"object","required":["class_type","inputs"],"properties":{"class_type":{"type":"string","description":"ComfyUI node class name","example":"KSampler"},"inputs":{"type":"object","description":"Node inputs - can reference other nodes via [node_id, output_index]","additionalProperties":true},"title":{"type":"string","description":"Optional node display name"},"metadata":{"type":"object","description":"Optional metadata","additionalProperties":true}}},"PromptResponse":{"type":"object","required":["prompt_id"],"properties":{"prompt_id":{"type":"string","format":"uuid","description":"Unique identifier for the queued workflow","example":"550e8400-e29b-41d4-a716-446655440000"},"number":{"type":"integer","description":"Queue position","example":0}}},"QueueStatus":{"type":"object","properties":{"queue_pending":{"type":"array","description":"List of pending jobs [prompt_id, workflow_data]","items":{"type":"array","minItems":2,"maxItems":2}},"queue_running":{"oneOf":[{"type":"null","description":"No job running"},{"type":"string","description":"Currently running prompt_id"}]}}},"ExecutionHistory":{"type":"object","description":"Dictionary of prompt_id -> execution_result","additionalProperties":{"$ref":"#/components/schemas/ExecutionResult"}},"ExecutionResult":{"type":"object","properties":{"prompt":{"type":"array","description":"Original prompt data"},"outputs":{"type":"object","description":"Output data by node_id","additionalProperties":{"type":"object","properties":{"images":{"type":"array","items":{"$ref":"#/components/schemas/ImageOutput"}},"gifs":{"type":"array","items":{"$ref":"#/components/schemas/ImageOutput"}}}}},"status":{"$ref":"#/components/schemas/ExecutionStatus"},"timestamp":{"type":"number","description":"Unix timestamp of execution","example":1701619200.123}}},"ExecutionStatus":{"type":"object","properties":{"status_code":{"type":"integer","description":"Completion status (100=success, <100=in progress/error)","example":100},"completed":{"type":"boolean","description":"Whether execution completed","example":true},"messages":{"type":"array","items":{"type":"string"},"description":"Execution messages or errors"}}},"ImageOutput":{"type":"object","required":["filename","type"],"properties":{"filename":{"type":"string","description":"Output filename","example":"output_00001_.png"},"subfolder":{"type":"string","description":"Subdirectory within output folder","example":""},"type":{"type":"string","enum":["output","input","temp"],"description":"File type/location"}}},"SystemStats":{"type":"object","properties":{"gpus":{"type":"array","description":"GPU information","items":{"$ref":"#/components/schemas/GPUInfo"}},"ram":{"$ref":"#/components/schemas/RAMInfo"},"uptime":{"type":"number","description":"Server uptime in seconds","example":3600.5}}},"GPUInfo":{"type":"object","properties":{"name":{"type":"string","description":"GPU model name","example":"NVIDIA RTX PRO 6000 Blackwell"},"vram_total":{"type":"integer","description":"Total VRAM in MB","example":98304},"vram_free":{"type":"integer","description":"Free VRAM in MB","example":18432},"vram_used":{"type":"integer","description":"Used VRAM in MB","example":6144}}},"RAMInfo":{"type":"object","properties":{"total":{"type":"integer","description":"Total system RAM in MB","example":65536},"used":{"type":"integer","description":"Used RAM in MB","example":32768},"available":{"type":"integer","description":"Available RAM in MB","example":32768}}},"ErrorResponse":{"type":"object","required":["error"],"properties":{"error":{"type":"string","description":"Error message","example":"Invalid workflow structure"},"detail":{"type":"string","description":"Additional error details","example":"Missing required field: class_type in node 1"},"status_code":{"type":"integer","description":"HTTP status code","example":400}}}}},"x-internal-notes":{"description":"Internal notes for Haiven implementation","gpu_allocation":"GPU 0 (RTX PRO 6000 pro6000-charlie, 96GB) reserved for image generation and audio","docker_network":"http://comfyui:8188 for internal requests","port":8188,"volume_mounts":["/mnt/models/sd_checkpoints:/app/models/checkpoints:ro","/mnt/models/loras:/app/models/loras:ro","/mnt/models/controlnets:/app/models/controlnet:ro","/mnt/storage/comfyui:/app/output:rw"]}}