# 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({
"5074": {
"class_type": "SaveVideo",
"inputs": {
"filename_prefix": "output",
"format": "auto",
"format.codec": "auto",
"video": [
"5073:4849",
0
]
},
"_meta": {
"title": "Save Video"
}
},
"5075": {
"class_type": "VHS_VideoCombine",
"inputs": {
"crf": 14,
"filename_prefix": "AnimateDiff",
"format": "video/h264-mp4",
"frame_rate": 8,
"images": [
"5073:4991",
0
],
"loop_count": 0,
"pingpong": False,
"pix_fmt": "yuv420p",
"save_metadata": True,
"save_output": False,
"trim_to_audio": False
},
"_meta": {
"title": "Video Combine 🎥🅥🅗🅢"
}
},
"5076": {
"class_type": "LoadImage",
"inputs": {
"image": "ad51bba819a91ed64386b035c44b36da9d29b2cef9dc02389b96738dbfa974b8.png"
},
"_meta": {
"title": "Load Image"
}
},
"5077": {
"class_type": "LoadVideo",
"inputs": {
"file": "2660a79624272b901d33725cc770e2b16d47528608c5487c553444c6502d0358.mp4"
},
"_meta": {
"title": "Load Video"
}
},
"5073:1241": {
"class_type": "LTXVConditioning",
"inputs": {
"frame_rate": [
"5073:5000",
2
],
"negative": [
"5073:2612",
0
],
"positive": [
"5073:2483",
0
]
},
"_meta": {
"title": "LTXVConditioning"
}
},
"5073:2483": {
"class_type": "CLIPTextEncode",
"inputs": {
"clip": [
"5073:5023",
0
],
"text": "Boxer breathing hard"
},
"_meta": {
"title": "CLIP Text Encode (Positive Prompt)"
}
},
"5073:2612": {
"class_type": "CLIPTextEncode",
"inputs": {
"clip": [
"5073:5023",
0
],
"text": "pc game, console game, video game, cartoon, childish, ugly"
},
"_meta": {
"title": "CLIP Text Encode (Negative Prompt)"
}
},
"5073:3059": {
"class_type": "EmptyLTXVLatentVideo",
"inputs": {
"batch_size": 1,
"height": [
"5073:5029",
1
],
"length": [
"5073:5029",
2
],
"width": [
"5073:5029",
0
]
},
"_meta": {
"title": "Empty LTXV Latent Video"
}
},
"5073:3159": {
"class_type": "LTXVImgToVideoConditionOnly",
"inputs": {
"bypass": [
"5073:5019",
0
],
"image": [
"5073:5035",
0
],
"latent": [
"5073:3059",
0
],
"strength": 1,
"vae": [
"5073:3940",
2
]
},
"_meta": {
"title": "🅛🅣🅧 LTXV Img To Video Condition Only"
}
},
"5073:3940": {
"class_type": "CheckpointLoaderSimple",
"inputs": {
"ckpt_name": "ltx-2.3-22b-distilled-fp8.safetensors"
},
"_meta": {
"title": "Load Checkpoint"
}
},
"5073:3980": {
"class_type": "LTXVEmptyLatentAudio",
"inputs": {
"audio_vae": [
"5073:4010",
0
],
"batch_size": 1,
"frame_rate": [
"5073:5066",
0
],
"frames_number": [
"5073:5029",
2
]
},
"_meta": {
"title": "Empty LTXV Latent Audio"
}
},
"5073:4010": {
"class_type": "LTXVAudioVAELoader",
"inputs": {
"ckpt_name": "ltx-2.3-22b-distilled-fp8.safetensors"
},
"_meta": {
"title": "Load LTXV Audio VAE"
}
},
"5073:4528": {
"class_type": "LTXVConcatAVLatent",
"inputs": {
"audio_latent": [
"5073:3980",
0
],
"video_latent": [
"5073:5072",
2
]
},
"_meta": {
"title": "Concat AV Latent"
}
},
"5073:4828": {
"class_type": "CFGGuider",
"inputs": {
"cfg": 1,
"model": [
"5073:5069",
0
],
"negative": [
"5073:5072",
1
],
"positive": [
"5073:5072",
0
]
},
"_meta": {
"title": "CFG Guider"
}
},
"5073:4829": {
"class_type": "SamplerCustomAdvanced",
"inputs": {
"guider": [
"5073:4828",
0
],
"latent_image": [
"5073:4528",
0
],
"noise": [
"5073:4832",
0
],
"sampler": [
"5073:4831",
0
],
"sigmas": [
"5073:5025",
0
]
},
"_meta": {
"title": "SamplerCustomAdvanced"
}
},
"5073:4831": {
"class_type": "KSamplerSelect",
"inputs": {
"sampler_name": "euler_ancestral_cfg_pp"
},
"_meta": {
"title": "KSamplerSelect"
}
},
"5073:4832": {
"class_type": "RandomNoise",
"inputs": {
"noise_seed": 42
},
"_meta": {
"title": "RandomNoise"
}
},
"5073:4845": {
"class_type": "LTXVSeparateAVLatent",
"inputs": {
"av_latent": [
"5073:4829",
0
]
},
"_meta": {
"title": "Separate AV Latent"
}
},
"5073:4848": {
"class_type": "LTXVAudioVAEDecode",
"inputs": {
"audio_vae": [
"5073:4010",
0
],
"samples": [
"5073:4845",
1
]
},
"_meta": {
"title": "LTXV Audio VAE Decode"
}
},
"5073:4849": {
"class_type": "CreateVideo",
"inputs": {
"audio": [
"5073:4848",
0
],
"bit_depth": "auto",
"codec": "none",
"color_space": "sRGB",
"fps": [
"5073:5000",
2
],
"images": [
"5073:5065",
0
]
},
"_meta": {
"title": "Create Video"
}
},
"5073:4922": {
"class_type": "LoraLoaderModelOnly",
"inputs": {
"lora_name": "ltx-2.3-22b-distilled-lora-384-1.1.safetensors",
"model": [
"5073:3940",
0
],
"strength_model": 0.5
},
"_meta": {
"title": "Load LoRA"
}
},
"5073:4991": {
"class_type": "CannyEdgePreprocessor",
"inputs": {
"high_threshold": 200,
"image": [
"5073:5026",
0
],
"low_threshold": 92,
"resolution": 1024
},
"_meta": {
"title": "Canny Edge"
}
},
"5073:5000": {
"class_type": "GetVideoComponents",
"inputs": {
"video": [
"5077",
0
]
},
"_meta": {
"title": "Get Video Components"
}
},
"5073:5011": {
"class_type": "LTXICLoRALoaderModelOnly",
"inputs": {
"lora_name": "ltx-2-19b-ic-lora-canny-control.safetensors",
"model": [
"5073:5069",
0
],
"strength_model": 1
},
"_meta": {
"title": "🅛🅣🅧 IC-LoRA Loader Model Only"
}
},
"5073:5013": {
"class_type": "LTXVCropGuides",
"inputs": {
"latent": [
"5073:4845",
0
],
"negative": [
"5073:5072",
1
],
"positive": [
"5073:5072",
0
]
},
"_meta": {
"title": "LTXVCropGuides"
}
},
"5073:5019": {
"class_type": "PrimitiveBoolean",
"inputs": {
"value": False
},
"_meta": {
"title": "bypass_i2v"
}
},
"5073:5023": {
"class_type": "LTXAVTextEncoderLoader",
"inputs": {
"ckpt_name": "ltx-2.3-22b-distilled-fp8.safetensors",
"device": "default",
"text_encoder": "gemma_3_12B_it_fp4_mixed.safetensors"
},
"_meta": {
"title": "Load LTXV Audio Text Encoder"
}
},
"5073:5025": {
"class_type": "ManualSigmas",
"inputs": {
"sigmas": "1.0, 0.99375, 0.9875, 0.98125, 0.975, 0.909375, 0.725, 0.421875, 0.0"
},
"_meta": {
"title": "ManualSigmas"
}
},
"5073:5026": {
"class_type": "ResizeImageMaskNode",
"inputs": {
"input": [
"5073:5000",
0
],
"resize_type": "scale shorter dimension",
"resize_type.shorter_size": 544,
"scale_method": "lanczos"
},
"_meta": {
"title": "Resize Image/Mask"
}
},
"5073:5028": {
"class_type": "ResizeImageMaskNode",
"inputs": {
"input": [
"5073:4991",
0
],
"resize_type": "scale to multiple",
"resize_type.multiple": [
"5073:5034",
0
],
"scale_method": "lanczos"
},
"_meta": {
"title": "Resize Image/Mask"
}
},
"5073:5029": {
"class_type": "GetImageSize",
"inputs": {
"image": [
"5073:5028",
0
]
},
"_meta": {
"title": "Get Image Size"
}
},
"5073:5034": {
"class_type": "SimpleMath+",
"inputs": {
"a": [
"5073:5011",
1
],
"b": 0,
"value": "a*32"
},
"_meta": {
"title": "🔧 Simple Math"
}
},
"5073:5035": {
"class_type": "ResizeImageMaskNode",
"inputs": {
"input": [
"5076",
0
],
"resize_type": "scale longer dimension",
"resize_type.longer_size": 1536,
"scale_method": "lanczos"
},
"_meta": {
"title": "Resize Image/Mask"
}
},
"5073:5065": {
"class_type": "LTXVTiledVAEDecode",
"inputs": {
"horizontal_tiles": 2,
"last_frame_fix": False,
"latents": [
"5073:5013",
2
],
"overlap": 6,
"vae": [
"5073:3940",
2
],
"vertical_tiles": 2,
"working_device": "auto",
"working_dtype": "auto"
},
"_meta": {
"title": "🅛🅣🅧 LTXV Tiled VAE Decode"
}
},
"5073:5066": {
"class_type": "LTXFloatToInt",
"inputs": {
"a": [
"5073:5000",
2
]
},
"_meta": {
"title": "🅛🅣🅧 Float To Int"
}
},
"5073:5069": {
"class_type": "LoraLoaderModelOnly",
"inputs": {
"lora_name": "ltx-2.3-22b-ic-lora-union-control-ref0.5.safetensors",
"model": [
"5073:4922",
0
],
"strength_model": 1
},
"_meta": {
"title": "Load LoRA"
}
},
"5073:5070": {
"class_type": "GetICLoRAParameters",
"inputs": {
"iclora_model": [
"5073:5069",
0
]
},
"_meta": {
"title": "Get IC-LoRA Parameters"
}
},
"5073:5072": {
"class_type": "LTXVAddGuide",
"inputs": {
"frame_idx": 0,
"iclora_parameters": [
"5073:5070",
0
],
"image": [
"5073:5028",
0
],
"latent": [
"5073:3159",
0
],
"negative": [
"5073:1241",
1
],
"positive": [
"5073:1241",
0
],
"strength": 1,
"vae": [
"5073:3940",
2
]
},
"_meta": {
"title": "LTXVAddGuide"
}
}
})
# run() also passes api_key to the partner nodes in this workflow.
job = client.run(workflow, api_key=api_key)