sglang-diffusion-video

TotalClaw 作者 kn7634z607j38fe8g38at6gg4n82nacn v1.0.2

使用本地 SGLang-Diffusion 服务器(Wan2.2、Hunyuan、FastWan 等)生成视频。使用时机:用户要求使用本地运行的 SGLang-Diffusion 实例生成、创建或渲染视频。不适用于:云托管视频 API 或图像生成(对图像使用 sglang-diffusion)。需要正在运行的 SGLang-Diffusion 服务器并加载了视频模型。

安装 / 下载方式

TotalClaw CLI推荐
totalclaw install totalclaw:kn7634z607j38fe8g38at6gg4n82nacn~sglang-diffusion-video
cURL直接下载,无需登录
curl -fsSL https://skills.taituai.com/api/skills/totalclaw%3Akn7634z607j38fe8g38at6gg4n82nacn~sglang-diffusion-video/file -o sglang-diffusion-video.md
# SGLang-Diffusion Video Generation

Generate videos via a local SGLang-Diffusion server's OpenAI-compatible API.


Video generation is asynchronous and takes several minutes. The script handles
submission, polling, and download automatically.

## Prerequisites

- SGLang-Diffusion server running a video model (default: `http://127.0.0.1:30000`)
- Supported models: Wan2.2-T2V, Wan2.2-I2V, FastWan, Hunyuan
- If the server was started with `--api-key`, set `SGLANG_DIFFUSION_API_KEY` env var

## Generate a video

```bash
python3 {baseDir}/scripts/generate_video.py --prompt "a curious raccoon exploring a garden"
```

## Useful flags

```bash
python3 {baseDir}/scripts/generate_video.py --prompt "ocean waves at sunset" --size 1280x720
python3 {baseDir}/scripts/generate_video.py --prompt "city timelapse" --negative-prompt "blurry, low quality"
python3 {baseDir}/scripts/generate_video.py --prompt "dancing robot" --steps 50 --guidance-scale 7.5 --seed 42
python3 {baseDir}/scripts/generate_video.py --prompt "flying through clouds" --seconds 8 --fps 24 --out ./my-video.mp4
python3 {baseDir}/scripts/generate_video.py --prompt "flying through clouds" --server http://192.168.1.100:30000 --out ./my-video.mp4
python3 {baseDir}/scripts/generate_video.py --prompt "cat playing" --poll-interval 15 --timeout 1800
python3 {baseDir}/scripts/generate_video.py --prompt "animate this scene" --input-image /tmp/scene.png
```

## API key (optional)

Only needed if the SGLang-Diffusion server was started with `--api-key`.
Set `SGLANG_DIFFUSION_API_KEY`, or pass `--api-key` directly:

```bash
python3 {baseDir}/scripts/generate_video.py --prompt "hello" --api-key sk-my-key
```

Or configure in `~/.openclaw/openclaw.json`:


```json5
{
 skills: {
   "sglang-diffusion-video": {
     env: { SGLANG_DIFFUSION_API_KEY: "sk-my-key" },
   },
 },
}
```

## Notes

- The script prints a `MEDIA:` line for OpenClaw to auto-attach on supported chat providers.
- Output defaults to timestamped MP4 in `/tmp/`.
- Video generation typically takes 5-15 minutes depending on GPU and model size.
- Do not read the video back; report the saved path only.

---

## 中文说明

# SGLang-Diffusion 视频生成

通过本地 SGLang-Diffusion 服务器的 OpenAI 兼容 API 生成视频。

视频生成是异步的,需要几分钟时间。脚本会自动处理提交、轮询和下载。

## 前置条件

- 运行着视频模型的 SGLang-Diffusion 服务器(默认:`http://127.0.0.1:30000`)
- 支持的模型:Wan2.2-T2V、Wan2.2-I2V、FastWan、Hunyuan
- 如果服务器以 `--api-key` 启动,请设置 `SGLANG_DIFFUSION_API_KEY` 环境变量

## 生成视频

```bash
python3 {baseDir}/scripts/generate_video.py --prompt "a curious raccoon exploring a garden"
```

## 实用参数

```bash
python3 {baseDir}/scripts/generate_video.py --prompt "ocean waves at sunset" --size 1280x720
python3 {baseDir}/scripts/generate_video.py --prompt "city timelapse" --negative-prompt "blurry, low quality"
python3 {baseDir}/scripts/generate_video.py --prompt "dancing robot" --steps 50 --guidance-scale 7.5 --seed 42
python3 {baseDir}/scripts/generate_video.py --prompt "flying through clouds" --seconds 8 --fps 24 --out ./my-video.mp4
python3 {baseDir}/scripts/generate_video.py --prompt "flying through clouds" --server http://192.168.1.100:30000 --out ./my-video.mp4
python3 {baseDir}/scripts/generate_video.py --prompt "cat playing" --poll-interval 15 --timeout 1800
python3 {baseDir}/scripts/generate_video.py --prompt "animate this scene" --input-image /tmp/scene.png
```

## API 密钥(可选)

仅在 SGLang-Diffusion 服务器以 `--api-key` 启动时需要。
设置 `SGLANG_DIFFUSION_API_KEY`,或直接传入 `--api-key`:

```bash
python3 {baseDir}/scripts/generate_video.py --prompt "hello" --api-key sk-my-key
```

或在 `~/.openclaw/openclaw.json` 中配置:

```json5
{
 skills: {
   "sglang-diffusion-video": {
     env: { SGLANG_DIFFUSION_API_KEY: "sk-my-key" },
   },
 },
}
```

## 说明

- 脚本会打印一行 `MEDIA:`,供 OpenClaw 在受支持的聊天提供商上自动附加。
- 输出默认为 `/tmp/` 中带时间戳的 MP4。
- 视频生成通常需要 5-15 分钟,具体取决于 GPU 和模型大小。
- 不要回读视频;只报告保存的路径。