# Python 3.10+: pip install comfy-sdk==0.4.0
import os
from comfy_sdk import Comfy
api_key = os.environ.get("COMFY_API_KEY", "").strip()
if not api_key: raise RuntimeError("Set COMFY_API_KEY")
os.environ.setdefault("COMFY_BASE_URL", "https://cloud.comfy.org")
client = Comfy(api_key=api_key)
workflow = client.workflows.from_json({
"103": {
"class_type": "VAELoader",
"inputs": {
"vae_name": "qwen_image_vae.safetensors"
},
"_meta": {
"title": "Load VAE"
}
},
"104": {
"class_type": "CLIPLoader",
"inputs": {
"clip_name": "qwen_2.5_vl_7b_fp8_scaled.safetensors",
"device": "default",
"type": "qwen_image"
},
"_meta": {
"title": "Load CLIP"
}
},
"105": {
"class_type": "UNETLoader",
"inputs": {
"unet_name": "qwen_image_2512_fp8_e4m3fn.safetensors",
"weight_dtype": "default"
},
"_meta": {
"title": "Load Diffusion Model"
}
},
"106": {
"class_type": "KSampler",
"inputs": {
"cfg": 1,
"denoise": 1,
"latent_image": [
"107",
0
],
"model": [
"110",
0
],
"negative": [
"128",
0
],
"positive": [
"108",
0
],
"sampler_name": "euler",
"scheduler": "simple",
"seed": 318036859179089,
"steps": 2
},
"_meta": {
"title": "KSampler"
}
},
"107": {
"class_type": "EmptySD3LatentImage",
"inputs": {
"batch_size": 1,
"height": 928,
"width": 1664
},
"_meta": {
"title": "EmptySD3LatentImage"
}
},
"108": {
"class_type": "CLIPTextEncode",
"inputs": {
"clip": [
"104",
0
],
"text": "A high-fashion editorial photograph captured from an extreme low-angle distance with a 24mm ultra-wide lens, featuring a solitary model posed dynamically across an expansive stark white salt flat under a blinding, high-noon sun. The model wears a sculptural crimson structured coat made of matte neoprene, layered over a gleaming liquid-mercury chrome corset and billowing saffron pleated organza trousers that catch the arid desert breeze. Bleached crystalline ground cracks extend diagonally toward a distant, razor-sharp mountain horizon, creating a striking graphic tension. Hard, cutting sunlight casts razor-edged, elongated shadows across the sun-baked mineral crust. The composition balances vast negative space with vivid saturated warmth, sharp geometric forms, and high-contrast editorial clarity across the panoramic desert expanse."
},
"_meta": {
"title": "CLIP Text Encode (Positive Prompt)"
}
},
"109": {
"class_type": "VAEDecode",
"inputs": {
"samples": [
"106",
0
],
"vae": [
"103",
0
]
},
"_meta": {
"title": "VAE Decode"
}
},
"110": {
"class_type": "ModelSamplingAuraFlow",
"inputs": {
"model": [
"114",
0
],
"sampling": "flow",
"shift": 3
},
"_meta": {
"title": "ModelSamplingAuraFlow"
}
},
"114": {
"class_type": "LoraLoaderModelOnly",
"inputs": {
"lora_name": "Wuli-Qwen-Image-2512-Turbo-LoRA-2steps-V1.0-bf16.safetensors",
"model": [
"105",
0
],
"strength_model": 1
},
"_meta": {
"title": "Load LoRA"
}
},
"123": {
"class_type": "SaveImage",
"inputs": {
"filename_prefix": "Qwen-2512-2steps-LoRA",
"images": [
"109",
0
]
},
"_meta": {
"title": "Save Image"
}
},
"128": {
"class_type": "ConditioningZeroOut",
"inputs": {
"conditioning": [
"108",
0
]
},
"_meta": {
"title": "Conditioning Zero Out"
}
}
})
# run() also passes api_key to the partner nodes in this workflow.
job = client.run(workflow, api_key=api_key)
for output in job.get_outputs("123"):
output.to_file(output.name)