seedinteger
Random seed for reproducibility.
最小值:0
最大值:2147483647
alibaba/wan/2.2/speech-to-videoWan 2.2 Speech to Video turns a portrait image and a speech audio into a talking video guided by a prompt.
试用该模型
PNG、JPEG、WebP 或 GIF · 最大 20 MiB
下一步想做什么?
选择一个示例,将其输入和结果加载到 playground 中。
{
"audio": "https://static.sandbase.ai/examples/1e330d15-cead-4a6f-95c7-573cdf0002b4/input/a299cae5-adf2-4f2e-a69b-110e1cf5d1a1.wav",
"image": "https://static.sandbase.ai/examples/1e330d15-cead-4a6f-95c7-573cdf0002b4/input/2e0cf355-04f3-49ac-9998-f9d7a51e8f19.png",
"prompt": "Summer beach vacation style, a white cat wearing sunglasses sits on a surfboard."
}Turn a portrait and a speech track into a talking video. Wan 2.2 lip-syncs the face in image to audio and animates head and body movement; the prompt sets the scene and gestures.
| Field | Type | Default | Notes |
|---|---|---|---|
prompt | string, required | — | Text instruction. |
image | image URL, required | — | Portrait to animate. JPEG, PNG, or WebP URL. |
audio | audio URL, required | — | Speech track (WAV/MP3) that drives the lips. |
num_frames | integer 40–120 | 80 | Frames to generate (40–120, 16 frames per second of video). |
resolution | 480p / 580p / 720p | 720p | Sets the rate. |
negative_prompt | string | — | What to avoid. |
seed | integer 0–2147483647 | random | Fix it to compare prompt changes. |
Billed per output second at the upstream rate: $0.10 at 480p, $0.15 at 580p, $0.20 at 720p. The default 80 frames is 5 seconds.
| Output | 480p | 580p | 720p |
|---|---|---|---|
| 80 frames (5s, default) | $0.50 | $0.75 | $1.00 |
| 120 frames (7.5s) | $0.75 | $1.125 | $1.50 |
Failed runs are not charged.
Other Wan 2.2 endpoints: alibaba/wan/2.2/animate/move, alibaba/wan/2.2/animate/replace.
开始构建
通过 SandBase Unified Run API 提交此模型。
# The quoted heredoc keeps Unicode and shell metacharacters unchanged.
result=$(curl --fail-with-body --silent \
-X POST "https://api.sandbase.ai/v1/run" \
-H "Authorization: Bearer $SANDBASE_API_KEY" \
-H "Content-Type: application/json" \
--data-binary @- <<'SANDBASE_JSON'
{
"model": "alibaba/wan/2.2/speech-to-video",
"audio": "https://static.sandbase.ai/examples/alibaba/wan/2.2/speech-to-video/input_audio_1.wav",
"image": "https://static.sandbase.ai/examples/alibaba/wan/2.2/speech-to-video/input_image_0.png",
"prompt": "Summer beach vacation style, a white cat wearing sunglasses sits on a surfboard.",
"num_frames": 80,
"resolution": "720p"
}
SANDBASE_JSON
)
run_id=$(printf '%s' "$result" | jq -r .id)
for attempt in $(seq 1 120); do
status=$(printf '%s' "$result" | jq -r .status)
case "$status" in completed|failed|timeout) break ;; esac
sleep 2
result=$(curl --fail-with-body --silent \
-H "Authorization: Bearer $SANDBASE_API_KEY" \
"https://api.sandbase.ai/v1/run/$run_id")
done
status=$(printf '%s' "$result" | jq -r .status)
[ "$status" = completed ] || { echo "Generation ended: $status" >&2; exit 1; }
printf '%s\n' "$result"创建一个 SandBase API 密钥,并将其设置到服务器环境中。所有请求都使用 Bearer 身份验证。
export SANDBASE_API_KEY="YOUR_API_KEY"请将密钥保存在服务器端。不要在浏览器代码中暴露它,也不要提交到仓库。
使用此模型 ID 及其输入向 /v1/run 发送 POST 请求。上方的请求示例包含提交和轮询。
使用返回的运行 ID 轮询,直到状态为 completed、failed 或 timeout。仅在 completed 后读取输出。
curl "https://api.sandbase.ai/v1/run/$RUN_ID" \
-H "Authorization: Bearer $SANDBASE_API_KEY"在模型的 image、video 或 audio 字段中传入一个可公开访问的文件 URL。支持的格式和限制显示在每个 Playground 输入项旁边。
在 Playground 中支持的图片字段上使用上传或替换控件。视频 URL 字段接受托管的 driving video;这并不表示支持视频上传。
seedintegerRandom seed for reproducibility.
最小值:0
最大值:2147483647
audiostring必填Input audio URL.
imagestring必填Input image URL (face / character).
promptstring必填Text prompt guiding the generation.
num_framesintegerFrames to generate (40–120, multiple of 4) at 16 fps.
默认值:80
最小值:40
最大值:120
resolutionstringOutput resolution.
默认值:"720p"
可选值:"480p", "580p", "720p"
negative_promptstringContent to avoid.
默认值:""
{
"model": "alibaba/wan/2.2/speech-to-video",
"audio": "https://static.sandbase.ai/examples/alibaba/wan/2.2/speech-to-video/input_audio_1.wav",
"image": "https://static.sandbase.ai/examples/alibaba/wan/2.2/speech-to-video/input_image_0.png",
"prompt": "Summer beach vacation style, a white cat wearing sunglasses sits on a surfboard.",
"num_frames": 80,
"resolution": "720p"
}已完成的运行会在输出中展示结果。以下内容是该模型保存的示例,而不是新的生成结果。
[
{
"poster": "https://static.sandbase.ai/examples/posters/e90941034859654e6a1d.jpg",
"source": "Alibaba Model Studio schema mirror",
"source_url": "https://www.alibabacloud.com/help/en/model-studio/",
"url": "https://static.sandbase.ai/examples/1e330d15-cead-4a6f-95c7-573cdf0002b4/output/7c0ba794-a7be-4ec8-80ab-357cd06ad681.mp4"
}
]