# 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({
"68": {
"class_type": "SaveVideo",
"inputs": {
"filename_prefix": "video/ltx2.3_flf2v",
"format": "auto",
"format.codec": "auto",
"video": [
"139:122",
0
]
},
"_meta": {
"title": "Save Video"
}
},
"137": {
"class_type": "LoadImage",
"inputs": {
"image": "ltx23_flf2v_last_frame.png"
},
"_meta": {
"title": "Load Image"
}
},
"138": {
"class_type": "LoadImage",
"inputs": {
"image": "ltx23_flf2v_first_frame.png"
},
"_meta": {
"title": "Load Image"
}
},
"139:100": {
"class_type": "RandomNoise",
"inputs": {
"noise_seed": 767871932424233
},
"_meta": {
"title": "RandomNoise"
}
},
"139:101": {
"class_type": "LTXVEmptyLatentAudio",
"inputs": {
"audio_vae": [
"139:126",
0
],
"batch_size": 1,
"frame_rate": [
"139:114",
0
],
"frames_number": [
"139:144",
1
]
},
"_meta": {
"title": "Empty LTXV Latent Audio"
}
},
"139:103": {
"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"
}
},
"139:104": {
"class_type": "LTXVPreprocess",
"inputs": {
"image": [
"139:124",
0
],
"img_compression": 25
},
"_meta": {
"title": "LTXV Preprocess"
}
},
"139:105": {
"class_type": "VAEDecodeTiled",
"inputs": {
"overlap": 64,
"samples": [
"139:106",
2
],
"temporal_overlap": 64,
"temporal_size": 4096,
"tile_size": 768,
"vae": [
"139:127",
2
]
},
"_meta": {
"title": "VAE Decode (Tiled)"
}
},
"139:106": {
"class_type": "LTXVCropGuides",
"inputs": {
"latent": [
"139:121",
0
],
"negative": [
"139:111",
1
],
"positive": [
"139:111",
0
]
},
"_meta": {
"title": "LTXVCropGuides"
}
},
"139:107": {
"class_type": "LTXVAudioVAEDecode",
"inputs": {
"audio_vae": [
"139:126",
0
],
"samples": [
"139:121",
1
]
},
"_meta": {
"title": "LTXV Audio VAE Decode"
}
},
"139:108": {
"class_type": "EmptyLTXVLatentVideo",
"inputs": {
"batch_size": 1,
"height": [
"139:110",
1
],
"length": [
"139:144",
1
],
"width": [
"139:110",
0
]
},
"_meta": {
"title": "Empty LTXV Latent Video"
}
},
"139:109": {
"class_type": "LTXVConditioning",
"inputs": {
"frame_rate": [
"139:123",
0
],
"negative": [
"139:112",
0
],
"positive": [
"139:128",
0
]
},
"_meta": {
"title": "LTXVConditioning"
}
},
"139:110": {
"class_type": "GetImageSize",
"inputs": {
"image": [
"139:124",
0
]
},
"_meta": {
"title": "Get Image Size"
}
},
"139:111": {
"class_type": "LTXVAddGuide",
"inputs": {
"frame_idx": -1,
"image": [
"139:99",
0
],
"latent": [
"139:115",
2
],
"negative": [
"139:115",
1
],
"positive": [
"139:115",
0
],
"strength": 0.7,
"vae": [
"139:127",
2
]
},
"_meta": {
"title": "LTXVAddGuide"
}
},
"139:112": {
"class_type": "CLIPTextEncode",
"inputs": {
"clip": [
"139:103",
0
],
"text": "blurry, out of focus, overexposed, underexposed, low contrast, washed out colors, excessive noise, grainy texture, poor lighting, flickering, motion blur, distorted proportions, unnatural skin tones, deformed facial features, asymmetrical face, missing facial features, extra limbs, disfigured hands, wrong hand count, artifacts around text, unreadable text on shirt or hat, incorrect lettering on cap (“PNTR”), incorrect t-shirt slogan (“JUST DO IT”), missing microphone, misplaced microphone, inconsistent perspective, camera shake, incorrect depth of field, background too sharp, background clutter, distracting reflections, harsh shadows, inconsistent lighting direction, color banding, cartoonish rendering, 3D CGI look, unrealistic materials, uncanny valley effect, incorrect ethnicity, wrong gender, exaggerated expressions, smiling, laughing, exaggerated sadness, wrong gaze direction, eyes looking at camera, mismatched lip sync, silent or muted audio, distorted voice, robotic voice, echo, background noise, off-sync audio, missing sniff sounds, incorrect dialogue, added dialogue, repetitive speech, jittery movement, awkward pauses, incorrect timing, unnatural transitions, inconsistent framing, tilted camera, missing door or shelves, missing shallow depth of field, flat lighting, inconsistent tone, cinematic oversaturation, stylized filters, or AI artifacts."
},
"_meta": {
"title": "CLIP Text Encode (Prompt)"
}
},
"139:113": {
"class_type": "PrimitiveInt",
"inputs": {
"value": 720
},
"_meta": {
"title": "Width"
}
},
"139:114": {
"class_type": "PrimitiveInt",
"inputs": {
"value": 25
},
"_meta": {
"title": "Frame Rate(int)"
}
},
"139:115": {
"class_type": "LTXVAddGuide",
"inputs": {
"frame_idx": 0,
"image": [
"139:104",
0
],
"latent": [
"139:108",
0
],
"negative": [
"139:109",
1
],
"positive": [
"139:109",
0
],
"strength": 0.7,
"vae": [
"139:127",
2
]
},
"_meta": {
"title": "LTXVAddGuide"
}
},
"139:116": {
"class_type": "CFGGuider",
"inputs": {
"cfg": 1,
"model": [
"139:129",
0
],
"negative": [
"139:111",
1
],
"positive": [
"139:111",
0
]
},
"_meta": {
"title": "CFG Guider"
}
},
"139:117": {
"class_type": "SamplerEulerAncestral",
"inputs": {
"eta": 0,
"s_noise": 1
},
"_meta": {
"title": "SamplerEulerAncestral"
}
},
"139:118": {
"class_type": "ManualSigmas",
"inputs": {
"sigmas": "1., 0.99375, 0.9875, 0.98125, 0.975, 0.909375, 0.725, 0.421875, 0.0"
},
"_meta": {
"title": "ManualSigmas"
}
},
"139:119": {
"class_type": "LTXVConcatAVLatent",
"inputs": {
"audio_latent": [
"139:101",
0
],
"video_latent": [
"139:111",
2
]
},
"_meta": {
"title": "Concat AV Latent"
}
},
"139:120": {
"class_type": "SamplerCustomAdvanced",
"inputs": {
"guider": [
"139:116",
0
],
"latent_image": [
"139:119",
0
],
"noise": [
"139:100",
0
],
"sampler": [
"139:117",
0
],
"sigmas": [
"139:118",
0
]
},
"_meta": {
"title": "SamplerCustomAdvanced"
}
},
"139:121": {
"class_type": "LTXVSeparateAVLatent",
"inputs": {
"av_latent": [
"139:120",
1
]
},
"_meta": {
"title": "Separate AV Latent"
}
},
"139:122": {
"class_type": "CreateVideo",
"inputs": {
"audio": [
"139:107",
0
],
"bit_depth": "auto",
"codec": "none",
"color_space": "sRGB",
"fps": [
"139:123",
0
],
"images": [
"139:105",
0
]
},
"_meta": {
"title": "Create Video"
}
},
"139:123": {
"class_type": "ComfyMathExpression",
"inputs": {
"expression": "a",
"values.a": [
"139:114",
0
]
},
"_meta": {
"title": "Math Expression"
}
},
"139:124": {
"class_type": "ResizeImageMaskNode",
"inputs": {
"input": [
"138",
0
],
"resize_type": "scale dimensions",
"resize_type.crop": "center",
"resize_type.height": [
"139:98",
0
],
"resize_type.width": [
"139:113",
0
],
"scale_method": "nearest-exact"
},
"_meta": {
"title": "Resize Image/Mask"
}
},
"139:125": {
"class_type": "ResizeImageMaskNode",
"inputs": {
"input": [
"137",
0
],
"resize_type": "scale dimensions",
"resize_type.crop": "center",
"resize_type.height": [
"139:98",
0
],
"resize_type.width": [
"139:113",
0
],
"scale_method": "nearest-exact"
},
"_meta": {
"title": "Resize Image/Mask"
}
},
"139:126": {
"class_type": "LTXVAudioVAELoader",
"inputs": {
"ckpt_name": "ltx-2.3-22b-distilled-fp8.safetensors"
},
"_meta": {
"title": "Load LTXV Audio VAE"
}
},
"139:127": {
"class_type": "CheckpointLoaderSimple",
"inputs": {
"ckpt_name": "ltx-2.3-22b-distilled-fp8.safetensors"
},
"_meta": {
"title": "Load Checkpoint"
}
},
"139:128": {
"class_type": "CLIPTextEncode",
"inputs": {
"clip": [
"139:103",
0
],
"text": "The red hair wizard girl looks up as the magical flame burns in her palm. Camera dollys out. The scene turns from a professional photography to a wet pastel watercolor painting. zhuanchang"
},
"_meta": {
"title": "CLIP Text Encode (Prompt)"
}
},
"139:129": {
"class_type": "LoraLoaderModelOnly",
"inputs": {
"lora_name": "ltx2.3-transition.safetensors",
"model": [
"139:127",
0
],
"strength_model": 1
},
"_meta": {
"title": "Load LoRA"
}
},
"139:143": {
"class_type": "PrimitiveInt",
"inputs": {
"value": 6
},
"_meta": {
"title": "Duration"
}
},
"139:144": {
"class_type": "ComfyMathExpression",
"inputs": {
"expression": "a * b + 1",
"values.a": [
"139:143",
0
],
"values.b": [
"139:114",
0
]
},
"_meta": {
"title": "Math Expression"
}
},
"139:98": {
"class_type": "PrimitiveInt",
"inputs": {
"value": 1280
},
"_meta": {
"title": "Height"
}
},
"139:99": {
"class_type": "LTXVPreprocess",
"inputs": {
"image": [
"139:125",
0
],
"img_compression": 25
},
"_meta": {
"title": "LTXV Preprocess"
}
}
})
# run() also passes api_key to the partner nodes in this workflow.
job = client.run(workflow, api_key=api_key)