Image-to-video: create a video generation task from a first frame (+ optional driving audio)
curl --request POST \
--url https://api.apiyi.com/wan/api/v1/services/aigc/video-generation/video-synthesis \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'X-DashScope-Async: <x-dashscope-async>' \
--data '
{
"model": "wan2.7-i2v",
"input": {
"prompt": "A spray-painted boy comes to life off the wall and performs an English rap, at night under a railway bridge, cinematic lighting",
"media": [
{
"type": "first_frame",
"url": "https://your-cdn.com/rap.png"
},
{
"type": "driving_audio",
"url": "https://your-cdn.com/rap.mp3"
}
]
}
}
'import requests
url = "https://api.apiyi.com/wan/api/v1/services/aigc/video-generation/video-synthesis"
payload = {
"model": "wan2.7-i2v",
"input": {
"prompt": "A spray-painted boy comes to life off the wall and performs an English rap, at night under a railway bridge, cinematic lighting",
"media": [
{
"type": "first_frame",
"url": "https://your-cdn.com/rap.png"
},
{
"type": "driving_audio",
"url": "https://your-cdn.com/rap.mp3"
}
]
}
}
headers = {
"X-DashScope-Async": "<x-dashscope-async>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-DashScope-Async': '<x-dashscope-async>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
model: 'wan2.7-i2v',
input: {
prompt: 'A spray-painted boy comes to life off the wall and performs an English rap, at night under a railway bridge, cinematic lighting',
media: [
{type: 'first_frame', url: 'https://your-cdn.com/rap.png'},
{type: 'driving_audio', url: 'https://your-cdn.com/rap.mp3'}
]
}
})
};
fetch('https://api.apiyi.com/wan/api/v1/services/aigc/video-generation/video-synthesis', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.apiyi.com/wan/api/v1/services/aigc/video-generation/video-synthesis",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => 'wan2.7-i2v',
'input' => [
'prompt' => 'A spray-painted boy comes to life off the wall and performs an English rap, at night under a railway bridge, cinematic lighting',
'media' => [
[
'type' => 'first_frame',
'url' => 'https://your-cdn.com/rap.png'
],
[
'type' => 'driving_audio',
'url' => 'https://your-cdn.com/rap.mp3'
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"X-DashScope-Async: <x-dashscope-async>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.apiyi.com/wan/api/v1/services/aigc/video-generation/video-synthesis"
payload := strings.NewReader("{\n \"model\": \"wan2.7-i2v\",\n \"input\": {\n \"prompt\": \"A spray-painted boy comes to life off the wall and performs an English rap, at night under a railway bridge, cinematic lighting\",\n \"media\": [\n {\n \"type\": \"first_frame\",\n \"url\": \"https://your-cdn.com/rap.png\"\n },\n {\n \"type\": \"driving_audio\",\n \"url\": \"https://your-cdn.com/rap.mp3\"\n }\n ]\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-DashScope-Async", "<x-dashscope-async>")
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.apiyi.com/wan/api/v1/services/aigc/video-generation/video-synthesis")
.header("X-DashScope-Async", "<x-dashscope-async>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"wan2.7-i2v\",\n \"input\": {\n \"prompt\": \"A spray-painted boy comes to life off the wall and performs an English rap, at night under a railway bridge, cinematic lighting\",\n \"media\": [\n {\n \"type\": \"first_frame\",\n \"url\": \"https://your-cdn.com/rap.png\"\n },\n {\n \"type\": \"driving_audio\",\n \"url\": \"https://your-cdn.com/rap.mp3\"\n }\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.apiyi.com/wan/api/v1/services/aigc/video-generation/video-synthesis")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-DashScope-Async"] = '<x-dashscope-async>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"wan2.7-i2v\",\n \"input\": {\n \"prompt\": \"A spray-painted boy comes to life off the wall and performs an English rap, at night under a railway bridge, cinematic lighting\",\n \"media\": [\n {\n \"type\": \"first_frame\",\n \"url\": \"https://your-cdn.com/rap.png\"\n },\n {\n \"type\": \"driving_audio\",\n \"url\": \"https://your-cdn.com/rap.mp3\"\n }\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"output": {
"task_id": "f8ca39a0-6f4b-4ec2-99bf-8b9649d946c4",
"task_status": "PENDING"
},
"request_id": "..."
}Wan2.7 동영상 생성 (Alibaba)
Wan2.7 Image-to-Video API 레퍼런스
Wan2.7-i2v 이미지-to-Video API 레퍼런스 및 라이브 플레이그라운드: 첫 프레임에서 동영상을 생성하며, driving_audio를 지원하여 립싱크 / 랩을 구현합니다.
POST
/
wan
/
api
/
v1
/
services
/
aigc
/
video-generation
/
video-synthesis
Image-to-video: create a video generation task from a first frame (+ optional driving audio)
curl --request POST \
--url https://api.apiyi.com/wan/api/v1/services/aigc/video-generation/video-synthesis \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'X-DashScope-Async: <x-dashscope-async>' \
--data '
{
"model": "wan2.7-i2v",
"input": {
"prompt": "A spray-painted boy comes to life off the wall and performs an English rap, at night under a railway bridge, cinematic lighting",
"media": [
{
"type": "first_frame",
"url": "https://your-cdn.com/rap.png"
},
{
"type": "driving_audio",
"url": "https://your-cdn.com/rap.mp3"
}
]
}
}
'import requests
url = "https://api.apiyi.com/wan/api/v1/services/aigc/video-generation/video-synthesis"
payload = {
"model": "wan2.7-i2v",
"input": {
"prompt": "A spray-painted boy comes to life off the wall and performs an English rap, at night under a railway bridge, cinematic lighting",
"media": [
{
"type": "first_frame",
"url": "https://your-cdn.com/rap.png"
},
{
"type": "driving_audio",
"url": "https://your-cdn.com/rap.mp3"
}
]
}
}
headers = {
"X-DashScope-Async": "<x-dashscope-async>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-DashScope-Async': '<x-dashscope-async>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
model: 'wan2.7-i2v',
input: {
prompt: 'A spray-painted boy comes to life off the wall and performs an English rap, at night under a railway bridge, cinematic lighting',
media: [
{type: 'first_frame', url: 'https://your-cdn.com/rap.png'},
{type: 'driving_audio', url: 'https://your-cdn.com/rap.mp3'}
]
}
})
};
fetch('https://api.apiyi.com/wan/api/v1/services/aigc/video-generation/video-synthesis', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.apiyi.com/wan/api/v1/services/aigc/video-generation/video-synthesis",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => 'wan2.7-i2v',
'input' => [
'prompt' => 'A spray-painted boy comes to life off the wall and performs an English rap, at night under a railway bridge, cinematic lighting',
'media' => [
[
'type' => 'first_frame',
'url' => 'https://your-cdn.com/rap.png'
],
[
'type' => 'driving_audio',
'url' => 'https://your-cdn.com/rap.mp3'
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"X-DashScope-Async: <x-dashscope-async>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.apiyi.com/wan/api/v1/services/aigc/video-generation/video-synthesis"
payload := strings.NewReader("{\n \"model\": \"wan2.7-i2v\",\n \"input\": {\n \"prompt\": \"A spray-painted boy comes to life off the wall and performs an English rap, at night under a railway bridge, cinematic lighting\",\n \"media\": [\n {\n \"type\": \"first_frame\",\n \"url\": \"https://your-cdn.com/rap.png\"\n },\n {\n \"type\": \"driving_audio\",\n \"url\": \"https://your-cdn.com/rap.mp3\"\n }\n ]\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-DashScope-Async", "<x-dashscope-async>")
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.apiyi.com/wan/api/v1/services/aigc/video-generation/video-synthesis")
.header("X-DashScope-Async", "<x-dashscope-async>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"wan2.7-i2v\",\n \"input\": {\n \"prompt\": \"A spray-painted boy comes to life off the wall and performs an English rap, at night under a railway bridge, cinematic lighting\",\n \"media\": [\n {\n \"type\": \"first_frame\",\n \"url\": \"https://your-cdn.com/rap.png\"\n },\n {\n \"type\": \"driving_audio\",\n \"url\": \"https://your-cdn.com/rap.mp3\"\n }\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.apiyi.com/wan/api/v1/services/aigc/video-generation/video-synthesis")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-DashScope-Async"] = '<x-dashscope-async>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"wan2.7-i2v\",\n \"input\": {\n \"prompt\": \"A spray-painted boy comes to life off the wall and performs an English rap, at night under a railway bridge, cinematic lighting\",\n \"media\": [\n {\n \"type\": \"first_frame\",\n \"url\": \"https://your-cdn.com/rap.png\"\n },\n {\n \"type\": \"driving_audio\",\n \"url\": \"https://your-cdn.com/rap.mp3\"\n }\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"output": {
"task_id": "f8ca39a0-6f4b-4ec2-99bf-8b9649d946c4",
"task_status": "PENDING"
},
"request_id": "..."
}오른쪽 플레이그라운드에서 직접 디버깅할 수 있습니다: Authorization에
Bearer sk-your-api-key를 넣고, model / input.media / parameters를 채운 뒤 요청을 보내십시오. 제출이 성공하면 task_id이 반환됩니다. 폴링과 다운로드는 아래를 참조하십시오.이 페이지는
wan2.7-i2v(이미지에서 동영상 생성)의 생성 엔드포인트입니다. 첫 프레임 + prompt를 제공하여 이미지를 생동감 있게 만들고, 선택적으로 driving_audio를 전달하면 인물이 오디오의 입 모양과 리듬을 따라가게 할 수 있습니다. 전체 비동기 흐름은 Wan 개요를 참조하십시오.- 오디오 구동은
wan2.7-i2v에서만 지원됩니다: HappyHorse i2v는driving_audio를 지원하지 않으므로 립싱크 / 랩에는wan2.7-i2v를 사용해야 합니다. input.media은 필수이며, 그렇지 않으면 업스트림이image-to-video model ... must provide an image를 반환합니다. 각 미디어url는 GET으로 직접 가져올 수 있는 공개 https 링크여야 합니다.- 생성 요청은
/wan/api/v1/...으로X-DashScope-Async: enable와 함께 전송하며,/v1/videos는 사용하지 마십시오.
코드 예제
curl -X POST "https://api.apiyi.com/wan/api/v1/services/aigc/video-generation/video-synthesis" \
-H "X-DashScope-Async: enable" \
-H "Authorization: Bearer sk-your-api-key" \
-H "Content-Type: application/json" \
-d '{
"model": "wan2.7-i2v",
"input": {
"prompt": "A spray-painted boy comes to life off the wall and performs an English rap, at night under a railway bridge, cinematic lighting",
"media": [
{"type": "first_frame", "url": "https://your-cdn.com/rap.png"},
{"type": "driving_audio", "url": "https://your-cdn.com/rap.mp3"}
]
},
"parameters": {"resolution": "720P", "duration": 10, "prompt_extend": true, "watermark": true}
}'
import requests
url = "https://api.apiyi.com/wan/api/v1/services/aigc/video-generation/video-synthesis"
headers = {
"Authorization": "Bearer sk-your-api-key",
"Content-Type": "application/json",
"X-DashScope-Async": "enable",
}
body = {
"model": "wan2.7-i2v",
"input": {
"prompt": "A spray-painted boy comes to life off the wall and performs an English rap, at night under a railway bridge",
"media": [
{"type": "first_frame", "url": "https://your-cdn.com/rap.png"},
{"type": "driving_audio", "url": "https://your-cdn.com/rap.mp3"}, # optional, for lip-sync
],
},
"parameters": {"resolution": "720P", "duration": 10, "prompt_extend": True, "watermark": True},
}
resp = requests.post(url, json=body, headers=headers, timeout=30)
print("task_id:", resp.json()["output"]["task_id"])
import requests
# Without lip-sync, pass only first_frame
body = {
"model": "wan2.7-i2v",
"input": {
"prompt": "A cat running across a meadow, bright sunshine, the camera following",
"media": [{"type": "first_frame", "url": "https://your-cdn.com/cat.png"}],
},
"parameters": {"resolution": "720P", "duration": 5, "prompt_extend": True},
}
resp = requests.post(
"https://api.apiyi.com/wan/api/v1/services/aigc/video-generation/video-synthesis",
json=body,
headers={"Authorization": "Bearer sk-your-api-key", "Content-Type": "application/json",
"X-DashScope-Async": "enable"},
timeout=30,
)
print(resp.json()["output"]["task_id"])
매개변수 및 미디어 빠른 참조
| 매개변수 | 타입 | 필수 | 기본값 | 설명 |
|---|---|---|---|---|
model | string | ✓ | — | 고정 wan2.7-i2v |
input.prompt | string | ✓ | — | 텍스트 prompt |
input.media | array | ✓ | — | 아래 미디어 표를 참조하십시오 |
parameters.resolution | string | 720P | 720P / 1080P | |
parameters.duration | int | 5 | 2~15초 정수 | |
parameters.prompt_extend | bool | true | 스마트 재작성, 켜는 것을 권장 | |
parameters.watermark | bool | false | “AI 생성” 워터마크 |
media[] 값
type | 필수 | 개수 | 설명 |
|---|---|---|---|
first_frame | ✓ | 1 | 첫 프레임입니다. 동영상은 이 이미지에서 시작됩니다 |
driving_audio | 1 | 드라이빙 오디오(wav/mp3)입니다. 초상화가 오디오의 입 모양 움직임과 리듬을 따르도록 합니다 |
응답 형식
{
"output": { "task_id": "f8ca39a0-6f4b-4ec2-99bf-8b9649d946c4", "task_status": "PENDING" },
"request_id": "..."
}
상태 확인 및 다운로드
task_id를 확보한 뒤에는, mp4를 폴링하여 상태를 확인하고 다운로드하기 위해 다음 세 단계를 따르십시오.
- 폴링
GET /v1/tasks/{task_id}(Authorization포함; 쿼리는X-DashScope-Async헤더가 필요하지 않습니다), 5-10초마다(3초 미만은 안 됨)status가completed이 될 때까지 수행합니다. - 상태 값:
submitted(대기 중) /in_progress(생성 중;progress가 30% 근처에서 멈춰 있는 것은 정상입니다) /completed(성공) /failed(error확인). - 다운로드: 응답에서
result_url를 직접 GET으로 가져오되,Authorization헤더는 사용하지 마십시오(OSS 서명된 직접 링크이므로, Auth를 보내면 403이 반환됩니다);result_url는 기본적으로 24시간 후 만료되므로 즉시 저장하십시오.
curl "https://api.apiyi.com/v1/tasks/f8ca39a0-6f4b-4ec2-99bf-8b9649d946c4" \
-H "Authorization: Bearer sk-your-api-key"
{
"status": "completed",
"progress": 100,
"result_url": "https://dashscope-result-xxx.oss-cn-beijing.aliyuncs.com/xxx.mp4?Expires=...&Signature=...",
"task_id": "f8ca39a0-6f4b-4ec2-99bf-8b9649d946c4"
}
# result_url is an OSS signed direct link — do NOT send the Authorization header (it returns 403)
curl -L -o out.mp4 "https://dashscope-result-xxx.oss-cn-beijing.aliyuncs.com/xxx.mp4?Expires=...&Signature=..."
TASK_ID="f8ca39a0-6f4b-4ec2-99bf-8b9649d946c4"
URL=$(curl -s "https://api.apiyi.com/v1/tasks/$TASK_ID" \
-H "Authorization: Bearer sk-your-api-key" | jq -r '.result_url')
curl -L -o out.mp4 "$URL" # no Authorization
위 내용은 “이미 task_id를 가지고 있는 경우”를 위한 빠른 확인/다운로드 경로입니다. 전체 폴링 루프(타임아웃 폴백 포함)와 Python 클라이언트는 Wan Overview · Async call flow를 참조하십시오.
인증
The API Key obtained from the APIYI console
헤더
Async processing switch; must be set to enable
사용 가능한 옵션:
enable 본문
application/json
이 페이지가 도움이 되었나요?
⌘I