A beautiful web interface and REST API for Lightricks LTX-2 video generation models.
- π₯ Multiple Generation Modes - Text-to-video, image-to-video, video-to-video, keyframe interpolation
- π Audio-Video Sync - Synchronized audio generation
- πΊ Native 4K - Up to 4K resolution at 50 FPS
- β‘ Fast Inference - Distilled pipeline with only 8 steps
- π Real-Time Progress - SSE streaming with per-stage progress bars and timing info
- πΎ Preset System - Save and load generation settings
- π REST API - Full-featured FastAPI service with SSE streaming
- π§ VRAM Caching - Models stay in memory for faster subsequent generations
- π¦ Auto-Download - All models downloaded automatically
Just run one command - everything is handled automatically:
./run.shThat's it! The script will:
β
Install all Python dependencies
β
Install LTX-2 core packages
β
Download Gemma 3 12B FP8 text encoder (~13GB)
β
Download LTX-2 19B Distilled FP8 checkpoint (~27GB)
β
Download Spatial upsampler (~1GB)
β
Start the server at http://localhost:8000
Note: First run takes ~10-30 minutes depending on your internet speed (downloading ~40GB of models). Subsequent runs start instantly.
# If run.sh doesn't work, use these commands:
pip install -r requirements.txt
pip install -e LTX-2/packages/ltx-core
pip install -e LTX-2/packages/ltx-pipelines
python api.py # Models auto-download on first generationAccess the web interface at http://localhost:8000
Features:
- Beautiful dark theme with gradient accents
- Generation mode selector (Fast, Quality, Image-to-Video, etc.)
- Real-time progress with individual stage tracking:
- π Loading Models (on cold start)
- π¨ Stage 1: Denoising (8 steps)
- β¨ Stage 2: Refinement (3 steps)
- π¬ Video Encoding
- Shows elapsed time, remaining time, and rate per stage
- Total generation time displayed on completion
- Preset management (save/load/delete)
- Model management with on-demand downloads
- Full API documentation built into the UI
Full interactive API documentation at http://localhost:8000/docs (Swagger UI)
Quick Examples:
# Generate a video (SSE streaming response)
curl -X POST http://localhost:8000/generate \
-H "Content-Type: application/json" \
-d '{"prompt": "A beautiful sunset over the ocean"}'
# Download completed video (job_id from SSE response)
curl http://localhost:8000/generate/{job_id}/download -o video.mp4
# List all presets
curl http://localhost:8000/presets
# Check system health
curl http://localhost:8000/healthPython SSE Streaming Example:
import requests
import json
API_URL = "http://localhost:8000"
response = requests.post(
f"{API_URL}/generate",
json={"prompt": "A cat walking through a garden"},
stream=True
)
job_id = None
for line in response.iter_lines():
if line.startswith(b"data: "):
data = json.loads(line[6:])
if data["type"] == "init":
job_id = data["job_id"]
print(f"Job started: {job_id}")
elif data["type"] == "step":
print(f" {data['stage']}: {data['step']}/{data['total']} ({data.get('elapsed', '')})")
elif data["type"] == "complete":
print(f"β
Done! Download: {API_URL}{data['download_url']}")
break
# Download video
if job_id:
video = requests.get(f"{API_URL}/generate/{job_id}/download")
with open("video.mp4", "wb") as f:
f.write(video.content)SSE Event Types:
| Event | Description |
|---|---|
init |
Job initialized with job_id |
info |
Pipeline info (type, resolution, frames) |
step |
Progress update with stage, step/total, elapsed/remaining time |
complete |
Generation finished with download_url |
error |
Generation failed with error message |
python app.pyAccess at http://localhost:7860 with shareable link support.
| Model | Size | Description |
|---|---|---|
ltx-2-19b-distilled-fp8 |
27 GB | Recommended - Fast FP8 distilled model |
Gemma 3 12B FP8 |
13 GB | Required text encoder |
ltx-2-spatial-upscaler-x2 |
1 GB | 2x resolution upscaler |
# Gemma 3 12B FP8 (no HF token required)
huggingface-cli download MISHANM/google-gemma-3-12b-it-fp8 --local-dir ./models/gemma
# LTX-2 Checkpoint
huggingface-cli download Lightricks/LTX-2 ltx-2-19b-distilled-fp8.safetensors --local-dir ./models/checkpoints
# Spatial Upsampler
huggingface-cli download Lightricks/LTX-2 ltx-2-spatial-upscaler-x2-1.0.safetensors --local-dir ./models/upsamplers| Model | Size | Use Case |
|---|---|---|
ltx-2-19b-dev-fp8 |
27 GB | Dev model for Two-Stage pipeline |
ltx-2-19b-distilled-lora-384 |
7.7 GB | Required for Two-Stage pipeline |
ltx-2-temporal-upscaler-x2 |
262 MB | Frame rate upscaling |
Need video conditioning?
ββ YES β Reference videos for v2v? β Use IC-LoRA Pipeline
β Keyframes to interpolate? β Use Keyframe Interpolation
β Just image conditioning? β Any pipeline works
β
ββ NO β Text-to-video only
ββ Fastest inference? β Distilled Pipeline β‘ (8 steps)
ββ Best quality? β Two-Stage Pipeline π¬ (40+ steps)
| Pipeline | Steps | CFG | Upsampling | Best For |
|---|---|---|---|---|
| Distilled β‘ | 8 | β | β | Fast iterations |
| Two-Stage π¬ | 40+ | β | β | Production quality |
| IC-LoRA ποΈ | 40+ | β | β | Video-to-video |
| Keyframe π¨ | 40+ | β | β | Animation |
| Parameter | Default | Description |
|---|---|---|
height |
1024 | Output height (256-2048) |
width |
1536 | Output width (256-2048) |
num_frames |
121 | Frame count (9, 17, 25... 257) |
frame_rate |
24 | FPS (8-60) |
num_inference_steps |
40 | Denoising steps |
cfg_guidance_scale |
4.0 | CFG scale (1.0-15.0) |
seed |
-1 | Random seed (-1 = random) |
# Enable FP8 memory optimization (recommended)
export PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True
# HuggingFace token (for gated models)
export HF_TOKEN=your_token_here- Use FP8 checkpoints - 30% smaller than full precision
- Enable FP8 optimization - Checkbox in UI or
enable_fp8=True - Clear VRAM cache - Settings tab when switching between tasks
- Use Two-Stage Pipeline with 40+ inference steps
- CFG scale of 4.0-6.0 works well for most prompts
- Write detailed, cinematographic prompts
- Use Distilled Pipeline - Only 8 steps required
- FP8 checkpoint reduces memory and improves speed
- Keep models cached between generations
ltx2/
βββ api.py # FastAPI REST API server
βββ app.py # Gradio WebUI application
βββ presets.py # Preset management system
βββ requirements.txt # Python dependencies
βββ run.sh # One-command launcher
βββ templates/ # HTML templates for API UI
βββ models/ # Downloaded models (auto-created)
β βββ checkpoints/ # LTX-2 model checkpoints
β βββ gemma/ # Gemma text encoder
β βββ loras/ # LoRA adapters
β βββ upsamplers/ # Spatial/temporal upsamplers
βββ outputs/ # Generated videos
βββ presets/ # Saved presets (JSON)
βββ LTX-2/ # Official LTX-2 repository
βββ packages/
βββ ltx-core/ # Core model implementation
βββ ltx-pipelines/ # Pipeline implementations
βββ ltx-trainer/ # Training tools
- Python: >= 3.12
- CUDA: >= 12.7
- PyTorch: >= 2.7
- GPU Memory: 16GB+ (24GB+ recommended)
- Disk Space: ~55GB for models
This project is licensed under the MIT License. See LICENSE for details.
LTX-2 models are subject to Lightricks' licensing terms.
Built with β€οΈ for the AI video generation community