Skip to content

The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.

feat: add LTX Video support, fix FLUX 2 latent node, 48 tests passing

PurpleDoubleDa7960959973e
diff --git a/src/api/__tests__/model-pipeline.test.ts b/src/api/__tests__/model-pipeline.test.ts
index 85e6983a..d5685c9e 100644
--- a/src/api/__tests__/model-pipeline.test.ts
+++ b/src/api/__tests__/model-pipeline.test.ts
@@ -48,6 +48,11 @@ describe('classifyModel', () => {
// HunyuanVideo
['hunyuanvideo1.5_480p_t2v_fp8.safetensors', 'hunyuan'],
['hunyuanvideo_t2v.safetensors', 'hunyuan'],
+
+ // LTX Video
+ ['ltx-2.3-22b-distilled-fp8.safetensors', 'ltx'],
+ ['ltxv_0.9.7_13b_dev_fp8.safetensors', 'ltx'],
+ ['LTX-Video-model.safetensors', 'ltx'],
]
for (const [filename, expected] of cases) {
@@ -77,7 +82,7 @@ describe('classifyModel', () => {
describe('MODEL_TYPE_DEFAULTS', () => {
it('every ModelType has defaults', () => {
- const allTypes: ModelType[] = ['sd15', 'sdxl', 'flux', 'flux2', 'wan', 'hunyuan', 'unknown']
+ const allTypes: ModelType[] = ['sd15', 'sdxl', 'flux', 'flux2', 'wan', 'hunyuan', 'ltx', 'unknown']
for (const type of allTypes) {
const defaults = MODEL_TYPE_DEFAULTS[type]
expect(defaults, `missing defaults for ${type}`).toBeDefined()
@@ -110,6 +115,8 @@ describe('MODEL_TYPE_DEFAULTS', () => {
expect(MODEL_TYPE_DEFAULTS.wan.fps).toBeGreaterThan(0)
expect(MODEL_TYPE_DEFAULTS.hunyuan.frames).toBeGreaterThan(0)
expect(MODEL_TYPE_DEFAULTS.hunyuan.fps).toBeGreaterThan(0)
+ expect(MODEL_TYPE_DEFAULTS.ltx.frames).toBeGreaterThan(0)
+ expect(MODEL_TYPE_DEFAULTS.ltx.fps).toBeGreaterThan(0)
})
})
@@ -123,7 +130,7 @@ describe('COMPONENT_REGISTRY', () => {
expect(COMPONENT_REGISTRY.sdxl.needsSeparateCLIP).toBe(false)
})
- it('UNET models (flux, flux2, wan, hunyuan) need separate VAE/CLIP', () => {
+ it('UNET models need separate CLIP (and most need VAE)', () => {
for (const type of ['flux', 'flux2', 'wan', 'hunyuan'] as ModelType[]) {
const reg = COMPONENT_REGISTRY[type]
expect(reg.needsSeparateVAE, `${type} needs VAE`).toBe(true)
@@ -133,6 +140,11 @@ describe('COMPONENT_REGISTRY', () => {
expect(reg.vae!.downloadUrl, `${type} VAE has URL`).toContain('https://')
expect(reg.clip!.downloadUrl, `${type} CLIP has URL`).toContain('https://')
}
+ // LTX needs CLIP but NOT separate VAE
+ expect(COMPONENT_REGISTRY.ltx.needsSeparateCLIP).toBe(true)
+ expect(COMPONENT_REGISTRY.ltx.needsSeparateVAE).toBe(false)
+ expect(COMPONENT_REGISTRY.ltx.clip).toBeDefined()
+ expect(COMPONENT_REGISTRY.ltx.clip!.downloadUrl).toContain('https://')
})
it('FLUX 1 uses T5 encoder', () => {
@@ -153,6 +165,10 @@ describe('COMPONENT_REGISTRY', () => {
expect(COMPONENT_REGISTRY.hunyuan.clip!.patterns).toContain('qwen')
})
+ it('LTX uses Gemma encoder', () => {
+ expect(COMPONENT_REGISTRY.ltx.clip!.patterns).toContain('gemma')
+ })
+
it('every downloadUrl is HTTPS', () => {
for (const [type, reg] of Object.entries(COMPONENT_REGISTRY)) {
if (reg.vae?.downloadUrl) {
@@ -176,6 +192,7 @@ describe('Encoder-Type consistency', () => {
flux2: { loaderType: 'flux2', encoderPatterns: ['qwen', 'mistral'] },
wan: { loaderType: 'wan', encoderPatterns: ['umt5', 'wan', 't5'] },
hunyuan: { loaderType: 'wan', encoderPatterns: ['qwen', 'llava', 'umt5'] },
+ ltx: { loaderType: 'ltxv', encoderPatterns: ['gemma'] },
}
for (const [type, expected] of Object.entries(EXPECTED_CLIP_TYPES)) {
diff --git a/src/api/comfyui-nodes.ts b/src/api/comfyui-nodes.ts
index 959b70af..449762b1 100644
--- a/src/api/comfyui-nodes.ts
+++ b/src/api/comfyui-nodes.ts
@@ -98,7 +98,9 @@ export function categorizeNodes(allNodes: Record<string, NodeMetadata>): Categor
// Latent init
EmptyLatentImage: 'latentInit',
EmptySD3LatentImage: 'latentInit',
+ EmptyFlux2LatentImage: 'latentInit',
EmptyHunyuanLatentVideo: 'latentInit',
+ EmptyLTXVLatentVideo: 'latentInit',
// Text encoding
CLIPTextEncode: 'textEncoders',
CLIPTextEncodeSDXL: 'textEncoders',
diff --git a/src/api/comfyui.ts b/src/api/comfyui.ts
index 16a62599..ce6982cc 100644
--- a/src/api/comfyui.ts
+++ b/src/api/comfyui.ts
@@ -27,7 +27,7 @@ export interface ComfyUIOutput {
type: string
}
-export type ModelType = 'flux' | 'flux2' | 'sdxl' | 'sd15' | 'wan' | 'hunyuan' | 'unknown'
+export type ModelType = 'flux' | 'flux2' | 'sdxl' | 'sd15' | 'wan' | 'hunyuan' | 'ltx' | 'unknown'
export type VideoBackend = 'wan' | 'animatediff' | 'none'
export interface ClassifiedModel {
@@ -63,6 +63,7 @@ export function classifyModel(name: string): ModelType {
// Video models — most specific first
if (lower.includes('wan')) return 'wan'
if (lower.includes('hunyuan')) return 'hunyuan'
+ if (lower.includes('ltx')) return 'ltx'
// FLUX variants
if (lower.includes('flux-2') || lower.includes('flux2')) return 'flux2'
@@ -91,7 +92,7 @@ function isImageModelType(type: ModelType): boolean {
}
function isVideoModelType(type: ModelType): boolean {
- return type === 'wan' || type === 'hunyuan'
+ return type === 'wan' || type === 'hunyuan' || type === 'ltx'
}
// ─── Connection & Info ───
@@ -310,6 +311,13 @@ export async function findMatchingVAE(modelType: ModelType): Promise<string> {
if (match) return match
throw new Error(`No Wan VAE found. Download "wan_2.1_vae.safetensors" from the Model Manager.`)
}
+ if (modelType === 'ltx') {
+ // LTX Video uses its own VAE embedded in the model — any available VAE as fallback
+ const match = vaes.find(v => lower(v).includes('ltx'))
+ if (match) return match
+ // LTX models often have built-in VAE, return first available
+ return vaes[0]
+ }
// SDXL/SD1.5 checkpoints include VAE — any VAE works as fallback
return vaes[0]
}
@@ -346,6 +354,12 @@ export async function findMatchingCLIP(modelType: ModelType): Promise<string> {
if (match) return match
throw new Error(`No Wan text encoder found. Download "umt5_xxl_fp8_e4m3fn_scaled.safetensors" from the Model Manager.`)
}
+ if (modelType === 'ltx') {
+ // LTX Video 2.x uses Gemma 3 as text encoder
+ const match = clips.find(c => lower(c).includes('gemma'))
+ if (match) return match
+ throw new Error(`No LTX Video text encoder found. Download "gemma_3_12B_it_fp8_scaled.safetensors" from the Model Manager.`)
+ }
// SDXL/SD1.5 checkpoints include CLIP — any works
return clips[0]
}
diff --git a/src/api/discover.ts b/src/api/discover.ts
index 77ccf7a7..a2f6522a 100644
--- a/src/api/discover.ts
+++ b/src/api/discover.ts
@@ -109,6 +109,13 @@ export const COMPONENT_REGISTRY: Record<ModelType, ComponentRequirements> = {
needsSeparateVAE: true,
needsSeparateCLIP: true,
},
+ ltx: {
+ loader: 'UNETLoader',
+ vae: { patterns: ['ltx'], downloadName: 'ltx_vae.safetensors', downloadUrl: '', subfolder: 'vae' },
+ clip: { patterns: ['gemma'], downloadName: 'gemma_3_12B_it_fp8_scaled.safetensors', downloadUrl: 'https://huggingface.co/Comfy-Org/ltx-2/resolve/main/split_files/text_encoders/gemma_3_12B_it_fp8_scaled.safetensors', subfolder: 'text_encoders' },
+ needsSeparateVAE: false, // LTX has VAE built into the model pipeline
+ needsSeparateCLIP: true,
+ },
unknown: {
loader: 'CheckpointLoaderSimple',
needsSeparateVAE: false,
diff --git a/src/api/dynamic-workflow.ts b/src/api/dynamic-workflow.ts
index 42aea08a..99bfa1e3 100644
--- a/src/api/dynamic-workflow.ts
+++ b/src/api/dynamic-workflow.ts
@@ -12,8 +12,10 @@ import {
// ─── Strategy Detection ───
export type WorkflowStrategy =
- | 'unet_flux' // FLUX/FLUX2: UNETLoader + CLIPLoader + VAELoader + EmptySD3LatentImage
+ | 'unet_flux' // FLUX 1: UNETLoader + CLIPLoader + VAELoader + EmptySD3LatentImage
+ | 'unet_flux2' // FLUX 2: UNETLoader + CLIPLoader + VAELoader + EmptyFlux2LatentImage
| 'unet_video' // Wan/Hunyuan: UNETLoader + CLIPLoader + VAELoader + EmptyHunyuanLatentVideo
+ | 'unet_ltx' // LTX Video: UNETLoader + CLIPLoader + EmptyLTXVLatentVideo
| 'checkpoint' // SDXL/SD1.5: CheckpointLoaderSimple + EmptyLatentImage
| 'animatediff' // AnimateDiff: CheckpointLoaderSimple + ADE_* nodes
| 'unavailable'
@@ -35,14 +37,30 @@ function determineStrategy(
const hasVAELoader = nodes.loaders.includes('VAELoader')
const hasAnimateDiff = nodes.motion.includes('ADE_LoadAnimateDiffModel')
- // FLUX / FLUX2 → always UNET-based
- if (modelType === 'flux' || modelType === 'flux2') {
+ // FLUX 2 → UNET + Flux2LatentImage
+ if (modelType === 'flux2') {
if (hasUNET && hasCLIPLoader && hasVAELoader) {
- return { strategy: 'unet_flux', reason: `${modelType} model → UNETLoader pipeline` }
+ return { strategy: 'unet_flux2', reason: 'FLUX 2 model → UNETLoader + EmptyFlux2LatentImage' }
+ }
+ return { strategy: 'unavailable', reason: 'FLUX 2 requires UNETLoader + CLIPLoader + VAELoader nodes' }
+ }
+
+ // FLUX 1 → UNET + SD3LatentImage
+ if (modelType === 'flux') {
+ if (hasUNET && hasCLIPLoader && hasVAELoader) {
+ return { strategy: 'unet_flux', reason: 'FLUX model → UNETLoader pipeline' }
}
return { strategy: 'unavailable', reason: 'FLUX requires UNETLoader + CLIPLoader + VAELoader nodes' }
}
+ // LTX Video → UNET + LTXVLatentVideo (no separate VAE needed)
+ if (modelType === 'ltx') {
+ if (hasUNET && hasCLIPLoader) {
+ return { strategy: 'unet_ltx', reason: 'LTX Video → UNETLoader + EmptyLTXVLatentVideo' }
+ }
+ return { strategy: 'unavailable', reason: 'LTX Video requires UNETLoader + CLIPLoader nodes' }
+ }
+
// Wan / Hunyuan → UNET-based with video latent
if (modelType === 'wan' || modelType === 'hunyuan') {
if (hasUNET && hasCLIPLoader && hasVAELoader) {
@@ -117,14 +135,14 @@ export async function buildDynamicWorkflow(
vaeOutputSlot = 2
samplerModelId = modelNodeId
- } else if (strategy === 'unet_flux' || strategy === 'unet_video') {
+ } else if (strategy === 'unet_flux' || strategy === 'unet_flux2' || strategy === 'unet_video' || strategy === 'unet_ltx') {
// Separate loaders
const unetId = String(n++)
const clipId = String(n++)
- const vaeId = String(n++)
const clipType = type === 'flux2' ? 'flux2'
: type === 'flux' ? 'flux'
+ : type === 'ltx' ? 'ltxv'
: (type === 'wan' || type === 'hunyuan') ? 'wan'
: 'flux'
@@ -140,9 +158,18 @@ export async function buildDynamicWorkflow(
class_type: 'CLIPLoader',
inputs: { clip_name: clip, type: clipType, device: 'default' },
}
- workflow[vaeId] = {
- class_type: 'VAELoader',
- inputs: { vae_name: vae },
+
+ // LTX doesn't need a separate VAE loader — VAE is built into the pipeline
+ const needsVAELoader = strategy !== 'unet_ltx'
+ let vaeId: string
+ if (needsVAELoader) {
+ vaeId = String(n++)
+ workflow[vaeId] = {
+ class_type: 'VAELoader',
+ inputs: { vae_name: vae },
+ }
+ } else {
+ vaeId = unetId // fallback reference (won't be used for LTX)
}
modelNodeId = unetId
@@ -227,12 +254,26 @@ export async function buildDynamicWorkflow(
class_type: 'EmptyLatentImage',
inputs: { width: params.width, height: params.height, batch_size: videoParams.frames },
}
+ } else if (strategy === 'unet_ltx') {
+ // LTX Video latent — uses length instead of batch_size
+ workflow[latentId] = {
+ class_type: 'EmptyLTXVLatentVideo',
+ inputs: { width: params.width, height: params.height, length: videoParams.frames, batch_size: 1 },
+ }
+ } else if (strategy === 'unet_flux2') {
+ // FLUX 2 uses its own latent node
+ const latentNode = nodes.latentInit.includes('EmptyFlux2LatentImage')
+ ? 'EmptyFlux2LatentImage'
+ : 'EmptySD3LatentImage'
+ workflow[latentId] = {
+ class_type: latentNode,
+ inputs: { width: params.width, height: params.height, batch_size: params.batchSize },
+ }
} else if (strategy === 'unet_flux') {
- // FLUX uses SD3 latent
+ // FLUX 1 uses SD3 latent
const latentNode = nodes.latentInit.includes('EmptySD3LatentImage')
? 'EmptySD3LatentImage'
: 'EmptyLatentImage'
-
workflow[latentId] = {
class_type: latentNode,
inputs: { width: params.width, height: params.height, batch_size: params.batchSize },
diff --git a/src/components/create/ParamPanel.tsx b/src/components/create/ParamPanel.tsx
index 8c2c441c..561fa67a 100644
--- a/src/components/create/ParamPanel.tsx
+++ b/src/components/create/ParamPanel.tsx
@@ -46,6 +46,7 @@ const TYPE_BADGE: Record<ModelType, { label: string; color: string }> = {
sd15: { label: 'SD 1.5', color: 'bg-green-500/15 text-green-300' },
wan: { label: 'Wan', color: 'bg-orange-500/15 text-orange-300' },
hunyuan: { label: 'Hunyuan', color: 'bg-red-500/15 text-red-300' },
+ ltx: { label: 'LTX', color: 'bg-cyan-500/15 text-cyan-300' },
unknown: { label: 'Model', color: 'bg-white/10 text-gray-400' },
}
diff --git a/src/stores/createStore.ts b/src/stores/createStore.ts
index 236786f4..0835a759 100644
--- a/src/stores/createStore.ts
+++ b/src/stores/createStore.ts
@@ -17,6 +17,7 @@ export const MODEL_TYPE_DEFAULTS: Record<ModelType, {
flux2: { steps: 20, cfgScale: 1.0, sampler: 'euler', scheduler: 'simple', width: 1024, height: 1024 },
wan: { steps: 25, cfgScale: 5.0, sampler: 'euler', scheduler: 'normal', width: 848, height: 480, frames: 49, fps: 16 },
hunyuan: { steps: 30, cfgScale: 6.0, sampler: 'euler', scheduler: 'normal', width: 848, height: 480, frames: 45, fps: 15 },
+ ltx: { steps: 20, cfgScale: 1.0, sampler: 'euler', scheduler: 'simple', width: 768, height: 512, frames: 97, fps: 24 },
unknown: { steps: 20, cfgScale: 7.0, sampler: 'euler', scheduler: 'normal', width: 1024, height: 1024 },
}