# 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({
"76": {
"class_type": "SaveImage",
"inputs": {
"filename_prefix": "comfyui-airport-editorial",
"images": [
"30:43",
0
]
},
"_meta": {
"title": "Save Image"
}
},
"30:39": {
"class_type": "CLIPLoader",
"inputs": {
"clip_name": "qwen_3_4b.safetensors",
"device": "default",
"type": "lumina2"
},
"_meta": {
"title": "Load CLIP"
}
},
"30:40": {
"class_type": "VAELoader",
"inputs": {
"vae_name": "ae.safetensors"
},
"_meta": {
"title": "Load VAE"
}
},
"30:41": {
"class_type": "EmptySD3LatentImage",
"inputs": {
"batch_size": 1,
"height": 1088,
"width": 1920
},
"_meta": {
"title": "EmptySD3LatentImage"
}
},
"30:42": {
"class_type": "ConditioningZeroOut",
"inputs": {
"conditioning": [
"30:45",
0
]
},
"_meta": {
"title": "Conditioning Zero Out"
}
},
"30:43": {
"class_type": "VAEDecode",
"inputs": {
"samples": [
"30:44",
0
],
"vae": [
"30:40",
0
]
},
"_meta": {
"title": "VAE Decode"
}
},
"30:44": {
"class_type": "KSampler",
"inputs": {
"cfg": 1,
"denoise": 1,
"latent_image": [
"30:41",
0
],
"model": [
"30:47",
0
],
"negative": [
"30:42",
0
],
"positive": [
"30:45",
0
],
"sampler_name": "res_multistep",
"scheduler": "simple",
"seed": 336703310549440,
"steps": 8
},
"_meta": {
"title": "KSampler"
}
},
"30:45": {
"class_type": "CLIPTextEncode",
"inputs": {
"clip": [
"30:39",
0
],
"text": "A high-fashion editorial photograph captures an avant-garde model reclining elongated across an expansive expanse of stark negative space against a bold, flat electric-cerulean backdrop. Hard, unyielding direct studio strobe lighting casts razor-sharp, pitch-black shadows across the seamless paper, creating an intense, hyper-stylized mood. The model wears a sculptural canary-yellow latex coat paired with glossy obsidian boots, creating an arresting chromatic clash. Angular cheekbones and slicked-back raven hair gleam under the punishing flash, highlighting dramatic graphic eyeliner and a poised, defiant expression. The figure stretches diagonally across the breadth of the scene, surrounded by saturated, unbroken color, with crisp geometric silhouettes defining the hyper-saturated, electric aesthetic."
},
"_meta": {
"title": "CLIP Text Encode (Prompt)"
}
},
"30:46": {
"class_type": "UNETLoader",
"inputs": {
"unet_name": "z_image_turbo_bf16.safetensors",
"weight_dtype": "default"
},
"_meta": {
"title": "Load Diffusion Model"
}
},
"30:47": {
"class_type": "ModelSamplingAuraFlow",
"inputs": {
"model": [
"30:46",
0
],
"sampling": "flow",
"shift": 3
},
"_meta": {
"title": "ModelSamplingAuraFlow"
}
}
})
# 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("76"):
output.to_file(output.name)