wylon

Using wylon image models in ComfyUI

wylon provides an OpenAI Images-compatible synchronous endpoint. ComfyUI can call it through a third-party node that supports a custom api_base; this guide uses comfyui-gpt-image.

Prerequisites

1. Install comfyui-gpt-image

In ComfyUI, open Manage Extensions, switch the filter to node packs, search for comfyui-gpt-image, install it, and restart ComfyUI.

warning
The third-party node's size options must be updatedThe node was designed for OpenAI gpt-image-1, whose default sizes differ from the current wylon example model. Follow the next steps to edit the node source and restart ComfyUI.
info
This is a third-party nodeIt is not maintained by wylon. Back up local workflows and modified node files before upgrading ComfyUI or the node.

2. Confirm model parameters

GET /v1/models confirms model IDs and availability; use the API documentation for parameter limits. Qwen/Qwen-Image-2512 currently supports:

ParameterValuesNotes
size1328x1328, 1664x928, 928x1664, 1104x1472, 1584x1056Default: 1664x928
n1One image per request
output_formatpngPNG output
negative_promptSupportedContent to exclude

See the synchronous image API for current details. Do not add inference_steps; it is not a supported request field.

3. Add the size options

Edit ComfyUI/custom_nodes/comfyui-gpt-image/nodes_api.py. Find the fixed size options list and add the wylon model sizes without removing the existing values:

"options": [
    "auto", "1024x1024", "1024x1536", "1536x1024",
    "1328x1328", "1664x928", "928x1664", "1104x1472", "1584x1056"
],

Save the file and restart ComfyUI.

update
Node updates may overwrite this changeAfter updating comfyui-gpt-image, check the size options in nodes_api.py again.

4. Configure and run the node

Add a Ports OpenAI GPT Image 1 node and configure it:

FieldValue
promptA non-empty image description
api_basehttps://api.wylon.cn/v1/ (keep the trailing slash)
auth_tokenYour wylon API key
modelA complete model ID, such as Qwen/Qwen-Image-2512
sizeA size supported by the model
n1 for this example
quality, background, moderationKeep the default values; actual support depends on the selected model
link
api_base must end with a slashThe node uses urljoin to construct request URLs. Without the trailing slash, /v1 may be replaced and the request will return 404.

Connect the image output to Save Image or Preview Image, then run the workflow.

key
Remove the key before sharing a workflowauth_token may be saved with the workflow. Remove the API key before exporting, uploading, or sharing it, and confirm that the file contains no plaintext credential.

5. Improve download resilience

The node makes a second request to download the signed result URL. If the network is unreliable, edit validate_and_cast_response() in nodes_api.py to add a timeout, integrity check, and bounded retries. First add import time near the top of the file, then replace the single-download logic with:

last_err = None
for attempt in range(4):
    try:
        with requests.get(image_url, stream=True, timeout=(10, 60)) as response:
            if response.status_code != 200:
                raise Exception("HTTP %s" % response.status_code)

            buffer = io.BytesIO()
            for chunk in response.iter_content(65536):
                if chunk:
                    buffer.write(chunk)

            expected = response.headers.get("Content-Length")
            if expected and buffer.tell() < int(expected):
                raise Exception("Truncated: %d/%s" % (buffer.tell(), expected))

        buffer.seek(0)
        img = Image.open(buffer)
        img.load()
        break
    except Exception as error:
        last_err = error
        time.sleep(2 * (attempt + 1))
else:
    raise Exception("Failed to download the image: %s" % last_err)

This change retries only the result download. Once generation has been accepted, do not rerun the whole workflow merely because the download failed; doing so may create another billable request.

沪ICP备2026010432号-1沪公网安备31010402336632号