Nodes/NIUNIUAPI/🎨SORA2视频生成 NIUNIU
ComfyUI Node

🎨SORA2视频生成 NIUNIU

Sora 2 in your ComfyUI graph — prompt in, mp4 out, patience required

By xiongmaowf·Created 9 months ago·Updated 8 months ago· 2
🎨SORA2视频生成 NIUNIU
  • 图像1
  • 图像2
  • 图像3
  • 图像4
  • 视频
  • 视频URL
  • 响应信息
📝 提示词女人在天上飞
🤖 模型sora-2-private
🌐 API地址https://api.llyapps.com
🔑 API密钥
📐 宽高比9:16
⏱️ 视频时长15
🎬 高清模式false
🎰 随机种子0
🎯 种子控制随机
🔐 隐私模式false
⏳ 超时等待(秒)800

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 /v1 or /v1/videos suffix 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.

CategoryNIUNIUAPI

Inputs (15)

NameTypeDefaultDescription
📝 提示词STRING女人在天上飞
🤖 模型STRINGsora-2-private
🌐 API地址STRINGhttps://api.llyapps.com如 https://api.newapi.pro(也可粘贴到 /v1 或 /v1/videos;会自动纠正)
🔑 API密钥STRINGOpenAI / New API Key
📐 宽高比COMBO9:162 options: 16:9, 9:16
⏱️ 视频时长COMBO153 options: 10, 15, 25
🎬 高清模式BOOLEANfalse
🎰 随机种子INT00–2147483647
🎯 种子控制COMBO随机3 options: 随机, 固定, 递增
🔐 隐私模式BOOLEANfalse
⏳ 超时等待(秒)INT8001–86400
图像1optIMAGE
图像2optIMAGE
图像3optIMAGE
图像4optIMAGE

Outputs (3)

NameTypeDescription
视频VIDEO
视频URLSTRING
响应信息STRING