workflows / MINIMAX_H3_API_WORKFLOWS_GUIDE.md
malcolmrey's picture
workflows
18b46f4
|
Raw History Blame Contribute Delete
14.1 kB
# MiniMax-H3 ComfyUI API Workflows: Comprehensive Guide & Catalog
_Author: malcolmrey_
_Last Updated: September 2026_
_Repository & Models: [huggingface.co/malcolmrey](https://huggingface.co/malcolmrey)_
---
## 1. Overview & Ecosystem Architecture
**MiniMax-H3** is a state-of-the-art multimodal video and audio generation Diffusion Transformer (DiT). This collection provides production-ready, programmatic **ComfyUI API workflows** (`workflow_api_*.json`) covering:
1. **FirstBlockCache (FBC) + SageAttention Fused Acceleration:** Realizing up to **5.24× speedups** with zero quality loss.
2. **Zero-Training RefMod Identity Adapters:** Instant-load persona conditioning without live VAE image encoding overhead or model retraining.
3. **Step Distillation Pipelines:** Native integration with **LightX Turbo v1.0** 8-step and 4-step low-rank adapters.
4. **End-to-End Multimodal Generation:** Simultaneous high-fidelity 35mm cinematic video and lip-synchronized acoustic dialogue / ambient soundscapes.
5. **Clip-to-Video (C2V) Continuous Chaining:** Seamless multi-scene narrative stitching via latent motion context trimming.
---
## 2. Directory Structure & Required Weights
### A. Recommended ComfyUI Model Layout
```text
ComfyUI/
├── models/
│ ├── diffusion_models/
│ │ └── MinimaxH3/
│ │ └── minimax_h3_fl2va_pruned_int8_convrot.safetensors (or bf16 variant)
│ ├── clip/
│ │ └── qwen3vl_32b_minimax_h3_nvfp4_awq.safetensors
│ ├── vae/
│ │ ├── minimax_h3_video_vae_fp16.safetensors
│ │ └── minimax_h3_audio_vae_fp32.safetensors
│ ├── loras/
│ │ └── MinimaxH3/
│ │ └── special/
│ │ ├── minimax_h3_fl2v_turbo_8step_v1.0_comfyui_bf16.safetensors
│ │ ├── minimax_h3_fl2v_turbo_4step_v1.0_768p_comfyui_bf16.safetensors
│ │ └── minimax_h3_fl2v_turbo_4step_v1.2_768p_comfyui_bf16.safetensors
│ └── refmods/
│ ├── minimaxh3_<name>_v1_refmod.safetensors
│ └── ...
```
---
## 3. Required Custom Nodes
To execute these workflows via API or ComfyUI GUI, install the following custom nodes:
1. **`ComfyUI-MiniMaxH3Mod`** (RefMod Loader & Conditioning Apply):
```bash
cd ComfyUI/custom_nodes
git clone https://github.com/Luisacaotica/ComfyUI-MiniMaxH3Mod.git
```
2. **`ComfyUI-MiniMaxH3-FirstBlockCache`** (Transformer Block Caching):
```bash
cd ComfyUI/custom_nodes
git clone https://github.com/chengzeyi/ComfyUI-MiniMaxH3-FirstBlockCache.git
```
3. **`comfyui-kjnodes`** (SageAttention & Optimization Patches):
```bash
cd ComfyUI/custom_nodes
git clone https://github.com/kijai/comfyui-kjnodes.git
```
4. **`rgthree-comfy`** (Power LoRA Loader Stack):
```bash
cd ComfyUI/custom_nodes
git clone https://github.com/rgthree/rgthree-comfy.git
```
5. **`ComfyUI-VideoHelperSuite`** (Video Loaders & Muxing):
```bash
cd ComfyUI/custom_nodes
git clone https://github.com/Kosinkadink/ComfyUI-VideoHelperSuite.git
```
---
## 4. Complete Workflow Registry
### Category 1: Accelerated Standalone RefMod Pipelines (FBC + SageAttention + LightX)
| Workflow File | Steps | Sampler | Scheduler | FBC Mode | Distillation LoRA | Render Time (5s 124f) | Recommended Use Case |
|---|:---:|---|---|---|---|:---:|---|
| `workflow_api_minimaxh3_fbc_refmod_standard.json` | **20** | `res_multistep` | `simple` | **Safe** (0.08 / max 2) | None | ~110s (1m 50s) | Maximum micro-texture archival quality |
| `workflow_api_minimaxh3_fbc_refmod_turbo_8step.json` | **8** | `euler` | `simple` | **Fast** (0.10 / max 2) | LightX Turbo 8-Step | **~41s (2.68× faster)** | **Primary Production Standard** (98% quality) |
| `workflow_api_minimaxh3_fbc_refmod_turbo_4step.json` | **4** | `euler` | `simple` | **Fast** (0.10 / max 2) | LightX Turbo 4-Step | **~21s (5.24× faster)** | High-speed screening & seed hunting |
---
### Category 2: Accelerated C2V (Clip-to-Video) Continuous Chaining Pipelines
These workflows enable **seamless multi-clip narrative continuation** without camera cuts while maintaining full FBC + SageAttention speed acceleration and RefMod persona likeness:
| Workflow File | Steps | Sampler | Scheduler | FBC Mode | Distillation LoRA | C2V Motion Context | Recommended Use Case |
|---|:---:|---|---|---|---|:---:|---|
| `workflow_api_minimaxh3_fbc_refmod_c2v_standard.json` | **20** | `res_multistep` | `simple` | **Safe** (0.08 / max 2) | None | 22 frames (trimmed) | Master-quality continuous narrative scenes |
| `workflow_api_minimaxh3_fbc_refmod_c2v_turbo_8step.json` | **8** | `euler` | `simple` | **Fast** (0.10 / max 2) | LightX Turbo 8-Step | 22 frames (trimmed) | **Primary Multi-Scene Movie Production** (~41s/scene) |
| `workflow_api_minimaxh3_fbc_refmod_c2v_turbo_4step.json` | **4** | `euler` | `simple` | **Fast** (0.10 / max 2) | LightX Turbo 4-Step | 22 frames (trimmed) | Fast multi-clip storyboarding (~21s/scene) |
#### C2V Pipeline Dataflow:
```
[ UNETLoader ] ──► [ PathchSageAttentionKJ ] ──► [ ApplyMiniMaxH3FirstBlockCache ]
│
▼
[ Power Lora Loader (rgthree) ]
│
[ CLIPLoader ] ──► [ MiniMaxH3ImageToVideo ] ◄─────────────────┘
│
[ RefModsLoader ] ──► [ MiniMaxH3RefModApply ]
│
[ MotionContextLoadLatent ] ──► [ MiniMaxH3MotionContext ]
│
▼
[ BasicGuider + SamplerCustomAdvanced ]
│
┌─────────────┼─────────────┐
▼ ▼ ▼
[ VAEDecode ] [ VAEDecodeAudio ] [ MotionContextSaveLatent ]
│ │
└──────┬──────┘
▼
[ MotionContextTrim ] ──► [ CreateVideo ] ──► [ SaveVideo ]
```
---
### Category 3: Legacy & Core Multimodal Workflows
#### 1. Text-to-Video (T2V) — `workflow_api_minimaxh3_t2v.json`
- **Purpose:** Generates full cinematic video and synchronized audio directly from multimodal prompts.
- **Key Nodes:** `MiniMaxH3ImageToVideo`, `PathchSageAttentionKJ`, `SpectrumApplyMiniMaxH3`, `SamplerCustomAdvanced`.
- **Inputs:** Prompt text, dimensions (e.g., `768x1344` or `1344x768`), duration/length frames, seed.
#### 2. Image-to-Video (I2V) — `workflow_api_minimaxh3_i2v.json`
- **Purpose:** Animates a starting image anchor into a continuous temporal sequence.
- **Key Nodes:** `LoadImage`, `MiniMaxH3ImageToVideo`, `VAEDecode`, `CreateVideo`.
- **Inputs:** Source image file, motion prompt, duration, resolution.
#### 3. Reference-to-Video (R2V) — `workflow_api_minimaxh3_r2v.json`
- **Purpose:** Full multi-modal conditioning incorporating reference images, reference audio files, and reference video clips simultaneously.
- **Key Nodes:** `MiniMaxH3ReferenceToVideo`, `VHS_LoadAudioUpload`, `VHS_LoadVideo`, `LoadImage`.
- **Inputs:** Reference audio track, reference face/character image, target prompt.
---
### Category 3: Narrative Continuity & Multi-Scene Chaining
#### 1. Clip-to-Video Continuation (C2V) — `workflow_api_minimaxh3_c2v.json`
- **Purpose:** Continues an existing video clip seamlessly into the next scene without cuts, preserving velocity, character positions, and lighting continuity.
- **Key Nodes:** `MiniMaxH3MotionContextLoadLatent`, `MiniMaxH3MotionContextTrim`, `MiniMaxH3MotionContextSaveLatent`.
- **Method:** Loads the previous scene's uncompressed latent cache, trims the tail motion context, and feeds it as the prior boundary for the new generation.
#### 2. Reference + Clip-to-Video (Ref-C2V) — `workflow_api_minimaxh3_ref_c2v.json`
- **Purpose:** Extends C2V continuous chaining while actively enforcing reference image / audio adapters across sequential scene transitions.
---
### Category 4: Interactive GUI Graph
- **`workflow_minimaxh3_refmod.json`:** Comprehensive visual graph for the ComfyUI web UI with interactive sliders for RefMod blend curves (`linear`, `constant`, `smoothstep`), weight retention, and real-time audio playback preview.
---
## 5. Programmatic API Python Client Example
Below is a complete, standalone Python snippet demonstrating how to queue any of these API workflows through the ComfyUI REST endpoint (`http://127.0.0.1:8188/prompt`):
```python
import json
import urllib.request
import os
import uuid
import time
COMFY_HOST = "127.0.0.1"
COMFY_PORT = 8188
def generate_minimax_video(
workflow_path="workflow_api_minimaxh3_fbc_refmod_turbo_8step.json",
refmod_name="minimaxh3_aneta_v1_refmod",
prompt_text=None,
width=1344,
height=768,
duration_sec=5.16,
fps=24,
seed=2026090595,
output_prefix="video/MiniMax_H3_API_Render"
):
with open(workflow_path, "r", encoding="utf-8") as f:
wf = json.load(f)
# Unwrap {"prompt": {...}} wrapper if present
prompt = wf.get("prompt", wf)
total_frames = int(duration_sec * fps) + 1
# Customize node inputs
for nid, node in prompt.items():
ctype = node.get("class_type")
# Prompt & Dimensions
if ctype in ["MiniMaxH3ImageToVideo", "MiniMaxH3ReferenceToVideo"]:
if prompt_text:
node["inputs"]["prompt"] = prompt_text
node["inputs"]["width"] = width
node["inputs"]["height"] = height
node["inputs"]["length"] = total_frames
# RefMod Loader
elif ctype == "MiniMaxH3RefModsLoader":
if refmod_name:
node["inputs"]["mod_1"] = refmod_name
node["inputs"]["strength_1"] = 1.0
# Random Seed
elif ctype == "RandomNoise":
node["inputs"]["noise_seed"] = seed
# Output filename prefix
elif ctype == "SaveVideo":
node["inputs"]["filename_prefix"] = output_prefix
# Submit to ComfyUI
payload = json.dumps({"prompt": prompt, "client_id": str(uuid.uuid4())}).encode("utf-8")
req = urllib.request.Request(
f"http://{COMFY_HOST}:{COMFY_PORT}/prompt",
data=payload,
headers={"Content-Type": "application/json"}
)
with urllib.request.urlopen(req) as resp:
res = json.loads(resp.read().decode("utf-8"))
prompt_id = res["prompt_id"]
print(f"Queued task successfully! Prompt ID: {prompt_id}")
# Poll execution progress
while True:
req = urllib.request.Request(f"http://{COMFY_HOST}:{COMFY_PORT}/history/{prompt_id}")
with urllib.request.urlopen(req) as resp:
history = json.loads(resp.read().decode("utf-8"))
if prompt_id in history:
status = history[prompt_id].get("status", {})
if status.get("completed") or status.get("status_str") == "success":
outputs = history[prompt_id].get("outputs", {})
for nid, nout in outputs.items():
for key in ["videos", "gifs", "images"]:
if key in nout:
for f in nout[key]:
print(f"Generation complete! Output file: {f.get('filename')}")
return f.get("filename")
elif status.get("status_str") == "error":
raise RuntimeError(f"ComfyUI Job Failed: {history[prompt_id]}")
time.sleep(3)
if __name__ == "__main__":
test_prompt = """subject_definitions:
<Subject 1> Aneta, authentic natural appearance
integrated_multimodal_description:
[Shot 1] Cinematic 35mm photograph, warm golden sunlight. Wide horizontal 16:9 framing showing <Subject 1> Aneta smiling warmly at the camera. Speaking English in Aneta's natural voice, <Subject 1> Aneta says: <d>Welcome to the new accelerated generation pipeline!</d>
overall_soundscape:
Gentle acoustic room ambience and clear vocal presence."""
generate_minimax_video(
workflow_path="workflow_api_minimaxh3_fbc_refmod_turbo_8step.json",
refmod_name="minimaxh3_aneta_v1_refmod",
prompt_text=test_prompt,
width=1344,
height=768
)
```
---
## 6. Standard Multimodal Prompt Architecture
MiniMax-H3 utilizes a structured prompt format parsed by Qwen3-VL:
```text
subject_definitions:
<Subject 1> CharacterName, key visual attributes, authentic natural appearance
integrated_multimodal_description:
[Shot 1] Live-action, 35mm cinematic photograph, fine film grain, natural lighting. Continuous unbroken take, no cut. Opens as a medium shot framing <Subject 1> CharacterName. The camera moves in a smooth, continuous push-in gliding directly into a sharp close-up on her face and natural expressive smile. Never freeze. Never hold static. Speaking English in CharacterName's natural voice, and only the quoted words are spoken, <Subject 1> CharacterName (S1) says: <d>Your exact synchronized dialogue text here.</d>
overall_soundscape:
Ambient acoustics, room tone, realistic environment foley, and clear vocal presence.
non_diegetic_music:
N/A (or describe background score style)
```
---
## 7. License & Credits
- **MiniMax-H3 RefMods & Workflows:** Created by **malcolmrey** ([huggingface.co/malcolmrey](https://huggingface.co/malcolmrey)).
- **Custom Nodes:** `ComfyUI-MiniMaxH3Mod` (Luisacaotica), `ComfyUI-MiniMaxH3-FirstBlockCache` (chengzeyi), `comfyui-kjnodes` (kijai).
- **LoRA Distillation:** `LightX2V / MiniMax-h3-Turbo`.