# 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({
"8": {
"class_type": "SaveVideo",
"inputs": {
"filename_prefix": "video/MiniMax_H3_t2v",
"format": "auto",
"format.codec": "auto",
"video": [
"23",
0
]
},
"_meta": {
"title": "Save Video"
}
},
"23": {
"class_type": "MinimaxHailuo03TextToVideoNode",
"inputs": {
"model": "MiniMax H3",
"model.duration": 5,
"model.prompt": "In a dramatic noir atmosphere, a sweeping aerial orbit slowly pushes in around a colossal, elderly South Asian maestro hovering high above a rain-soaked, 1920s Art Deco metropolis at midnight. With a lean, weathered build and flowing silver braids that whip in the tempest, he conducts in sweeping, fluid strokes, dressed in voluminous velvet robes embroidered with antique gold thread. Below him, gargantuan brass horns and monumental cello strings hover between towering gothic spires, vibrating with visible shockwaves of golden light that ripple across the stormy cloud deck. Torrential rain pours across the scene, catching the moody glow of amber streetlamps and neon signs far below. The continuous camera arcs steadily around the conductor's intense expression, revealing shimmering trails of mist swirling from his frantic baton across the sprawling, wet city grid.",
"model.ratio": "16:9",
"model.resolution": "2K",
"seed": 42,
"watermark": False
},
"_meta": {
"title": "MiniMax H3 Text to Video"
}
}
})
# 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("8"):
output.to_file(output.name)