ComfyUI API surface #13
Labels
No labels
bug
duplicate
enhancement
help wanted
invalid
needs-info
needs-triage
question
ready-for-agent
ready-for-human
wayfinder:grilling
wayfinder:map
wayfinder:prototype
wayfinder:research
wayfinder:task
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
crowmaki/ai-studio#13
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Part of #1
Question
How does an external app drive a local ComfyUI over its HTTP/websocket API? Cover submitting API-format prompts, uploading images and audio, websocket progress and completion events, fetching outputs, interrupting and cancelling, and enumerating installed nodes and models (
/object_info, model folders) for the preflight check and the per-Take model/LoRA pickers. Cite primary sources (ComfyUI repo/docs).Resolution
Verified against ComfyUI
master@7c8fbc6(v0.39.0):server.py,execution.py,main.py,folder_paths.py, and the officialscript_examples/websockets_api_example.py. Also checked docs.comfy.org comms_routes and comms_messages.Key facts the spec depends on:
--enable-cors-header, its origin middleware returns 403 when a loopback request hasHost!=OriginorSec-Fetch-Site: cross-site. That blocks a Tauri webviewfetch. Every route also exists with an/api/prefix.POST /api/prompt {prompt: <API-format graph>, client_id, prompt_id?}.prompt_id; it must be a canonical UUID.error.type, for examplemissing_node_typeorprompt_outputs_failed_validation, plus per-nodenode_errors.node_errors. In that case only the valid outputs are queued, so treat it as a failure.POST /api/upload/image(multipart:image,type=input,subfolder,overwrite) handles images and audio, because there is no content-type check. Use the returnednameas the node input; a name clash gets aname (1).extrename. The default size limit is 100 MB (--max-upload-size).WS /ws?clientId=X. Per-prompt events go only to the socket whose id matches the prompt'sclient_id.execution_start→execution_cached→executing{node}/progress{value,max}/progress_state→executed{output}→execution_success|execution_error|execution_interrupted.executing{node:null, prompt_id}means finished, and history is already written.GET /api/history/{prompt_id}returnsoutputs[node_id]as UI dicts. Video comes asimages+animated:[true], audio asaudio, and custom nodes may use other keys, so walk them all for{filename,subfolder,type}.GET /api/view?filename&subfolder&type=output.POST /api/jobs/{id}/cancelatomically interrupts the job if it is running, or dequeues it if pending. It is idempotent and present in 0.39.0; feature-detect it.POST /api/interrupt {prompt_id}(always pass the id; with no body it interrupts globally), plusPOST /api/queue {delete:[id]}.GET /api/object_inforeturns the installedclass_types, so diff it against the template. Combo inputs come in two encodings: legacy[[opts],{}]and V3["COMBO",{options}].GET /api/modelslists the folder keys.GET /api/models/{checkpoints|loras|diffusion_models|…}returns relative filenames that are exactly the values loader combos accept. The list is rescanned by mtime, so no restart is needed.GET /api/view_metadata/{folder}?filename=returns safetensors metadata, andGET /api/system_statsreturns the version and VRAM.Context: full findings with line-level citations are on branch
research/comfyui-api, fileresearch/comfyui-api.md.