Skip to content

armgit / fuobe

Public Imported from GitHub
0

The open creative studio on ComfyUI: images, video, 3D and audio on open weights, on your own GPU or the cloud. Camera motions, effects, apps, Cinema, Layers, Image to 3D and an AI agent.

MiniMax H3: runs as FastH3 V2 or Trim on a smaller GPU, with a GPU tier option and Fast decode

Claude01f7ccc1aa6e
diff --git a/src/app/api/generations/route.ts b/src/app/api/generations/route.ts
index 5471e702..a313f51b 100644
--- a/src/app/api/generations/route.ts
+++ b/src/app/api/generations/route.ts
@@ -188,7 +188,7 @@ export async function POST(request: Request) {
return Response.json({ error: OWN_GPU_TOOL_MESSAGE, code: "own-gpu-tool" }, { status: 403 });
}
const skip = (body as { gpuCheck?: unknown } | null)?.gpuCheck === "skip";
- const gate = await gateGeneration(gpuTargetFor(request, "read"), { request: req, route: planned.route, op: planned.op, modelId: planned.model.id, gpu: planned.gpu, skip, actor: account?.id ?? "owner" });
+ const gate = await gateGeneration(gpuTargetFor(request, "read"), { request: req, route: planned.route, op: planned.op, modelId: planned.model.id, gpu: planned.gpu, h3: planned.h3, skip, actor: account?.id ?? "owner" });
if (!gate.ok) {
if (account) unhit(`run:${account.id}`);
return Response.json({ error: gate.message, code: "gpu-setup", ref: gate.ref, plan: gate.plan }, { status: 409, headers: { [GPU_SETUP_HEADER]: "1" } });
diff --git a/src/components/studio/composer.tsx b/src/components/studio/composer.tsx
index 1aa80581..38cabf49 100644
--- a/src/components/studio/composer.tsx
+++ b/src/components/studio/composer.tsx
@@ -81,6 +81,7 @@ import {
writesCaptions,
} from "@/lib/composer";
import { qwen21Note } from "@/lib/qwen21-speed";
+import { H3_TIER_PARAM, h3TierNote } from "@/lib/gpu/h3-tier";
import { formatCost } from "@/lib/format";
import { toastError } from "@/lib/refusals";
import { addKeyLabel, billedTo, CLOUD_KEY, needsKey, paidThrough, startingModel } from "@/lib/your-keys";
@@ -809,7 +810,9 @@ export function Composer({ docked }: { docked: boolean }) {
);
const effectiveOp = studioOp ?? op;
// Qwen-Image 2.1's Options → GPU on Small: what the small encoder can't do (or that a speed with its own graph wins).
- const smallGpuNote = qwen21Note(opts.controls, p.extra, effectiveOp);
+ // MiniMax H3's GPU tier: what FastH3 V2 or Trim changes, picked or as Auto runs it on the card the GPU check read.
+ const h3Note = opts.controls?.some((c) => c.param === H3_TIER_PARAM) ? h3TierNote(p.extra, effectiveOp, gpuBadges?.h3Tier) : undefined;
+ const smallGpuNote = qwen21Note(opts.controls, p.extra, effectiveOp) ?? h3Note;
// SDR to HDR, Export: every format the studio's models on this engine write; picking one this model doesn't
// write moves the request to the model that does (EXR frames → LTX 2.3 HDR on the cloud).
const engineModels = useMemo(() => models.filter((m) => m.engine === (model?.engine ?? engine)), [models, model?.engine, engine]);
diff --git a/src/lib/catalog/models.ts b/src/lib/catalog/models.ts
index b130108e..abb2f39e 100644
--- a/src/lib/catalog/models.ts
+++ b/src/lib/catalog/models.ts
@@ -3,6 +3,7 @@ import { DEFAULT_FPS_TARGET, FPS_TARGETS, SLOW_MOTION } from "@/lib/av/fps";
import { ASR_LANGUAGES, WHISPER_LANGUAGES } from "../speech-languages";
import { PROMPT_HELPER_PARAM } from "@/lib/comfy";
import { QWEN21_DECODER, QWEN21_GPU, QWEN21_SPEED } from "@/lib/qwen21-speed";
+import { H3_DECODER, H3_GPU_TIER } from "@/lib/gpu/h3-tier";
import { loraEntry, loraRef } from "./loras";
import { ANGLES_LORA, MOSAIC_SCALE, MOSAIC_TARGET, SPEAK_GRAPH, SPEAK_LORA, SPEAK_PROMPT } from "./open-tools";
import { CINEMA_CROP, SOUL_ASPECTS, SOUL_TIERS } from "./soul";
@@ -627,6 +628,9 @@ const open: ModelDef[] = [
default: "fast",
labels: { fast: "Fast · 8 steps", best: "Best · 20 steps, about 2.3x longer" },
},
+ // On a card under 32 GB the run picks FastH3 V2 or Trim by itself (src/server/h3-gpu.ts); this picks one on any card.
+ H3_GPU_TIER,
+ H3_DECODER,
],
},
defaults: { aspectRatio: "auto", duration: 5, resolution: "768p" },
@@ -666,6 +670,37 @@ const open: ModelDef[] = [
options: { multiShot: CONCAT_SHOTS, aspectRatios: VID_AR, durations: [3, 5, 7], resolutions: ["480p", "720p"], seed: true, negativePrompt: true, endFrame: true },
defaults: { aspectRatio: "16:9", duration: 5, resolution: "480p" },
}),
+ // MiniMax H3 on 8-31 GB cards (nm10-h3-any-gpu): FastVideo's FastH3 V2 and FastH3 Trim, which MiniMax H3's GPU tier picks
+ // (Auto on a smaller card, or asked for: src/server/h3-gpu.ts). Listed for their licence, their switch in Models & licences
+ // and the pre-flight's readiness; never in a picker. The speeds and the 8 GB figure are FastVideo's measurements.
+ o({
+ id: "oss-minimax-h3-fast",
+ name: "MiniMax H3 · FastH3 V2",
+ vendor: "FastVideo",
+ family: "minimax-h3",
+ kind: "video",
+ tagline: "MiniMax H3 in 8 steps on a 16 GB GPU, from words, a start frame, or start and end frames · MiniMax H3 Community License",
+ routes: [
+ comfy("t2v", "minimax-h3-fast-t2v", "FastH3 V2, 8 steps"),
+ comfy("i2v", "minimax-h3-fast-i2v", "FastH3 V2, 8 steps; the clip takes the start frame's shape"),
+ comfy("flf2v", "minimax-h3-fast-flf2v", "FastH3 V2, 8 steps; the clip takes the start frame's shape"),
+ ],
+ options: { aspectRatios: ["auto", "16:9", "9:16", "1:1", "4:3", "3:4"], durations: [3, 5, 10, 15], resolutions: ["768p"], seed: true, endFrame: true, audio: "always", promptFormat: "minimax-h3" },
+ defaults: { aspectRatio: "auto", duration: 5, resolution: "768p" },
+ hidden: true,
+ }),
+ o({
+ id: "oss-minimax-h3-trim",
+ name: "MiniMax H3 · FastH3 Trim",
+ vendor: "FastVideo",
+ family: "minimax-h3",
+ kind: "video",
+ tagline: "MiniMax H3 from words on an 8-12 GB GPU: experimental, below FastH3 V2 in quality · MiniMax H3 Community License",
+ routes: [comfy("t2v", "minimax-h3-trim-t2v", "FastH3 Trim, 8 steps, experimental")],
+ options: { aspectRatios: ["16:9", "9:16", "1:1", "4:3", "3:4"], durations: [3, 5, 10, 15], resolutions: ["768p"], seed: true, audio: "always", promptFormat: "minimax-h3" },
+ defaults: { aspectRatio: "16:9", duration: 5, resolution: "768p" },
+ hidden: true,
+ }),
o({
id: "oss-wan22-5b",
name: "Wan 2.2 5B",
diff --git a/src/lib/comfy-variants.ts b/src/lib/comfy-variants.ts
index 4d9fa402..6e558c7a 100644
--- a/src/lib/comfy-variants.ts
+++ b/src/lib/comfy-variants.ts
@@ -1,5 +1,6 @@
import { exrWorkflow } from "@/lib/av/video-finish";
import { qwen21Graph } from "@/lib/qwen21-speed";
+import { H3_TIER_PARAM, tierGraphFor } from "@/lib/gpu/h3-tier";
/**
* Which workflow a ComfyUI route runs for a request: the route's endpoint, or a variant picked by an option.
@@ -68,10 +69,14 @@ export function resolveWorkflowId(endpointTemplate: string, r: VariantRequest):
if (shot && r.extra.productShot === true && r.images === 1 && r.has(shot)) endpoint = shot;
// Qwen-Image 2.1: Options → Speed's graph, or the small encoder's when Options → GPU says Small (src/lib/qwen21-speed.ts).
endpoint = qwen21Graph(endpoint, r.extra, r.has);
- // MiniMax H3: an orbit runs the Orbit LoRA graph (whatever the quality), else Best runs the 20-step graph.
+ // MiniMax H3: an orbit runs the Orbit LoRA graph (whatever the quality or tier); else a smaller card's tier (FastH3 V2 or Trim,
+ // as the plan decided it: src/server/h3-gpu.ts), which wins over Best; else Best runs the 20-step graph.
const orbit = H3_ORBIT_GRAPH[endpoint];
const best = H3_BEST_GRAPH[endpoint];
+ const tier = r.extra[H3_TIER_PARAM];
+ const small = tier === "fast" || tier === "trim" ? tierGraphFor(endpoint, tier, r.has) : undefined;
if (orbit && r.extra.orbit === true && r.has(orbit)) endpoint = orbit;
+ else if (small) endpoint = small;
else if (best && r.extra.quality === "best" && r.has(best)) endpoint = best;
const bed = REUSE_BED_GRAPH[endpoint];
if (bed && r.extra.background === "keep" && r.has(bed)) endpoint = bed;
diff --git a/src/lib/gpu/h3-tier.ts b/src/lib/gpu/h3-tier.ts
index 387ffb13..10b7b491 100644
--- a/src/lib/gpu/h3-tier.ts
+++ b/src/lib/gpu/h3-tier.ts
@@ -1,4 +1,6 @@
import type { ModelOptions } from "@/lib/catalog/types";
+import { gpuVramGb } from "./readiness";
+import type { FileKey, GpuInventory, RequirementIndex } from "./types";
/**
* MiniMax H3 on 8-31 GB graphics cards (research #10 §6.4, package nm10-h3-any-gpu). Pure: which H3 build a GPU runs, from
@@ -61,6 +63,9 @@ export interface H3TierChoice {
reason?: string;
}
+/** The hidden models whose switch, licence and pre-flight row each smaller build has (src/lib/catalog/models.ts). */
+export const H3_TIER_MODEL: Record<Exclude<H3Tier, "standard">, string> = { fast: "oss-minimax-h3-fast", trim: "oss-minimax-h3-trim" };
+
/** Options → GPU tier's param (params.extra). Unset is Auto. */
export const H3_TIER_PARAM = "gpuTier";
@@ -187,16 +192,6 @@ export function tierGraphFor(endpoint: string, tier: H3Tier | undefined, has: (i
return g && has(g) ? g : undefined;
}
-/**
- * The graph a MiniMax H3 run takes for its tier (params.extra.gpuTier as the plan decided it: src/server/h3-gpu.ts). An orbit
- * keeps the Orbit LoRA graph (Standard only); a smaller tier wins over Quality's Best (Best's 20 steps load the full model).
- */
-export function h3TierGraph(endpoint: string, extra: Record<string, unknown>, has: (id: string) => boolean): string {
- if (extra.orbit === true) return endpoint;
- const tier = extra[H3_TIER_PARAM];
- return tierGraphFor(endpoint, tier === "fast" || tier === "trim" ? tier : undefined, has) ?? endpoint;
-}
-
/** What a smaller tier changes, as the run's notes and the composer say it. */
export const TIER_NOTES: Record<Exclude<H3Tier, "standard">, string> = {
fast: "FastH3 V2: an 8-step build of MiniMax H3 for 16-31 GB GPUs. A start frame is followed less closely than on the full model",
@@ -219,9 +214,108 @@ export const H3_GPU_TIER: NonNullable<ModelOptions["controls"]>[number] = {
ops: { standard: ["t2v", "i2v", "flf2v"], fast: ["t2v", "i2v", "flf2v"], trim: ["t2v"] },
};
-/** The composer's note under MiniMax H3's options when a smaller tier is picked for an operation that has it. */
-export function h3TierNote(extra: Record<string, unknown> | undefined, op: string | undefined): string | undefined {
- const tier = extra?.[H3_TIER_PARAM];
+/** Sol-H3-VAE as Comfy-Org repacked it (int8 ConvRot, 1.99 GB): the full graphs' optional decoder. */
+export const SOL_VAE = "minimax_h3_sol_vae_int8_convrot.safetensors";
+
+/**
+ * Options → Decoder: Fast decode swaps in Sol-H3-VAE, NVIDIA's 24-layer whole-clip decoder distilled from H3's (its card: a 5 s
+ * 768p clip decodes in 5.0 s instead of 12.5 s on an RTX 5090). Off by default; the full model only (it needs ComfyUI from
+ * 2026-10-28 on, and its memory grows with the clip).
+ */
+export const H3_DECODER: NonNullable<ModelOptions["controls"]>[number] = {
+ param: "decoder",
+ label: "Decoder",
+ values: ["standard", "fast"],
+ default: "standard",
+ labels: { standard: "Standard", fast: "Fast decode · 32 GB GPU" },
+ sets: { standard: {}, fast: { vae: SOL_VAE } },
+};
+
+/** Fast decode picked with a smaller tier: the FastH3 graphs keep the standard decoder. */
+export const TIER_DECODER_NOTE = "Fast decode needs a 32 GB GPU: this run uses the standard decoder";
+
+/** What Auto runs on the card the GPU check read, as the composer says it (no file formats: visitors read it). */
+export const AUTO_TIER_NOTES: Record<Exclude<H3Tier, "standard">, string> = {
+ fast: "On your GPU this runs as FastH3 V2, an 8-step build for 16-31 GB cards. A start frame is followed less closely than on the full model",
+ trim: "On your GPU this runs as FastH3 Trim, an experimental 8-step build for smaller cards: text to video only",
+};
+
+/**
+ * The composer's note under MiniMax H3's options: what a smaller tier changes when one is picked for an operation that has it,
+ * else (Auto) what the card the GPU check read runs (`auto`: BadgeMap.h3Tier).
+ */
+export function h3TierNote(extra: Record<string, unknown> | undefined, op: string | undefined, auto?: "fast" | "trim"): string | undefined {
+ const picked = extra?.[H3_TIER_PARAM];
+ if (picked === undefined && auto && op && H3_GPU_TIER.ops?.[auto]?.includes(op)) {
+ return [AUTO_TIER_NOTES[auto], ...(extra?.quality === "best" ? [TIER_BEST_NOTE] : []), ...(extra?.decoder === "fast" ? [TIER_DECODER_NOTE] : [])].join(". ");
+ }
+ const tier = picked;
if ((tier !== "fast" && tier !== "trim") || !op || !H3_GPU_TIER.ops?.[tier]?.includes(op)) return undefined;
- return extra?.quality === "best" ? `${TIER_NOTES[tier]}. ${TIER_BEST_NOTE}` : TIER_NOTES[tier];
+ return [TIER_NOTES[tier], ...(extra?.quality === "best" ? [TIER_BEST_NOTE] : []), ...(extra?.decoder === "fast" ? [TIER_DECODER_NOTE] : [])].join(". ");
+}
+
+// ---------------------------------------------------------------------------
+// The GPU pre-flight: the graph and file a card runs
+
+/** What a GPU check read about its first card, as the chooser takes it. */
+export function deviceOf(inv: GpuInventory | undefined): H3Device {
+ const d = inv?.devices[0];
+ return { vramGb: inv ? gpuVramGb(inv) : undefined, name: d?.name, type: d?.type, torch: inv?.comfy?.torch };
+}
+
+/**
+ * The index with a FastH3 graph needing `unet` in place of its default diffusion file (the card's NVFP4 or fp8 build), so the
+ * pre-flight checks and downloads the file the run loads. Unchanged when the file isn't one of the graph's optional files.
+ */
+export function withTierFile(idx: RequirementIndex, graph: string, unet: string | undefined): RequirementIndex {
+ const w = idx.workflows[graph];
+ const key: FileKey = `diffusion_models/${unet}`;
+ if (!w || !unet || !w.optional.includes(key) || w.files.includes(key)) return idx;
+ const files = [...w.files.filter((f) => !/^diffusion_models\/fastvideo_fasth3_/.test(f)), key].sort();
+ return { ...idx, workflows: { ...idx.workflows, [graph]: { ...w, files, optional: w.optional.filter((f) => f !== key) } } };
+}
+
+/**
+ * A tool's graphs on this card: each Standard H3 graph that has a graph for the card's tier runs that one, with the card's file.
+ * `studio`: a studio row drops the H3 graphs the tier has none for (Trim's start-frame modes), so the row shows what the card
+ * can run; a single model operation keeps them (it then needs a bigger GPU). `allowed`: the tier's switch in Models & licences.
+ */
+export function tierOnCard(
+ workflows: string[],
+ inv: GpuInventory,
+ idx: RequirementIndex,
+ opts: { studio?: boolean; allowed?: (tier: Exclude<H3Tier, "standard">) => boolean } = {},
+): { workflows: string[]; idx: RequirementIndex; choice?: H3TierChoice } {
+ if (!workflows.some((w) => H3_TIER_GRAPH[w])) return { workflows, idx };
+ const choice = chooseH3Tier(deviceOf(inv));
+ if (choice.tier === "standard") return { workflows, idx, choice };
+ if (opts.allowed && !opts.allowed(choice.tier)) return { workflows, idx };
+ let out = idx;
+ const graphs: string[] = [];
+ for (const w of workflows) {
+ const g = H3_TIER_GRAPH[w] ? tierGraphFor(w, choice.tier, (id) => !!idx.workflows[id]) : undefined;
+ if (g) {
+ out = withTierFile(out, g, choice.unet);
+ graphs.push(g);
+ } else if (!(opts.studio && H3_TIER_GRAPH[w])) graphs.push(w);
+ }
+ return graphs.length ? { workflows: [...new Set(graphs)], idx: out, choice } : { workflows, idx };
+}
+
+/** MiniMax H3's reference graphs (Character swap, the person remover on H3 Relay): no smaller build of H3 Ref2VA exists yet. */
+export const REF2VA_H3 = /^video-(character-swap-h3|person-remove-h3)/;
+
+/** What the pre-flight board says next to a row (src/server/gpu/readiness-service.ts): the build this card runs, or why none. */
+export function tierRowNote(workflows: string[], choice: H3TierChoice | undefined, inv: GpuInventory): { label: string; note?: string } | undefined {
+ if (choice && choice.tier !== "standard") {
+ const textOnly = choice.tier === "trim" ? "text to video only" : undefined;
+ const offload = choice.offload ? "part of it waits in system memory" : undefined;
+ const note = [textOnly, offload].filter(Boolean).join("; ");
+ return { label: choice.label, ...(note && { note: note[0].toUpperCase() + note.slice(1) }) };
+ }
+ const gb = gpuVramGb(inv);
+ if (typeof gb === "number" && gb < H3_STANDARD_GB && workflows.some((w) => REF2VA_H3.test(w))) {
+ return { label: "Standard", note: "Needs the full MiniMax H3 (32 GB): there's no smaller build for swaps and removals yet" };
+ }
+ return undefined;
}
diff --git a/src/lib/gpu/types.ts b/src/lib/gpu/types.ts
index b29fdbf9..6d5eff8c 100644
--- a/src/lib/gpu/types.ts
+++ b/src/lib/gpu/types.ts
@@ -242,6 +242,8 @@ export interface StudioRow {
tool: ToolReadiness;
/** That studio's other open models that are ready or one step away. */
others: { ref: ToolRef; name: string; state: Readiness }[];
+ /** MiniMax H3's build on this card (FastH3 V2 or Trim, src/lib/gpu/h3-tier.ts), or why the full model is still needed. */
+ gpuTier?: { label: string; note?: string };
}
export interface ReadinessReport {
@@ -263,6 +265,8 @@ export interface BadgeMap {
checkedAt?: number;
gpu?: string;
vramGb?: number;
+ /** MiniMax H3's smaller build this card runs on Auto ("fast" | "trim"; src/lib/gpu/h3-tier.ts), when the card is under 32 GB. */
+ h3Tier?: "fast" | "trim";
/** "<modelId>#<op>" → badge, for open models. A missing key means no chip. */
models: Record<string, Badge>;
presets: Record<string, Badge>;
diff --git a/src/server/generations.ts b/src/server/generations.ts
index f8c0ffc4..2ea491db 100644
--- a/src/server/generations.ts
+++ b/src/server/generations.ts
@@ -51,6 +51,8 @@ import { listElements } from "./elements";
import { markStale } from "./gpu/snapshots";
import { loadIndex } from "./gpu/index-file";
import { qwen21Gpu } from "./qwen21-gpu";
+import { h3Gpu } from "./h3-gpu";
+import { H3_TIER_PARAM, H3_UNET_PARAM } from "@/lib/gpu/h3-tier";
import { DETAILS_MAX_IMAGES, GPU_PARAM, QWEN21_SPEED, speedLora } from "@/lib/qwen21-speed";
import { BLOCKED_CARD_MESSAGE, looksBlocked } from "./safety-card";
import { pollTrainings } from "./training";
@@ -752,6 +754,15 @@ function prepare(original: GenerationRequest) {
// Qwen-Image 2.1's Options → GPU, decided once here (src/server/qwen21-gpu.ts): the pre-flight and the run read the choice.
const gpu = route.provider === "comfyui" && !demo ? qwen21Gpu(route.endpoint, plan.params.extra ?? {}, (id) => !!loadIndex().workflows[id]) : undefined;
if (gpu) plan = { ...plan, params: { ...plan.params, extra: { ...plan.params.extra, [GPU_PARAM]: gpu.gpu } }, notes: [...(plan.notes ?? []), ...(gpu.note ? [gpu.note] : [])] };
+ // MiniMax H3's Options → GPU tier, decided once here too (src/server/h3-gpu.ts): FastH3 V2 or Trim on a smaller card, with its file.
+ const h3 = route.provider === "comfyui" && !demo ? h3Gpu(route.endpoint, plan.params.extra ?? {}, (id) => !!loadIndex().workflows[id]) : undefined;
+ if (h3) {
+ // The file is the plan's alone (never one a request names).
+ const extra: Record<string, unknown> = { ...plan.params.extra, [H3_TIER_PARAM]: h3.gpuTier };
+ if (h3.unet) extra[H3_UNET_PARAM] = h3.unet;
+ else delete extra[H3_UNET_PARAM];
+ plan = { ...plan, params: { ...plan.params, extra }, notes: [...(plan.notes ?? []), ...(h3.note ? [h3.note] : [])] };
+ }
// What the cloud run can carry: a LoRA whose licence doesn't allow hosting stays on the GPU, and an API
// takes at most so many (the plan's notes say which were left out). Open runs carry them all. Without a
// civitai key a look's civitai LoRA the run can't get is left out (and said), rather than failing at the
@@ -806,7 +817,7 @@ function prepare(original: GenerationRequest) {
const unreachable = asked.filter((l) => !reachable.loras.includes(l));
// Priced for the clip the route makes: Replicate's Wan 2.2 fast makes 5 s when 3 s was asked.
const priced = made !== undefined && plan.params.duration !== undefined ? { ...plan.params, duration: Math.round(made * 2) / 2 } : plan.params;
- return { req, plan, route, demo, providerId, notes, asked, unreachable, switchedOff: access.dropped, gpu: gpu?.gpu, cost: free ? 0 : estimateCost(plan.model, priced, 1, plan.op, withLoras) };
+ return { req, plan, route, demo, providerId, notes, asked, unreachable, switchedOff: access.dropped, gpu: gpu?.gpu, h3: h3 && { gpuTier: h3.gpuTier, ...(h3.unet && { unet: h3.unet }) }, cost: free ? 0 : estimateCost(plan.model, priced, 1, plan.op, withLoras) };
}
/** The LoRA files a graph loads itself (not injected), so a run downloads the ones ComfyUI lacks before it starts. */
@@ -820,7 +831,7 @@ const MADE_LENGTH_OPS = new Set<Operation>(["t2v", "i2v", "flf2v", "ref2v", "ext
export function previewGeneration(asked: GenerationRequest) {
const moved = currentRequest(asked);
const prepared = prepare(moved.request);
- const { plan, route, demo, providerId, cost, asked: askedLoras, unreachable, switchedOff, gpu } = prepared;
+ const { plan, route, demo, providerId, cost, asked: askedLoras, unreachable, switchedOff, gpu, h3 } = prepared;
const notes = moved.note ? [moved.note, ...prepared.notes] : prepared.notes;
const fitted = routeLoras(route, askedLoras.filter((l) => !unreachable.includes(l)));
const loras = {
@@ -846,6 +857,8 @@ export function previewGeneration(asked: GenerationRequest) {
...(notes.length && { notes }),
// Qwen-Image 2.1's Options → GPU as decided for this run: the GPU pre-flight checks the graph it picks.
...(gpu && { gpu }),
+ // MiniMax H3's GPU tier and the card's file as decided for this run: the GPU pre-flight checks the graph and file it picks.
+ ...(h3 && { h3 }),
plan: { end: plan.end },
};
}
diff --git a/src/server/gpu/gate.ts b/src/server/gpu/gate.ts
index 80cdf5ce..7d9609c4 100644
--- a/src/server/gpu/gate.ts
+++ b/src/server/gpu/gate.ts
@@ -3,8 +3,9 @@ import crypto from "node:crypto";
import { resolveWorkflowId } from "@/lib/comfy-variants";
import { fixPlan } from "@/lib/gpu/plan";
import { CLEAN_VAE, DECODER_PARAM, GPU_PARAM } from "@/lib/qwen21-speed";
+import { H3_TIER_PARAM, H3_UNET_PARAM, withTierFile } from "@/lib/gpu/h3-tier";
import { deviceLabel, needTargets, toolReadiness } from "@/lib/gpu/readiness";
-import type { FixPlan, ToolReadiness, ToolRef } from "@/lib/gpu/types";
+import type { FileKey, FixPlan, ToolReadiness, ToolRef } from "@/lib/gpu/types";
import type { GenerationRequest } from "@/lib/catalog/types";
import { authEnabled, crossSite, hostAllowed, validToken } from "../auth";
import { loadIndex, preflightOn } from "./index-file";
@@ -29,6 +30,8 @@ export interface GateInput {
modelId: string;
/** Qwen-Image 2.1's Options → GPU as the run's plan decided it (previewGeneration's gpu): the graph checked is the one it runs. */
gpu?: string;
+ /** MiniMax H3's tier and the card's file as the run's plan decided them (previewGeneration's h3): the graph and file checked are the ones it runs. */
+ h3?: { gpuTier: string; unet?: string };
skip?: boolean;
actor: string;
}
@@ -45,7 +48,11 @@ export async function gateGeneration(t: GpuTarget, g: GateInput): Promise<GateRe
let idx = loadIndex();
const req = g.request;
const has = (id: string) => !!idx.workflows[id];
- const extra: Record<string, unknown> = { ...req.params?.extra, ...(g.gpu && { [GPU_PARAM]: g.gpu }) };
+ const extra: Record<string, unknown> = {
+ ...req.params?.extra,
+ ...(g.gpu && { [GPU_PARAM]: g.gpu }),
+ ...(g.h3 && { [H3_TIER_PARAM]: g.h3.gpuTier, ...(g.h3.unet && { [H3_UNET_PARAM]: g.h3.unet }) }),
+ };
const id = resolveWorkflowId(g.route.endpoint, {
op: g.op,
clips: req.inputs?.videos?.length ?? 0,
@@ -56,11 +63,16 @@ export async function gateGeneration(t: GpuTarget, g: GateInput): Promise<GateRe
has,
});
if (!has(id)) return { ok: true };
- // Qwen-Image 2.1's Options → Decoder "Clean" loads the Texture-Fix VAE, an optional file of the graph: this run needs it.
- const vae = `vae/${CLEAN_VAE}`;
- if ((extra[DECODER_PARAM] === "clean" || extra.vae === CLEAN_VAE) && idx.files[vae] && !idx.workflows[id].files.includes(vae)) {
+ // A decoder an option picks (Qwen-Image 2.1's "Clean" Texture-Fix VAE, MiniMax H3's Fast decode) is an optional file of the
+ // graph: this run needs it.
+ const picked = extra[DECODER_PARAM] === "clean" ? CLEAN_VAE : extra.vae;
+ const vae: FileKey | undefined = typeof picked === "string" ? `vae/${picked}` : undefined;
+ if (vae && idx.files[vae] && idx.workflows[id].optional.includes(vae) && !idx.workflows[id].files.includes(vae)) {
idx = { ...idx, workflows: { ...idx.workflows, [id]: { ...idx.workflows[id], files: [...idx.workflows[id].files, vae] } } };
}
+ // MiniMax H3's FastH3 graphs load the card's own file (NVFP4 on Blackwell, fp8 without CUDA 13): that file is needed instead.
+ const unet = extra[H3_UNET_PARAM];
+ idx = withTierFile(idx, id, typeof unet === "string" ? unet : undefined);
// The preset's route on the run's model (the one its preview was made with, or its own): its LoRAs are checked too.
const preset = req.presetId ? presetTool(req.presetId, { modelId: g.modelId }) : null;
const model = modelTool(g.modelId, g.op);
diff --git a/src/server/gpu/readiness-service.ts b/src/server/gpu/readiness-service.ts
index 0bf45835..09b8d20f 100644
--- a/src/server/gpu/readiness-service.ts
+++ b/src/server/gpu/readiness-service.ts
@@ -5,6 +5,8 @@ import { fixPlan } from "@/lib/gpu/plan";
import { badgeOf, deviceLabel, needTargets, rankOf, shortGpu, summaryOf, toolReadiness, type ReadinessContext } from "@/lib/gpu/readiness";
import type { BadgeMap, FixPlan, GpuInventory, GpuProblem, ReadinessReport, RequirementIndex, StudioRow, ToolReadiness, ToolRef } from "@/lib/gpu/types";
import { vramGb } from "@/lib/gpu/requirements";
+import { chooseH3Tier, deviceOf, tierOnCard, tierRowNote, H3_TIER_MODEL } from "@/lib/gpu/h3-tier";
+import { isOffered } from "../model-access";
import { getSetting } from "../settings";
import { loadIndex } from "./index-file";
import { probe, readSnapshot, saveViews, checkWait, type Snapshot } from "./snapshots";
@@ -21,11 +23,20 @@ export function contextFor(t: ReadTarget): ReadinessContext {
return { account: t.kind === "account" || (t.kind === "computer" && t.key !== "install"), computer: t.kind === "computer", isolatedUrl: t.kind === "install" && !!getSetting("comfyIsolatedUrl") };
}
+/**
+ * MiniMax H3's graphs as this card runs them (src/lib/gpu/h3-tier.ts): FastH3 V2 or Trim, with the card's file, when the card is
+ * under 32 GB and that build is switched on in Models & licences. A studio row keeps only the modes the build has.
+ */
+export function onCard(tool: Tool, inv: GpuInventory, idx: RequirementIndex) {
+ return tierOnCard(tool.workflows, inv, idx, { studio: tool.ref.startsWith("studio:"), allowed: (tier) => isOffered(H3_TIER_MODEL[tier], "open") });
+}
+
export function readinessOf(tool: Tool, inv: GpuInventory, idx: RequirementIndex, ctx: ReadinessContext): ToolReadiness {
if (tool.local) {
return { ref: tool.ref, name: tool.name, state: inv.reachable ? "ready" : "unknown", needs: [], have: [], downloadBytes: 0, vram: { needGb: 0, fit: "any" }, firstRun: [], unvalidated: false, unobservable: [] };
}
- return toolReadiness(tool.ref, tool.name, tool.workflows, tool.loras, inv, idx, { ...ctx, kind: tool.kind }, tool.cloud);
+ const card = inv.reachable ? onCard(tool, inv, idx) : { workflows: tool.workflows, idx };
+ return toolReadiness(tool.ref, tool.name, card.workflows, tool.loras, inv, card.idx, { ...ctx, kind: tool.kind }, tool.cloud);
}
interface Views {
@@ -44,12 +55,15 @@ export function buildViews(inv: GpuInventory, idx: RequirementIndex, ctx: Readin
.filter((o) => o.state === "ready" || o.state === "almost")
.sort((a, b) => rankOf(b.state) - rankOf(a.state))
.slice(0, 4);
- studios.push({ href: row.href, label: row.label, group: row.group, tool: { ...t, needs: t.needs.slice(0, 12), have: [] }, others });
+ const tier = tierRowNote(tool.workflows, onCard(tool, inv, idx).choice, inv);
+ studios.push({ href: row.href, label: row.label, group: row.group, tool: { ...t, needs: t.needs.slice(0, 12), have: [] }, others, ...(tier && { gpuTier: tier }) });
}
const badges: BadgeMap = { connected: true, checkedAt: inv.checkedAt, models: {}, presets: {} };
const summary = summaryOf(inv, idx);
if (summary.gpu) badges.gpu = shortGpu(summary.gpu);
if (summary.vramGb) badges.vramGb = summary.vramGb;
+ const h3 = chooseH3Tier(deviceOf(inv)).tier;
+ if (h3 !== "standard" && isOffered(H3_TIER_MODEL[h3], "open")) badges.h3Tier = h3;
for (const tool of openModelTools()) {
const b = badgeOf(readinessOf(tool, inv, idx, ctx));
if (b) badges.models[tool.ref.slice("model:".length)] = b;
diff --git a/src/server/h3-gpu.ts b/src/server/h3-gpu.ts
new file mode 100644
index 00000000..3768047e
--- /dev/null
+++ b/src/server/h3-gpu.ts
@@ -0,0 +1,61 @@
+import "server-only";
+import { deviceOf, H3_TIER_GRAPH, H3_TIER_MODEL, h3TierFor, H3_TIER_PARAM, TIER_BEST_NOTE, TIER_DECODER_NOTE, TIER_NOTES, tierGraphFor, SOL_VAE, type H3TierChoice } from "@/lib/gpu/h3-tier";
+import { getModel } from "@/lib/catalog";
+import { preflightOn } from "./gpu/index-file";
+import { readSnapshot } from "./gpu/snapshots";
+import { runTarget } from "./gpu/target";
+import { isOffered, offReason } from "./model-access";
+import { tenantAccount } from "./tenant";
+
+/**
+ * MiniMax H3's Options → GPU tier for one run (src/lib/gpu/h3-tier.ts), decided once while the run is planned: the GPU
+ * pre-flight's gate and the provider then read the same tier and file from the run's options, so both take the same graph.
+ *
+ * - A tier asked for: that tier, with the file the card's last check calls for (refused, naming the switch, when Settings →
+ * Models & licences has it off). Trim asked for on a start-frame mode keeps the full model (Trim has text to video only).
+ * - Auto: the tier the last GPU check's card gets (FastH3 V2 on 16-31 GB, Trim on 12-15 GB or 8-15 GB on Blackwell), when its
+ * switch is on; a CPU, no reading, an unknown card, 32 GB or more, or a card no build fits keep the full model, which the
+ * pre-flight then judges as it does today. Auto routes to a smaller build before its files are there: they are pinned and
+ * the pre-flight offers them, where the full model could never run on that card.
+ * - An orbit keeps the Orbit LoRA graph (full model only).
+ */
+
+export interface H3GpuChoice {
+ /** The tier the run carries (params.extra.gpuTier). */
+ gpuTier: H3TierChoice["tier"];
+ /** The diffusion file a FastH3 graph loads on this card (params.extra.unet). */
+ unet?: string;
+ /** What the run says about it (FastH3's limits). */
+ note?: string;
+}
+
+/** The last GPU check's card for a run in the current scope, when the pre-flight has one. */
+function lastCard() {
+ if (!preflightOn()) return undefined;
+ const t = runTarget();
+ const snap = t ? readSnapshot(t) : null;
+ return snap?.inventory.reachable ? snap.inventory : undefined;
+}
+
+/**
+ * Options → GPU tier for a MiniMax H3 run on `endpoint` (the route's graph before variants), or undefined when the run takes no
+ * tier either way (another model, an orbit, a graph with no smaller build). `has`: is a graph in the library.
+ */
+export function h3Gpu(endpoint: string, extra: Record<string, unknown>, has: (id: string) => boolean): H3GpuChoice | undefined {
+ if (!H3_TIER_GRAPH[endpoint] || extra.orbit === true) return undefined;
+ const asked = extra[H3_TIER_PARAM];
+ const inv = lastCard();
+ const choice = h3TierFor(asked, deviceOf(inv));
+ if (choice.tier === "standard") return { gpuTier: "standard" };
+ const graph = tierGraphFor(endpoint, choice.tier, has);
+ // Trim on a start-frame mode: the tier has no graph for it, so the full model runs.
+ if (!graph) return { gpuTier: "standard" };
+ const model = H3_TIER_MODEL[choice.tier];
+ if (!isOffered(model, "open")) {
+ if (asked !== choice.tier) return { gpuTier: "standard" };
+ throw new Error(tenantAccount() ? `${choice.label.replace(/ \(.*\)$/, "")} isn't available here. Pick 32 GB or more` : offReason(getModel(model)!));
+ }
+ // (Options → Decoder has become the file it loads by now: controlSets in src/lib/catalog/plan.ts.)
+ const notes = [TIER_NOTES[choice.tier], ...(extra.quality === "best" ? [TIER_BEST_NOTE] : []), ...(extra.vae === SOL_VAE ? [TIER_DECODER_NOTE] : [])];
+ return { gpuTier: choice.tier, unet: choice.unet, note: notes.join(". ") };
+}
diff --git a/tests/h3-tier.test.ts b/tests/h3-tier.test.ts
index aee6cd6b..4f640ffa 100644
--- a/tests/h3-tier.test.ts
+++ b/tests/h3-tier.test.ts
@@ -6,7 +6,6 @@ import {
cuda13,
gpuArch,
h3TierFor,
- h3TierGraph,
h3TierNote,
tierChoice,
tierGraphFor,
@@ -154,17 +153,15 @@ describe("the graph each tier runs", () => {
expect(tierOfGraph("minimax-h3-t2v")).toBeUndefined();
});
- it("an orbit keeps its Orbit LoRA graph; a smaller tier wins over Best", () => {
- expect(h3TierGraph("minimax-h3-i2v", { gpuTier: "fast", orbit: true }, all)).toBe("minimax-h3-i2v");
- expect(h3TierGraph("minimax-h3-t2v", { gpuTier: "trim", quality: "best" }, all)).toBe("minimax-h3-trim-t2v");
- expect(h3TierGraph("minimax-h3-t2v", { gpuTier: "standard" }, all)).toBe("minimax-h3-t2v");
- expect(h3TierGraph("minimax-h3-t2v", {}, all)).toBe("minimax-h3-t2v");
- });
-
it("the composer's note says what a smaller tier changes", () => {
expect(h3TierNote({ gpuTier: "trim" }, "t2v")).toMatch(/experimental/);
expect(h3TierNote({ gpuTier: "trim" }, "i2v")).toBeUndefined();
expect(h3TierNote({ gpuTier: "fast", quality: "best" }, "i2v")).toMatch(/Best needs a 32 GB GPU/);
expect(h3TierNote({}, "t2v")).toBeUndefined();
+ expect(h3TierNote({ gpuTier: "trim", decoder: "fast" }, "t2v")).toMatch(/Fast decode needs a 32 GB GPU/);
+ // Auto: what the card the GPU check read runs, in plain words.
+ expect(h3TierNote({}, "i2v", "fast")).toMatch(/^On your GPU this runs as FastH3 V2/);
+ expect(h3TierNote({}, "i2v", "trim")).toBeUndefined();
+ expect(h3TierNote({ gpuTier: "standard" }, "t2v", "trim")).toBeUndefined();
});
});
diff --git a/tests/open-engine.test.ts b/tests/open-engine.test.ts
index 97a5ed5b..f9d44b56 100644
--- a/tests/open-engine.test.ts
+++ b/tests/open-engine.test.ts
@@ -10,6 +10,7 @@ import { resample, tracksFor } from "@/lib/motion-paths";
import { ANGLES_FIELDS, ANGLES_ORIGINAL } from "@/lib/catalog/open-tools";
import { H3_BEST_GRAPH } from "@/lib/comfy-variants";
import { QWEN21_SPEED_GRAPH } from "@/lib/qwen21-speed";
+import { H3_TIER_GRAPH } from "@/lib/gpu/h3-tier";
describe("motion paths (Wan-Move draw to video)", () => {
it("resamples a path to evenly spaced points, one per frame", () => {
@@ -138,6 +139,8 @@ describe("round-3 open models", () => {
if (p === "quality" && H3_BEST_GRAPH[wid]) continue;
// Qwen-Image 2.1's Speed and GPU pick the graph that runs too (src/lib/qwen21-speed.ts).
if ((p === "speed" || p === "gpu") && QWEN21_SPEED_GRAPH[wid]) continue;
+ // MiniMax H3's GPU tier picks the FastH3 graph that runs (src/lib/gpu/h3-tier.ts).
+ if (p === "gpuTier" && H3_TIER_GRAPH[wid]) continue;
if (!PROVIDER_PARAMS.has(p) && p !== "cameraMotion" && !(m.id === ANGLES_ORIGINAL && (ANGLES_FIELDS as readonly string[]).includes(p))) expect(keys, `${m.id} → ${wid}: ${p}`).toContain(p);
}
}
diff --git a/tests/open-minimax-h3.test.ts b/tests/open-minimax-h3.test.ts
index 39b64526..18df9d30 100644
--- a/tests/open-minimax-h3.test.ts
+++ b/tests/open-minimax-h3.test.ts
@@ -4,6 +4,7 @@ import path from "node:path";
import { afterAll, beforeAll, describe, expect, it } from "vitest";
import type { GenInput, ModelDef } from "@/lib/catalog/types";
import type { Manifest } from "@/lib/comfy";
+import { H3_DECODER, H3_GPU_TIER } from "@/lib/gpu/h3-tier";
// MiniMax H3 as an open video model (text, image and start + end frame to video with sound), the Video studio's first
// model on both engines, the hosted H3's prices, and the studio defaults that changed with it.
@@ -77,6 +78,9 @@ describe("MiniMax H3 on your GPU: the catalog entry", () => {
});
expect(h3.options.controls).toEqual([
{ param: "quality", label: "Quality", values: ["fast", "best"], default: "fast", labels: { fast: "Fast · 8 steps", best: "Best · 20 steps, about 2.3x longer" } },
+ // nm10-h3-any-gpu: the GPU tier (FastH3 V2 / Trim on smaller cards) and Fast decode (tests/h3-any-gpu.test.ts).
+ H3_GPU_TIER,
+ H3_DECODER,
]);
expect(h3.options.negativePrompt).toBeUndefined();
expect(h3.options.multiShot).toBeUndefined();