# 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({
"740": {
"class_type": "SaveImage",
"inputs": {
"filename_prefix": "Chroma-Radiance",
"images": [
"762:298",
0
]
},
"_meta": {
"title": "Save Image"
}
},
"762:298": {
"class_type": "VAEDecode",
"inputs": {
"samples": [
"762:753",
0
],
"vae": [
"762:710",
0
]
},
"_meta": {
"title": "VAE Decode"
}
},
"762:693": {
"class_type": "CLIPTextEncode",
"inputs": {
"clip": [
"762:741",
0
],
"text": "Hyperrealistic macro photograph of a team of tiny bakers—each precisely 2 inches tall—collaborating on an enormous, golden-brown croissant with flaky, layered textures. The bakers are engaged in dynamic, detailed actions: one uses a miniature wooden bucket to spread rich, creamy butter between the croissant’s layers, another climbs a thin rope ladder to evenly pipe smooth, glossy chocolate filling onto the top, and a third brushes a light egg wash with a tiny pastry brush. The scene is bathed in warm, soft kitchen lighting with cinematic depth—subtle highlights on the croissant’s golden crust, gentle shadows that emphasize texture, and a soft glow from overhead pendant lights. Floating flour dust particles catch the light, adding a sense of movement and realism, while tiny details like the bakers’ stitched cloth aprons, smudged flour on their faces, the rough wood of the worktable, and the slight sheen of melted butter on the croissant are rendered with ultra-precision. Ultra-detailed, 8K resolution, photorealistic textures, sharp focus on the bakers and croissant, shallow depth of field to blur the background slightly, rich warm color palette, lifelike proportions, and a cozy, whimsical atmosphere that balances realism with charm."
},
"_meta": {
"title": "Positive"
}
},
"762:694": {
"class_type": "CFGGuider",
"inputs": {
"cfg": 3.5,
"model": [
"762:701",
0
],
"negative": [
"762:728",
0
],
"positive": [
"762:693",
0
]
},
"_meta": {
"title": "CFG Guider"
}
},
"762:700": {
"class_type": "KSamplerSelect",
"inputs": {
"sampler_name": "euler"
},
"_meta": {
"title": "KSamplerSelect"
}
},
"762:701": {
"class_type": "ModelSamplingAuraFlow",
"inputs": {
"model": [
"762:747",
0
],
"sampling": "flow",
"shift": 1
},
"_meta": {
"title": "Flow Shift"
}
},
"762:710": {
"class_type": "VAELoader",
"inputs": {
"vae_name": "pixel_space"
},
"_meta": {
"title": "Load VAE"
}
},
"762:718": {
"class_type": "RandomNoise",
"inputs": {
"noise_seed": 918944845349229
},
"_meta": {
"title": "SEED"
}
},
"762:728": {
"class_type": "CLIPTextEncode",
"inputs": {
"clip": [
"762:741",
0
],
"text": "This low quality greyscale unfinished sketch is inaccurate and flawed. The image is very blurred and lacks detail with excessive chromatic aberrations and artifacts. The image is overly saturated with excessive bloom."
},
"_meta": {
"title": "Negative"
}
},
"762:731": {
"class_type": "UNETLoader",
"inputs": {
"unet_name": "chroma-radiance-x0.safetensors",
"weight_dtype": "default"
},
"_meta": {
"title": "Load Diffusion Model"
}
},
"762:733": {
"class_type": "CLIPLoader",
"inputs": {
"clip_name": "t5xxl_fp8_e4m3fn_scaled.safetensors",
"device": "default",
"type": "chroma"
},
"_meta": {
"title": "Load CLIP"
}
},
"762:741": {
"class_type": "T5TokenizerOptions",
"inputs": {
"clip": [
"762:733",
0
],
"min_length": 0,
"min_padding": 0
},
"_meta": {
"title": "T5 Tokenizer Options"
}
},
"762:747": {
"class_type": "ChromaRadianceOptions",
"inputs": {
"end_sigma": 0,
"force_sequential_txt_ids": False,
"model": [
"762:731",
0
],
"nerf_tile_size": -1,
"preserve_wrapper": True,
"start_sigma": 1
},
"_meta": {
"title": "ChromaRadianceOptions"
}
},
"762:751": {
"class_type": "BetaSamplingScheduler",
"inputs": {
"alpha": 0.4,
"beta": 0.4,
"model": [
"762:701",
0
],
"steps": 30
},
"_meta": {
"title": "BetaSamplingScheduler"
}
},
"762:753": {
"class_type": "SamplerCustomAdvanced",
"inputs": {
"guider": [
"762:694",
0
],
"latent_image": [
"762:760",
0
],
"noise": [
"762:718",
0
],
"sampler": [
"762:700",
0
],
"sigmas": [
"762:751",
0
]
},
"_meta": {
"title": "SamplerCustomAdvanced"
}
},
"762:760": {
"class_type": "EmptyChromaRadianceLatentImage",
"inputs": {
"batch_size": 1,
"height": 1024,
"width": 1024
},
"_meta": {
"title": "EmptyChromaRadianceLatentImage"
}
}
})
# run() also passes api_key to the partner nodes in this workflow.
job = client.run(workflow, api_key=api_key)