🎨SORA2视频生成 NIUNIU
Sora 2 in your ComfyUI graph — prompt in, mp4 out, patience required
- 图像1
- 图像2
- 图像3
- 图像4
- 视频
- 视频URL
- 响应信息
Sora 2 has no open weights. There's no safetensors file to download and no VRAM number to worry about - the only way it gets anywhere near ComfyUI is through an API, and that's the entire job of this node. You type a prompt (or wire in up to four reference images), it hands everything to a video-generation endpoint, and it waits. And waits. A 15-second clip isn't a quick process, and the node's default 800-second timeout exists for a reason.
How it works
The mechanism is genuinely more defensive than you'd expect from a pack this small. For text-to-video it POSTs a multipart form to /v1/videos - and not just one path; the code tries a small list of candidate bases (/v1, /api/v1, /openai/v1, /api/openai/v1) because different New API relays mount the OpenAI-compatible surface at different places. Then it polls /v1/videos/{id} every ten seconds, updating a progress bar, until the job hits a terminal status. The part that's worth respecting: the author wrote an aggressive URL extractor that digs through the response payload looking for the video under a half-dozen key names - and if the failure reason string itself contains a URL, it grabs that too. Video-relay responses are notoriously inconsistent, so this is the difference between a node that mostly works and one that mostly errors out.
For image-to-video (图像1–4 wired in), the flow changes: it base64-encodes the images and POSTs to a /v2/videos/generations endpoint with an aspect_ratio/duration payload, then polls that task. Caveat worth knowing: the v2 path is a specific relay convention, and not every provider exposes it. If your i2v runs error out while text-to-video works fine, that's a provider-support issue, not something you mis-set.
Inputs that matter
- 提示词 and 模型 - prompt and model ID. Default model is
sora-2-private; type whatever your relay lists under Sora 2. - API地址 / API密钥 - defaults to
https://api.llyapps.com, accepts any OpenAI-format endpoint. The address field tolerates a pasted/v1or/v1/videossuffix and fixes it for you. - 宽高比 - just 16:9 or 9:16. 视频时长 - 10, 15, or 25 seconds. 高清模式 - boolean; turn it on and the request carries
quality: high. Expect longer queues and a bigger bill. - 随机种子 / 种子控制 - the interesting one. 随机 (random) regenerates every run; 固定 (fixed) holds the seed so you can iterate on a prompt; 递增 (increment) bumps the seed by one each run. This is the knob to reach for when you get one good clip and want variations.
- 隐私模式 - flags the request private. 超时等待(秒) - default 800; if your provider's queue is slow, this is the tripwire that turns a long wait into an error.
Outputs: 视频 (a proper ComfyUI VIDEO - feed it to a save/preview video node), 视频URL (the string, if you want the file elsewhere), and 响应信息 (JSON: task id, status, model, seed, and the raw API response).
Installing it
Part of the NIUNIUAPI pack. ComfyUI Manager → search "ComfyUI-NIUNIUAPI" → install → restart. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/xiongmaowf/ComfyUI-NIUNIUAPI
# restart ComfyUI
Deps are requests, pillow, numpy. No model files, no GPU requirement - the whole thing is an HTTP client with a key baked in.
Troubleshooting
The classic failure is the timeout: video jobs are slow, and if the relay queues behind other users, 800 seconds can genuinely run out. Bump 超时等待 and run it again - the node polls in a loop, so it's not wasting anything. A 401 means wrong key or wrong base URL; double-check you didn't paste the key into the address field. And the usual wrapper-node reminder applies: your prompt and images go to a third party, the call is metered per generation, and Sora's own moderation still applies no matter what the node claims. It's the price of touching a model you were never allowed to download.
Inputs (15)
| Name | Type | Default | Description |
|---|---|---|---|
| 📝 提示词 | STRING | 女人在天上飞 | — |
| 🤖 模型 | STRING | sora-2-private | — |
| 🌐 API地址 | STRING | https://api.llyapps.com | 如 https://api.newapi.pro(也可粘贴到 /v1 或 /v1/videos;会自动纠正) |
| 🔑 API密钥 | STRING | OpenAI / New API Key | |
| 📐 宽高比 | COMBO | 9:16 | 2 options: 16:9, 9:16 |
| ⏱️ 视频时长 | COMBO | 15 | 3 options: 10, 15, 25 |
| 🎬 高清模式 | BOOLEAN | false | — |
| 🎰 随机种子 | INT | 00–2147483647 | — |
| 🎯 种子控制 | COMBO | 随机 | 3 options: 随机, 固定, 递增 |
| 🔐 隐私模式 | BOOLEAN | false | — |
| ⏳ 超时等待(秒) | INT | 8001–86400 | — |
| 图像1opt | IMAGE | — | |
| 图像2opt | IMAGE | — | |
| 图像3opt | IMAGE | — | |
| 图像4opt | IMAGE | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| 视频 | VIDEO | — |
| 视频URL | STRING | — |
| 响应信息 | STRING | — |