> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sglang.io/llms.txt
> Use this file to discover all available pages before exploring further.

# SANA-Video

> Generate videos with native SANA-Video 2B and SANA-Video 2.0 5B pipelines.

## 1. Quick start

Follow the [SGLang Diffusion installation guide](https://docs.sglang.io/docs/sglang-diffusion/installation.md) for your GPU platform.

## 2. Model capabilities

[SANA-Video 2B 480p](https://huggingface.co/Efficient-Large-Model/SANA-Video_2B_480p_diffusers)
is a lightweight text-to-video model served through a native SGLang Diffusion
pipeline. Its main advantage is deployment cost: at 2B parameters it serves
480p video from a single GPU with a plain `sglang serve` invocation, no
parallelism flags required.

The released generation profile produces 832×480 output at 81 frames and
16 FPS over 50 inference steps; a compact 17-frame, 8-step profile is covered
by server CI for quick validation. Motion strength can be steered directly
from the prompt with an optional `motion score: N.` suffix.

| Model ID | Task | Default output |
| - | - | - |
| `Efficient-Large-Model/SANA-Video_2B_480p_diffusers` | Text to video | 832x480, 81 frames at 16 FPS |

## 3. Serve SANA-Video

```bash Command theme={null}
sglang serve \
  --model-path Efficient-Large-Model/SANA-Video_2B_480p_diffusers \
  --port 30010
```

## 4. Generate a video

The following request uses the compact 17-frame, 8-step profile covered by
server CI. Use the model defaults of 81 frames and 50 steps for the released
generation profile.

```python Python theme={null}
import time
from pathlib import Path

import requests

base_url = "http://127.0.0.1:30010"
response = requests.post(
    f"{base_url}/v1/videos",
    json={
        "model": "Efficient-Large-Model/SANA-Video_2B_480p_diffusers",
        "prompt": (
            "A red tram moves slowly through a sunlit city square while "
            "pedestrians cross behind it. motion score: 30."
        ),
        "size": "832x480",
        "num_frames": 17,
        "fps": 16,
        "num_inference_steps": 8,
        "guidance_scale": 6.0,
        "seed": 42,
    },
    timeout=60,
)
response.raise_for_status()
video_id = response.json()["id"]

while True:
    job = requests.get(f"{base_url}/v1/videos/{video_id}", timeout=30).json()
    if job["status"] == "completed":
        break
    if job["status"] == "failed":
        raise RuntimeError(job.get("error") or "Video generation failed")
    time.sleep(1)

video = requests.get(
    f"{base_url}/v1/videos/{video_id}/content",
    timeout=300,
)
video.raise_for_status()
Path("sana_video.mp4").write_bytes(video.content)
```

## 5. Request constraints

* The default profile uses `832x480`, 81 frames, 50 inference steps, and 16 FPS.
* Frame counts are aligned to `4n+1`; for example, a request for 80 frames is
  adjusted to 77.
* Use width and height values divisible by 16.
* The prompt supports an optional `motion score: N.` suffix to express the
  desired amount of motion.

## 6. SANA-Video 2.0

The separate `Efficient-Large-Model/SANA-Video_2.0_5B_720p` checkpoint supports
text-to-video and first-frame image conditioning. Its default profile is
1280×736, 193 frames at 24 FPS, 50 steps, and guidance scale 8. This integration
loads the official checkpoint directly and uses Gemma 2 and the LTX 2.3 VAE.

On a single NVIDIA CUDA GPU, generate a short video with:

```bash Command theme={null}
sglang generate \
  --model-path Efficient-Large-Model/SANA-Video_2.0_5B_720p \
  --prompt "A red tram moves slowly through a sunlit city square." \
  --width 832 --height 480 --num-frames 17 --fps 24 \
  --num-inference-steps 50 --guidance-scale 8 --seed 42 \
  --output-file-path sana_video2.mp4
```

Add `--image-path first_frame.png` to condition the video on an image. Frame
counts align to `8n+1`; width and height must be divisible by 32. The 4-step
preview is a different checkpoint and is not supported by this pipeline.

For repeated requests at a fixed shape on an NVIDIA CUDA GPU with enough memory
to keep all components resident, capture breakable CUDA graphs at startup:

```bash Command theme={null}
sglang serve \
  --model-path Efficient-Large-Model/SANA-Video_2.0_5B_720p \
  --performance-mode manual --component-residency=all=resident \
  --enable-breakable-cuda-graph --enable-torch-compile false \
  --warmup-resolutions 832x480 --warmup-num-frames 81 \
  --port 30010
```

This captures text-to-video and first-frame image-conditioned timestep shapes
for 832×480, 81-frame requests. Other resolutions or frame counts run eagerly.
The default prompt length is fixed at 300 tokens, so no text bucket flag is
needed for this command. Changing quality after startup drops captured graphs
and runs eagerly until restart.

Add `--quality high` to run the eight softmax anchor layers with BF16-input
flash attention instead of the FP32 memory-efficient kernel the default path
uses. Accumulation stays FP32 inside the kernel, but the output is no longer
bit-identical to the default path.

With two GPUs, add `--num-gpus 2` to split the video tokens across them
(sequence parallelism). The result is not bit-identical to the single-GPU
result. The sequence-parallel degree must divide the 10 softmax attention
heads; `--ring-degree` above 1 and `--enable-cfg-parallel` are not supported.

For offline weights, keep the model directory name, such as
`/path/to/SANA-Video_2.0_5B_720p`, and pass it as `--model-path`. That directory
must contain `config.yaml` and `checkpoints/SANA_Video_2.0_5B_720p.pth`. Set
`--component-paths.text_encoder /path/to/gemma-2-2b-it` and
`--component-paths.vae /path/to/ltx-2.3-vae`. The latter directory may contain
the `vae` subdirectory or the VAE files directly. Without these overrides,
the component checkpoints are downloaded automatically.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.