"""Radiance MiniMax: a ComfyUI node that renders a clip on a radiance server serving MiniMax-H3. The node is an HTTP client of POST /v1/videos: the model runs in the radiance server process, on this machine or another, and the node holds no model and no VRAM. The node's description (its ? pane) documents every input; README.md documents the server side. """ import io as _io import json import logging import os import re import tempfile import time import wave import requests import folder_paths from comfy_api.latest import io, ui, Types from comfy_api.input_impl import VideoFromFile POLL_SECONDS = 3.0 KEEPALIVE_SECONDS = 30.0 LOG = "RadianceMiniMax" # The size law the minimaxh3 plugin declares (arch/minimaxh3/minimaxh3.cpp): sides multiples of # 32 px and at least 256, an aspect of at most 4:1, an area of at most 1344 x 768. The server # enforces it; the node applies it first so the title can show the size a request will carry. SIZE_MULT, MIN_SIDE = 32, 256 MAX_AREA, MAX_ASPECT = 1344 * 768, 4.0 # A tier is the short side; the aspect gives the long side. 720p is the last tier whose canvas # fits the area at 16:9. TIERS = {"144p": 144, "240p": 240, "360p": 360, "480p": 480, "540p": 540, "576p": 576, "720p": 720} ASPECTS = ["5:4", "4:3", "3:2", "16:9", "2:1", "1:1", "1:2", "9:16", "2:3", "3:4", "4:5"] # The keyframe tasks and the form field each of their images goes in. KEYFRAMES = {"i2va": ["first_frame"], "l2va": ["last_frame"], "fl2va": ["first_frame", "last_frame"]} DESCRIPTION = """Renders video and audio on a **radiance server serving MiniMax-H3** (`POST /v1/videos`). The node is an HTTP client: the model runs in the server process and the node holds no VRAM. ## Media by task | task | media used | |---|---| | `t2va` | none | | `i2va` | `image_1`: the first frame | | `l2va` | `image_1`: the last frame | | `fl2va` | `image_1`: the first frame, `image_2`: the last frame | | `ref2va` | every media input | A task ignores the media it does not use, with a warning on the console. For `ref2va`: - **image_1..image_9**: reference pictures (subjects, settings, style). - **video_1..video_3**: reference clips (motion, camera). - **video_audio_1..video_audio_3**: the soundtrack of `video_N`; `video_N` must be connected. - **audio_1..audio_3**: standalone reference audio, such as a voice. Fill each kind in order, without gaps: the input's number is the reference's number in the request (``, `