# 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({
"2": {
"class_type": "TencentImageToModelNode",
"inputs": {
"face_count": 500000,
"generate_type": "Normal",
"generate_type.pbr": True,
"image": [
"119",
0
],
"image_back": [
"115:102",
0
],
"model": "3.0",
"seed": 382182111
},
"_meta": {
"title": "Hunyuan3D: Image(s) to Model"
}
},
"11": {
"class_type": "Preview3D",
"inputs": {
"model_file": [
"2",
0
]
},
"_meta": {
"title": "Preview 3D & Animation (DEPRECATED)"
}
},
"117": {
"class_type": "QwenMultiangleCameraNode",
"inputs": {
"camera_view": False,
"default_prompts": False,
"horizontal_angle": 180,
"image": [
"119",
0
],
"vertical_angle": 0,
"zoom": 5
},
"_meta": {
"title": "Qwen Multiangle Camera"
}
},
"118": {
"class_type": "SaveImage",
"inputs": {
"filename_prefix": "backview",
"images": [
"115:102",
0
]
},
"_meta": {
"title": "BACK VIEW"
}
},
"119": {
"class_type": "LoadImage",
"inputs": {
"image": "lucky_cat_sculpture_front.png"
},
"_meta": {
"title": "FRONT VIEW"
}
},
"115:100": {
"class_type": "TextEncodeQwenImageEditPlus",
"inputs": {
"clip": [
"115:93",
0
],
"image1": [
"115:106",
0
],
"prompt": "",
"vae": [
"115:95",
0
]
},
"_meta": {
"title": "Text Encode Qwen Image Edit Plus"
}
},
"115:102": {
"class_type": "VAEDecode",
"inputs": {
"samples": [
"115:105",
0
],
"vae": [
"115:95",
0
]
},
"_meta": {
"title": "VAE Decode"
}
},
"115:103": {
"class_type": "TextEncodeQwenImageEditPlus",
"inputs": {
"clip": [
"115:93",
0
],
"image1": [
"115:106",
0
],
"prompt": [
"117",
0
],
"vae": [
"115:95",
0
]
},
"_meta": {
"title": "TextEncodeQwenImageEditPlus (Positive)"
}
},
"115:104": {
"class_type": "VAEEncode",
"inputs": {
"pixels": [
"115:106",
0
],
"vae": [
"115:95",
0
]
},
"_meta": {
"title": "VAE Encode"
}
},
"115:105": {
"class_type": "KSampler",
"inputs": {
"cfg": 1,
"denoise": 1,
"latent_image": [
"115:104",
0
],
"model": [
"115:98",
0
],
"negative": [
"115:96",
0
],
"positive": [
"115:97",
0
],
"sampler_name": "euler",
"scheduler": "simple",
"seed": 755111314014880,
"steps": 4
},
"_meta": {
"title": "KSampler"
}
},
"115:106": {
"class_type": "FluxKontextImageScale",
"inputs": {
"image": [
"119",
0
]
},
"_meta": {
"title": "FluxKontextImageScale"
}
},
"115:107": {
"class_type": "LoraLoaderModelOnly",
"inputs": {
"lora_name": "Qwen-Image-Edit-2511-Lightning-4steps-V1.0-bf16.safetensors",
"model": [
"115:108",
0
],
"strength_model": 1
},
"_meta": {
"title": "Load LoRA"
}
},
"115:108": {
"class_type": "UNETLoader",
"inputs": {
"unet_name": "qwen_image_edit_2511_bf16.safetensors",
"weight_dtype": "default"
},
"_meta": {
"title": "Load Diffusion Model"
}
},
"115:110": {
"class_type": "LoraLoaderModelOnly",
"inputs": {
"lora_name": "qwen-image-edit-2511-multiple-angles-lora.safetensors",
"model": [
"115:107",
0
],
"strength_model": 1
},
"_meta": {
"title": "Load LoRA"
}
},
"115:93": {
"class_type": "CLIPLoader",
"inputs": {
"clip_name": "qwen_2.5_vl_7b.safetensors",
"device": "default",
"type": "qwen_image"
},
"_meta": {
"title": "Load CLIP"
}
},
"115:94": {
"class_type": "ModelSamplingAuraFlow",
"inputs": {
"model": [
"115:110",
0
],
"sampling": "flow",
"shift": 3.1
},
"_meta": {
"title": "ModelSamplingAuraFlow"
}
},
"115:95": {
"class_type": "VAELoader",
"inputs": {
"vae_name": "qwen_image_vae.safetensors"
},
"_meta": {
"title": "Load VAE"
}
},
"115:96": {
"class_type": "FluxKontextMultiReferenceLatentMethod",
"inputs": {
"conditioning": [
"115:100",
0
],
"reference_latents_method": "index_timestep_zero"
},
"_meta": {
"title": "Edit Model Reference Method"
}
},
"115:97": {
"class_type": "FluxKontextMultiReferenceLatentMethod",
"inputs": {
"conditioning": [
"115:103",
0
],
"reference_latents_method": "index_timestep_zero"
},
"_meta": {
"title": "Edit Model Reference Method"
}
},
"115:98": {
"class_type": "CFGNorm",
"inputs": {
"model": [
"115:94",
0
],
"pre_cfg": False,
"strength": 1
},
"_meta": {
"title": "CFGNorm"
}
}
})
# run() also passes api_key to the partner nodes in this workflow.
job = client.run(workflow, api_key=api_key)