# 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({
"75": {
"class_type": "SaveVideo",
"inputs": {
"filename_prefix": "video/LTX_2.5_t2v",
"format": "auto",
"format.codec": "auto",
"video": [
"405:370",
0
]
},
"_meta": {
"title": "Save Video"
}
},
"409": {
"class_type": "ResolutionSelector",
"inputs": {
"aspect_ratio": "16:9 (Widescreen)",
"megapixels": 0.9,
"multiple": 32
},
"_meta": {
"title": "Resolution Selector"
}
},
"405:338": {
"class_type": "RandomNoise",
"inputs": {
"noise_seed": 42
},
"_meta": {
"title": "RandomNoise"
}
},
"405:339": {
"class_type": "RandomNoise",
"inputs": {
"noise_seed": 558811532553686
},
"_meta": {
"title": "RandomNoise"
}
},
"405:340": {
"class_type": "LTXVConcatAVLatent",
"inputs": {
"audio_latent": [
"405:367",
1
],
"video_latent": [
"405:348",
0
]
},
"_meta": {
"title": "Concat AV Latent"
}
},
"405:341": {
"class_type": "KSamplerSelect",
"inputs": {
"sampler_name": "euler_ancestral"
},
"_meta": {
"title": "KSamplerSelect"
}
},
"405:344": {
"class_type": "SamplerCustomAdvanced",
"inputs": {
"guider": [
"405:388",
0
],
"latent_image": [
"405:377",
0
],
"noise": [
"405:339",
0
],
"sampler": [
"405:352",
0
],
"sigmas": [
"405:404",
0
]
},
"_meta": {
"title": "SamplerCustomAdvanced"
}
},
"405:348": {
"class_type": "LTXVLatentUpsampler",
"inputs": {
"samples": [
"405:367",
0
],
"upscale_model": [
"405:371",
0
],
"vae": [
"405:385",
0
]
},
"_meta": {
"title": "LTXVLatentUpsampler"
}
},
"405:352": {
"class_type": "KSamplerSelect",
"inputs": {
"sampler_name": "euler_ancestral"
},
"_meta": {
"title": "KSamplerSelect"
}
},
"405:353": {
"class_type": "ComfyMathExpression",
"inputs": {
"expression": "a/2",
"values.a": [
"405:372",
0
]
},
"_meta": {
"title": "Math Expression"
}
},
"405:355": {
"class_type": "ComfyMathExpression",
"inputs": {
"expression": "a/2",
"values.a": [
"405:360",
0
]
},
"_meta": {
"title": "Math Expression"
}
},
"405:356": {
"class_type": "EmptyLTXVLatentVideo",
"inputs": {
"batch_size": 1,
"height": [
"405:355",
1
],
"length": [
"405:378",
1
],
"width": [
"405:353",
1
]
},
"_meta": {
"title": "Empty LTXV Latent Video"
}
},
"405:358": {
"class_type": "LTXVAudioVAEDecode",
"inputs": {
"audio_vae": [
"405:386",
0
],
"samples": [
"405:369",
1
]
},
"_meta": {
"title": "LTXV Audio VAE Decode"
}
},
"405:359": {
"class_type": "ComfyMathExpression",
"inputs": {
"expression": "a",
"values.a": [
"405:361",
0
]
},
"_meta": {
"title": "Math Expression (fps)"
}
},
"405:360": {
"class_type": "PrimitiveInt",
"inputs": {
"value": [
"409",
1
]
},
"_meta": {
"title": "Height"
}
},
"405:361": {
"class_type": "PrimitiveInt",
"inputs": {
"value": 24
},
"_meta": {
"title": "Frame Rate"
}
},
"405:362": {
"class_type": "PrimitiveInt",
"inputs": {
"value": 5
},
"_meta": {
"title": "Duration"
}
},
"405:364": {
"class_type": "CLIPTextEncode",
"inputs": {
"clip": [
"405:387",
0
],
"text": [
"405:382",
0
]
},
"_meta": {
"title": "CLIP Text Encode (Prompt)"
}
},
"405:365": {
"class_type": "LTXVConditioning",
"inputs": {
"frame_rate": [
"405:359",
0
],
"negative": [
"405:373",
0
],
"positive": [
"405:364",
0
]
},
"_meta": {
"title": "LTXVConditioning"
}
},
"405:366": {
"class_type": "LTXVEmptyLatentAudio",
"inputs": {
"audio_vae": [
"405:386",
0
],
"batch_size": 1,
"frame_rate": [
"405:359",
1
],
"frames_number": [
"405:378",
1
]
},
"_meta": {
"title": "Empty LTXV Latent Audio"
}
},
"405:367": {
"class_type": "LTXVSeparateAVLatent",
"inputs": {
"av_latent": [
"405:344",
0
]
},
"_meta": {
"title": "Separate AV Latent"
}
},
"405:368": {
"class_type": "SamplerCustomAdvanced",
"inputs": {
"guider": [
"405:391",
0
],
"latent_image": [
"405:340",
0
],
"noise": [
"405:338",
0
],
"sampler": [
"405:341",
0
],
"sigmas": [
"405:395",
0
]
},
"_meta": {
"title": "SamplerCustomAdvanced"
}
},
"405:369": {
"class_type": "LTXVSeparateAVLatent",
"inputs": {
"av_latent": [
"405:368",
0
]
},
"_meta": {
"title": "Separate AV Latent"
}
},
"405:370": {
"class_type": "CreateVideo",
"inputs": {
"audio": [
"405:358",
0
],
"bit_depth": 8,
"codec": "none",
"color_space": "sRGB",
"fps": [
"405:359",
0
],
"images": [
"405:374",
0
]
},
"_meta": {
"title": "Create Video"
}
},
"405:371": {
"class_type": "LatentUpscaleModelLoader",
"inputs": {
"model_name": "ltx-2.5-latent-spatial-upscaler-x2-bf16-1.0.safetensors"
},
"_meta": {
"title": "Load Latent Upscale Model"
}
},
"405:372": {
"class_type": "PrimitiveInt",
"inputs": {
"value": [
"409",
0
]
},
"_meta": {
"title": "Width"
}
},
"405:373": {
"class_type": "CLIPTextEncode",
"inputs": {
"clip": [
"405:387",
0
],
"text": "pc game, console game, video game, cartoon, childish, ugly"
},
"_meta": {
"title": "CLIP Text Encode (Prompt)"
}
},
"405:374": {
"class_type": "VAEDecodeTiled",
"inputs": {
"overlap": 64,
"samples": [
"405:369",
0
],
"temporal_overlap": 32,
"temporal_size": 4096,
"tile_size": 768,
"vae": [
"405:385",
0
]
},
"_meta": {
"title": "VAE Decode (Tiled)"
}
},
"405:376": {
"class_type": "PrimitiveStringMultiline",
"inputs": {
"value": "Low-angle cinematic close-up shot on an 85mm anamorphic prime lens, revealing an astronaut’s contemplative face behind a curved, rain-streaked helmet glass. Cold, diffuse moonlight and pale emerald reflections from an alien aurora wash softly across the glass, creating a quiet, melancholic atmosphere. The muted palette consists of deep sea-green, faded indigo, and soft silver highlights. The camera executes a slow dolly push-in toward the face as the subject blinks slowly, their steady breath faintly fogging the interior glass before evaporating. Micro-scratches on the visor scatter the ambient glow across shadowed cheekbones. Ambient audio captures rhythmic, muffled rebreather inhalations against a deep pressurized drone and faint radio hiss."
},
"_meta": {
"title": "Prompt"
}
},
"405:377": {
"class_type": "LTXVConcatAVLatent",
"inputs": {
"audio_latent": [
"405:366",
0
],
"video_latent": [
"405:356",
0
]
},
"_meta": {
"title": "Concat AV Latent"
}
},
"405:378": {
"class_type": "ComfyMathExpression",
"inputs": {
"expression": "a * b + 1",
"values.a": [
"405:362",
0
],
"values.b": [
"405:361",
0
]
},
"_meta": {
"title": "Math Expression (length)"
}
},
"405:380": {
"class_type": "TextGenerateLTX2Prompt",
"inputs": {
"clip": [
"405:393",
0
],
"max_length": 600,
"mtp": "auto",
"prompt": [
"405:376",
0
],
"sampling_mode": "on",
"sampling_mode.min_p": 0.05,
"sampling_mode.presence_penalty": 0,
"sampling_mode.repetition_penalty": 1.15,
"sampling_mode.seed": 0,
"sampling_mode.temperature": 0.7,
"sampling_mode.top_k": 64,
"sampling_mode.top_p": 0.95,
"thinking": False,
"use_default_template": True
},
"_meta": {
"title": "Generate LTX2 Prompt"
}
},
"405:381": {
"class_type": "PreviewAny",
"inputs": {
"source": [
"405:382",
0
]
},
"_meta": {
"title": "Preview as Text"
}
},
"405:382": {
"class_type": "ComfySwitchNode",
"inputs": {
"on_false": [
"405:376",
0
],
"on_true": [
"405:380",
0
],
"switch": [
"405:383",
0
]
},
"_meta": {
"title": "If/Else Switch"
}
},
"405:383": {
"class_type": "PrimitiveBoolean",
"inputs": {
"value": True
},
"_meta": {
"title": "Boolean (Enable Prompt Enhance)"
}
},
"405:384": {
"class_type": "UNETLoader",
"inputs": {
"unet_name": "ltx-2.5-22b-distilled-transformer-comfy-int8-convrot.safetensors",
"weight_dtype": "default"
},
"_meta": {
"title": "Load Diffusion Model"
}
},
"405:385": {
"class_type": "VAELoader",
"inputs": {
"vae_name": "ltx-2.5-video-vae-bf16.safetensors"
},
"_meta": {
"title": "Load VAE"
}
},
"405:386": {
"class_type": "VAELoader",
"inputs": {
"vae_name": "ltx-2.5-audio-vae-bf16.safetensors"
},
"_meta": {
"title": "Load VAE"
}
},
"405:387": {
"class_type": "CLIPLoader",
"inputs": {
"clip_name": "gemma4-12b-with-proj-ltx-2.5-comfy-int8-convrot.safetensors",
"device": "default",
"type": "ltxv"
},
"_meta": {
"title": "Load CLIP"
}
},
"405:388": {
"class_type": "LTXVDualCFGGuider",
"inputs": {
"audio_cfg": 1,
"model": [
"405:384",
0
],
"negative": [
"405:365",
1
],
"positive": [
"405:365",
0
],
"video_cfg": 1
},
"_meta": {
"title": "LTXV Dual CFG Guider"
}
},
"405:391": {
"class_type": "LTXVDualCFGGuider",
"inputs": {
"audio_cfg": 1,
"model": [
"405:384",
0
],
"negative": [
"405:365",
1
],
"positive": [
"405:365",
0
],
"video_cfg": 1
},
"_meta": {
"title": "LTXV Dual CFG Guider"
}
},
"405:393": {
"class_type": "CLIPLoader",
"inputs": {
"clip_name": "gemma4_e2b_it_bf16.safetensors",
"device": "default",
"type": "ltxv"
},
"_meta": {
"title": "Load CLIP"
}
},
"405:395": {
"class_type": "ManualSigmas",
"inputs": {
"sigmas": "0.85, 0.7250, 0.4219, 0.0"
},
"_meta": {
"title": "ManualSigmas"
}
},
"405:404": {
"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"
}
}
})
# run() also passes api_key to the partner nodes in this workflow.
job = client.run(workflow, api_key=api_key)
for output in job.get_outputs("75"):
output.to_file(output.name)