3.1 KiB
title, description
| title | description |
|---|---|
| Server Overview | Run ComfyUI as a server and interact with it programmatically via REST and WebSocket APIs |
ComfyUI runs as an HTTP server on your machine by default. You can call it programmatically to submit workflows, upload files, download outputs, and monitor progress — all without opening the browser.
Starting the Server
When you launch ComfyUI, it automatically starts an HTTP server at http://127.0.0.1:8188.
To run ComfyUI as a headless server (no browser):
```bash # Run without opening the browser python main.py --disable-auto-launch ```# Specify a custom port
python main.py --port 8288
# Listen on all network interfaces (for remote access)
python main.py --listen 0.0.0.0
Key Pages in This Section
Complete reference for all main.py command-line arguments. Available HTTP endpoints for submitting workflows, uploading files, and querying status. Code examples for calling the API: HTTP-only, WebSocket + History, and SaveImageWebsocket. WebSocket message types the server sends to the client during execution. Advanced: invert execution for custom control flows.Using Partner Nodes
If your workflow contains paid Partner Nodes, you can include your API key in the payload. See the Partner Node API Integration guide for details.
How the Server Works
The Comfy server runs on top of the aiohttp framework, which in turn uses asyncio.
Messages from the server to the client are sent by socket messages through the send_sync method of the server, which is an instance of PromptServer (defined in server.py). They are processed by a socket event listener registered in api.js. See messages.
Messages from the client to the server are sent by the api.fetchApi() method defined in api.js, and are handled by HTTP routes defined by the server. See routes.