Create a video from references
Combine two reference images into a video with consistent subjects and a scene you describe.
下载工作流在 Cloud 中试用 API 文档
00:00
查看工作流内部
源模板的只读预览。在 Cloud 中打开,即可查看节点并进行修改。
Loading the graph
Open full-size workflow preview- 作者
- ComfyUI
从代码中调用该模型
以下请求使用与体验区相同的预设图和设置。每次提交都可能开始一次付费运行;如果提交结果未知,请勿自动重试。
1 获取 API 密钥 ↗
What you need
- Runs on
- Comfy Cloud
- 密钥
- COMFY_API_KEY
- 你的文件
- 由代码根据链接上传
需要付费的 Cloud 方案和额度。
# 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({
"92": {
"class_type": "SaveVideo",
"inputs": {
"filename_prefix": "video/MiniMax_H3",
"format": "auto",
"format.codec": "auto",
"video": [
"130",
0
]
},
"_meta": {
"title": "Save Video"
}
},
"115": {
"class_type": "ResolutionSelector",
"inputs": {
"aspect_ratio": "16:9 (Widescreen)",
"megapixels": 0.4,
"multiple": 32
},
"_meta": {
"title": "Resolution Selector (Size)"
}
},
"119": {
"class_type": "VAELoader",
"inputs": {
"vae_name": "minimax_h3_video_vae_fp16.safetensors"
},
"_meta": {
"title": "Load VAE"
}
},
"120": {
"class_type": "VAELoader",
"inputs": {
"vae_name": "minimax_h3_audio_vae_fp32.safetensors"
},
"_meta": {
"title": "Load VAE"
}
},
"121": {
"class_type": "VAEDecodeAudio",
"inputs": {
"samples": [
"125",
0
],
"vae": [
"120",
0
]
},
"_meta": {
"title": "VAE Decode Audio"
}
},
"122": {
"class_type": "VAEDecode",
"inputs": {
"samples": [
"125",
0
],
"vae": [
"119",
0
]
},
"_meta": {
"title": "VAE Decode"
}
},
"123": {
"class_type": "KSamplerSelect",
"inputs": {
"sampler_name": "res_multistep"
},
"_meta": {
"title": "KSamplerSelect"
}
},
"124": {
"class_type": "BasicScheduler",
"inputs": {
"denoise": 1,
"model": [
"127",
0
],
"scheduler": "simple",
"steps": [
"142",
0
]
},
"_meta": {
"title": "BasicScheduler"
}
},
"125": {
"class_type": "SamplerCustomAdvanced",
"inputs": {
"guider": [
"126",
0
],
"latent_image": [
"136",
1
],
"noise": [
"129",
0
],
"sampler": [
"123",
0
],
"sigmas": [
"124",
0
]
},
"_meta": {
"title": "SamplerCustomAdvanced"
}
},
"126": {
"class_type": "BasicGuider",
"inputs": {
"conditioning": [
"136",
0
],
"model": [
"141",
0
]
},
"_meta": {
"title": "Basic Guider"
}
},
"127": {
"class_type": "UNETLoader",
"inputs": {
"unet_name": "minimax_h3_ref2va_pruned_int8_convrot.safetensors",
"weight_dtype": "default"
},
"_meta": {
"title": "Load Diffusion Model"
}
},
"128": {
"class_type": "CLIPLoader",
"inputs": {
"clip_name": "qwen3vl_32b_minimax_h3_nvfp4_awq.safetensors",
"device": "default",
"type": "minimax"
},
"_meta": {
"title": "Load CLIP"
}
},
"129": {
"class_type": "RandomNoise",
"inputs": {
"noise_seed": 261662374822964
},
"_meta": {
"title": "RandomNoise"
}
},
"130": {
"class_type": "CreateVideo",
"inputs": {
"audio": [
"121",
0
],
"bit_depth": 8,
"codec": "none",
"color_space": "sRGB",
"fps": 24,
"images": [
"122",
0
]
},
"_meta": {
"title": "Create Video"
}
},
"131": {
"class_type": "ComfyMathExpression",
"inputs": {
"expression": "max(5, round(a * 24)) + (5 - (max(5, round(a * 24)) % 17)) % 17",
"values.a": [
"132",
0
]
},
"_meta": {
"title": "Math Expression"
}
},
"132": {
"class_type": "PrimitiveFloat",
"inputs": {
"value": 5
},
"_meta": {
"title": "Float (Duration)"
}
},
"136": {
"class_type": "MiniMaxH3ReferenceToVideo",
"inputs": {
"audio_vae": [
"120",
0
],
"clip": [
"128",
0
],
"height": [
"115",
1
],
"length": [
"131",
1
],
"prompt": [
"138",
0
],
"ref_image_size": "match",
"ref_images.ref_image_0": [
"137",
0
],
"ref_images.ref_image_1": [
"139",
0
],
"vae": [
"119",
0
],
"width": [
"115",
0
]
},
"_meta": {
"title": "MiniMax H3 Reference to Video"
}
},
"137": {
"class_type": "LoadImage",
"inputs": {
"image": "UPLOADED_image1_FILENAME"
},
"_meta": {
"title": "Load Image"
}
},
"138": {
"class_type": "PrimitiveStringMultiline",
"inputs": {
"value": "Use the first reference for the young superhero and rooftop setting, and the second reference for the mechanical dragon. In a bold comic-book style, the superhero looks up as the dragon sweeps across the night skyline. Keep both subjects consistent with their references. A smooth camera push-in builds anticipation."
},
"_meta": {
"title": "Input Text (Prompt)"
}
},
"139": {
"class_type": "LoadImage",
"inputs": {
"image": "UPLOADED_image2_FILENAME"
},
"_meta": {
"title": "Load Image"
}
},
"141": {
"class_type": "ComfySwitchNode",
"inputs": {
"on_false": [
"127",
0
],
"on_true": [
"145",
0
],
"switch": [
"146",
0
]
},
"_meta": {
"title": "If/Else Switch (model)"
}
},
"142": {
"class_type": "ComfySwitchNode",
"inputs": {
"on_false": [
"143",
0
],
"on_true": [
"144",
0
],
"switch": [
"146",
0
]
},
"_meta": {
"title": "If/Else Switch (Steps)"
}
},
"143": {
"class_type": "PrimitiveInt",
"inputs": {
"value": 20
},
"_meta": {
"title": "Int (Full)"
}
},
"144": {
"class_type": "PrimitiveInt",
"inputs": {
"value": 4
},
"_meta": {
"title": "Int (Lightning LoRA)"
}
},
"145": {
"class_type": "LoraLoaderModelOnly",
"inputs": {
"lora_name": "minimax_h3_ref2v_turbo_4step_v0.1_comfyui_bf16.safetensors",
"model": [
"127",
0
],
"strength_model": 1
},
"_meta": {
"title": "Load LoRA"
}
},
"146": {
"class_type": "PrimitiveBoolean",
"inputs": {
"value": False
},
"_meta": {
"title": "Boolean (Enable Lightning LoRA)"
}
}
})
workflow.set_input("137", "image", client.assets.from_url("https://cdn.jsdelivr.net/gh/Comfy-Org/workflow_templates@90c71fb78b3726392d010ff62a8e79e92d7296ad/input/red_superboy_on_city_roof.png"))
workflow.set_input("139", "image", client.assets.from_url("https://cdn.jsdelivr.net/gh/Comfy-Org/workflow_templates@90c71fb78b3726392d010ff62a8e79e92d7296ad/input/mecha_dragon_lightning.png"))
# 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("92"):
output.to_file(output.name)