# 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({
"2": {
"class_type": "GeminiVideoOmni",
"inputs": {
"model": "Omni Flash",
"model.images.image_1": [
"3",
0
],
"model.prompt": "change my outfit to the outfit in image_1. Keep everything else exactly the same.",
"model.temperature": 1,
"model.top_p": 0.95,
"model.videos.video_1": [
"5",
0
],
"seed": 2116897663
},
"_meta": {
"title": "Google Gemini Omni (Video)"
}
},
"3": {
"class_type": "LoadImage",
"inputs": {
"image": "UPLOADED_image_FILENAME"
},
"_meta": {
"title": "Outfit Reference"
}
},
"5": {
"class_type": "LoadVideo",
"inputs": {
"file": "UPLOADED_video_FILENAME"
},
"_meta": {
"title": "Your Footage"
}
},
"6": {
"class_type": "SaveVideo",
"inputs": {
"filename_prefix": "video/OmniOutfitSwap",
"format": "auto",
"format.codec": "auto",
"video": [
"2",
0
]
},
"_meta": {
"title": "Save Video"
}
}
})
# Replace each example.com URL with a public URL of your file.
workflow.set_input("3", "image", client.assets.from_url("https://example.com/replace-with-a-url/image"))
workflow.set_input("5", "file", client.assets.from_url("https://example.com/replace-with-a-url/video"))
# run() also passes api_key to the partner nodes in this workflow.
job = client.run(workflow, api_key=api_key)