# 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({
"33": {
"class_type": "SaveImage",
"inputs": {
"filename_prefix": "Boogu",
"images": [
"34:3",
0
]
},
"_meta": {
"title": "Save Image"
}
},
"35": {
"class_type": "ResolutionSelector",
"inputs": {
"aspect_ratio": "1:1 (Square)",
"megapixels": 1,
"multiple": 8
},
"_meta": {
"title": "Resolution Selector"
}
},
"34:11": {
"class_type": "CLIPTextEncode",
"inputs": {
"clip": [
"34:7",
0
],
"text": "Abstract close-up portrait of a young man wearing a cream turtleneck, captured with severe horizontal motion blur and double exposure effect that distorts his facial features, rendered in an analog film grain style with muted earthy background tones, framed tightly on his face to emphasize the blur streaks across his eyes, nose, and lips while retaining the texture of the knit collar and soft ambient lighting."
},
"_meta": {
"title": "CLIP Text Encode (Prompt)"
}
},
"34:2": {
"class_type": "UNETLoader",
"inputs": {
"unet_name": "boogu_image_turbo_fp8_scaled.safetensors",
"weight_dtype": "default"
},
"_meta": {
"title": "Load Diffusion Model"
}
},
"34:3": {
"class_type": "VAEDecode",
"inputs": {
"samples": [
"34:32",
0
],
"vae": [
"34:5",
0
]
},
"_meta": {
"title": "VAE Decode"
}
},
"34:32": {
"class_type": "KSampler",
"inputs": {
"cfg": 1,
"denoise": 1,
"latent_image": [
"34:8",
0
],
"model": [
"34:2",
0
],
"negative": [
"34:9",
0
],
"positive": [
"34:11",
0
],
"sampler_name": "lcm",
"scheduler": "sgm_uniform",
"seed": 896977722960984,
"steps": 4
},
"_meta": {
"title": "KSampler"
}
},
"34:5": {
"class_type": "VAELoader",
"inputs": {
"vae_name": "ae.safetensors"
},
"_meta": {
"title": "Load VAE"
}
},
"34:7": {
"class_type": "CLIPLoader",
"inputs": {
"clip_name": "qwen3vl_8b_fp8_scaled.safetensors",
"device": "default",
"type": "boogu"
},
"_meta": {
"title": "Load CLIP"
}
},
"34:8": {
"class_type": "EmptyLatentImage",
"inputs": {
"batch_size": 1,
"height": [
"35",
1
],
"width": [
"35",
0
]
},
"_meta": {
"title": "Empty Latent Image"
}
},
"34:9": {
"class_type": "ConditioningZeroOut",
"inputs": {
"conditioning": [
"34:11",
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)