# 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({
"3": {
"class_type": "GeminiVideoOmniV2",
"inputs": {
"model": "Omni Flash 1.2",
"model.aspect_ratio": "16:9",
"model.images.image_1": [
"11",
0
],
"model.images.image_2": [
"23",
0
],
"model.prompt": "Two reference images wired in order: image 1 is her full-body cyan light-armor cut, shoulder cannon, and combat stance; image 2 locks face, short cyan hair, headset, and LED chest/shoulder. Same identity-locked heroine throughout—image 1 for silhouette/armor, image 2 for face. NIGHT CHASE / ENTER-WORLD game cinematic: she must reach the glowing zone gate and clear the drone blocking it. Timer and score HUD flipping in corners only; shoulder-cannon burst. 5-second 16:9 high-end playful AAA trailer feel. Reject quiet face punch-ins only, seated poses, vulgar cheap cyber, top-down ugly showcase.\n\n[0-1.6s] Wide night city rooftop: she sprints matching image-1 silhouette toward a distant ENTERING ZONE gate; ENTERING ZONE banner streaks; TIMER 00:45→00:42 and SCORE 9800→10150 flip in crisp corner HUD; cyan armor LEDs strobe with footfalls. HARD CUT.\n[1.6-3.4s] Same leap continues—shoulder-level chase cam: she vaults the gap, twists, lands on the gate roof; shoulder rail locks on the drone blocking the doorway; AMMO 40→37 and a red lock diamond snap; she fires a cyan cannon burst with recoil micro-tremor; damage 860 floats. HARD CUT.\n[3.4-5s] Three-quarter hold: she slides through the open gate, lands hard, chin raised, face readable from image 2; MISSION CLEAR +1200 and timer freeze 00:38 pop; cooldown ring pulses once; clear subject, shallow DOF, restrained anamorphic edge; no black frames.\n\nAudio: night wind + timer ticks → vault whoosh + rail shot + lock beep → clear chime; no dialogue, no lyrics.",
"model.resolution": "720p",
"model.seed": 249701402,
"model.task_type": "reference_to_video"
},
"_meta": {
"title": "Google Gemini Omni (Video)"
}
},
"4": {
"class_type": "SaveVideo",
"inputs": {
"codec": "auto",
"filename_prefix": "video/Omni_Flash_1.2_r2v",
"format": "auto",
"format.codec": "auto",
"video": [
"3",
0
]
},
"_meta": {
"title": "Save Video"
}
},
"11": {
"class_type": "LoadImage",
"inputs": {
"image": "UPLOADED_reference_1_FILENAME"
},
"_meta": {
"title": "Load Image"
}
},
"23": {
"class_type": "LoadImage",
"inputs": {
"image": "UPLOADED_reference_2_FILENAME"
},
"_meta": {
"title": "Load Image"
}
}
})
workflow.set_input("11", "image", client.assets.from_url("https://comfy.org/catalog-media/7e320531-b407-4c69-81df-213b7fc1b893/b26c813e-0557-4ba1-b3ae-d8a7df40b4d4"))
workflow.set_input("23", "image", client.assets.from_url("https://comfy.org/catalog-media/1d5630d9-b0b1-44fd-9a71-8cfa2d1c33f2/dfa3c6bc-044d-40bf-af3f-cb085428606e"))
# 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("4"):
output.to_file(output.name)