Skip to main content
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):
# Run without opening the browser
python main.py --disable-auto-launch
For a full list of startup flags, run python main.py --help or see the Startup Flags reference.

Key Pages in This Section

Startup Flags

Complete reference for all main.py command-line arguments.

API Routes

Available HTTP endpoints for submitting workflows, uploading files, and querying status.

API Examples

Code examples for calling the API: HTTP-only, WebSocket + History, and SaveImageWebsocket.

Server Messages

WebSocket message types the server sends to the client during execution.

Execution Model Inversion

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.
The client submits the whole workflow (widget values and all) when you queue a request. The server does not receive any changes you make after you send a request to the queue. If you want to modify server behavior during execution, you’ll need routes.