Qwen Image Edit 14B (ComfyUI)

Qwen

Qwen Image Edit 14B for ComfyUI, accelerated by TheStage AI Qlip engines.

Deploy

Serving ComfyUI as an API

Elastic ComfyUI models run inside ComfyUI, so a deployment is a ComfyUI server with ComfyUI-Qlip installed (see Python Usage). ComfyUI exposes an HTTP API: you submit a workflow as JSON and fetch the results. The same setup works on any cloud or on-premise server with a supported GPU, and through TheStage AI platform.

Start the server

cd /path/to/ComfyUI
git checkout b615af1c
thestage config set --access-token <THESTAGE_ACCESS_TOKEN>
python main.py --listen 0.0.0.0 --port 8188
ParameterDescription
--listenAddress to bind. Use 127.0.0.1 for local access only.
--portHTTP port of the API (default 8188).
TheStage token generated on the platform (Profile -> Access tokens).
HF_HOMEOptional: where engines downloaded by hf_repo are cached. Put it on a persistent volume so engines are downloaded once.

Engines are downloaded and loaded on the first request that uses them; later requests reuse the loaded engines.

Prepare the workflow

Open the workflow (for example workflows/qwen-image-edit.json) in the ComfyUI UI, set the engine path in Qlip Engines Loader, and export it with Workflow -> Export (API). The API format is a JSON object of nodes keyed by id, which you send as prompt.

Invocation

Python

import json, time, urllib.request

HOST = "http://127.0.0.1:8188"
workflow = json.load(open("qwen-image-edit-api.json"))

req = urllib.request.Request(
    f"{HOST}/prompt",
    data=json.dumps({"prompt": workflow}).encode(),
    headers={"Content-Type": "application/json"},
)
prompt_id = json.load(urllib.request.urlopen(req))["prompt_id"]

while True:
    history = json.load(urllib.request.urlopen(f"{HOST}/history/{prompt_id}"))
    if prompt_id in history:
        break
    time.sleep(0.5)

for node in history[prompt_id]["outputs"].values():
    for item in node.get("images", []):
        print(f"{HOST}/view?filename={item['filename']}&subfolder={item['subfolder']}&type={item['type']}")

cURL

curl -X POST http://127.0.0.1:8188/prompt \
    -H "Content-Type: application/json" \
    -d "{\"prompt\": $(cat qwen-image-edit-api.json)}"

Endpoint Parameters

Method

POST /prompt

Input Body

prompt : object
The workflow in ComfyUI API format. Change inputs (prompt text, seed, size, LoRA, engine path) by editing the corresponding node inputs before sending.

client_id : string
Optional. Client id for progress events over the /ws websocket.

Response

prompt_id : string
Id of the queued job. Poll GET /history/{prompt_id} until it appears, then download outputs with GET /view?filename=...&subfolder=...&type=output.