Video generation: create a Wan3.0 video task
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": "wan3.0-video",
"input": {
"prompt": "A lighthouse by the sea at dusk, slow dolly-in, waves on the rocks, seagulls, cinematic lighting"
}
}
'import requests
url = "https://api.apiyi.com/wan/api/v1/services/aigc/video-generation/video-synthesis"
payload = {
"model": "wan3.0-video",
"input": { "prompt": "A lighthouse by the sea at dusk, slow dolly-in, waves on the rocks, seagulls, cinematic lighting" }
}
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: 'wan3.0-video',
input: {
prompt: 'A lighthouse by the sea at dusk, slow dolly-in, waves on the rocks, seagulls, cinematic lighting'
}
})
};
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' => 'wan3.0-video',
'input' => [
'prompt' => 'A lighthouse by the sea at dusk, slow dolly-in, waves on the rocks, seagulls, cinematic lighting'
]
]),
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\": \"wan3.0-video\",\n \"input\": {\n \"prompt\": \"A lighthouse by the sea at dusk, slow dolly-in, waves on the rocks, seagulls, cinematic lighting\"\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\": \"wan3.0-video\",\n \"input\": {\n \"prompt\": \"A lighthouse by the sea at dusk, slow dolly-in, waves on the rocks, seagulls, cinematic lighting\"\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\": \"wan3.0-video\",\n \"input\": {\n \"prompt\": \"A lighthouse by the sea at dusk, slow dolly-in, waves on the rocks, seagulls, cinematic lighting\"\n }\n}"
response = http.request(request)
puts response.read_body{
"output": {
"task_id": "9db29626-79fc-40d1-b9c2-c6b0caf8ac15",
"task_status": "PENDING"
},
"request_id": "e616d8c9-1147-9ecd-b2b5-abbbe89a4642"
}Wan3.0 동영상 생성 (Alibaba)
Wan3.0 동영상 생성 API 레퍼런스
Wan3.0 동영상 생성 API 레퍼런스 및 실시간 Playground: 하나의 모델 ID로 텍스트-동영상, 이미지-동영상, 참조-동영상 및 동영상 편집을 지원하며, 최대 30초, 480P~1080P, DashScope 비동기 패스스루 엔드포인트를 제공합니다.
POST
/
wan
/
api
/
v1
/
services
/
aigc
/
video-generation
/
video-synthesis
Video generation: create a Wan3.0 video task
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": "wan3.0-video",
"input": {
"prompt": "A lighthouse by the sea at dusk, slow dolly-in, waves on the rocks, seagulls, cinematic lighting"
}
}
'import requests
url = "https://api.apiyi.com/wan/api/v1/services/aigc/video-generation/video-synthesis"
payload = {
"model": "wan3.0-video",
"input": { "prompt": "A lighthouse by the sea at dusk, slow dolly-in, waves on the rocks, seagulls, cinematic lighting" }
}
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: 'wan3.0-video',
input: {
prompt: 'A lighthouse by the sea at dusk, slow dolly-in, waves on the rocks, seagulls, cinematic lighting'
}
})
};
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' => 'wan3.0-video',
'input' => [
'prompt' => 'A lighthouse by the sea at dusk, slow dolly-in, waves on the rocks, seagulls, cinematic lighting'
]
]),
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\": \"wan3.0-video\",\n \"input\": {\n \"prompt\": \"A lighthouse by the sea at dusk, slow dolly-in, waves on the rocks, seagulls, cinematic lighting\"\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\": \"wan3.0-video\",\n \"input\": {\n \"prompt\": \"A lighthouse by the sea at dusk, slow dolly-in, waves on the rocks, seagulls, cinematic lighting\"\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\": \"wan3.0-video\",\n \"input\": {\n \"prompt\": \"A lighthouse by the sea at dusk, slow dolly-in, waves on the rocks, seagulls, cinematic lighting\"\n }\n}"
response = http.request(request)
puts response.read_body{
"output": {
"task_id": "9db29626-79fc-40d1-b9c2-c6b0caf8ac15",
"task_status": "PENDING"
},
"request_id": "e616d8c9-1147-9ecd-b2b5-abbbe89a4642"
}오른쪽의 플레이그라운드를 사용하여 직접 테스트합니다. Authorization에
Bearer sk-your-api-key을 입력하고, model / input / parameters을 작성한 후 전송합니다. 제출이 성공하면 task_id이 반환되며, 폴링 및 다운로드 방법은 아래에서 설명합니다.Wan3.0은 하나의 모델 ID로 모든 모드를 지원합니다. 미디어로 무엇을 전송하는지에 따라 동작이 결정됩니다. 전체 비동기 워크플로, 상태 표, 과금 규칙 및 Python 클라이언트는 Wan3.0 개요에서 확인할 수 있습니다.
- 생성 요청은
X-DashScope-Async: enable헤더와 함께/wan/api/v1/services/aigc/video-generation/video-synthesis로 전송해야 합니다./v1/videos은 사용하지 마십시오(미디어 필드가 삭제되어 과금이 부정확해집니다). duration은 정수여야 합니다(5이며,"5"이 아님).resolution은 대문자로 작성합니다(720P).- 종료 상태는
completed/failed이며,SUCCEEDED이 아닙니다.
네 가지 모드, 하나의 필드
| 모드 | media에 입력할 내용 |
|---|---|
| 텍스트-동영상 | media 생략 |
| 이미지-동영상 | [{ "type": "first_frame", "url": "..." }] |
| 첫 프레임/마지막 프레임 동영상 | first_frame + last_frame |
| 참조 기반 동영상 | reference_image / reference_video / reference_audio (혼합 가능) |
first_frame / last_frame은 reference_* / file / link과 혼합할 수 없습니다.이미지 미디어(
first_frame / last_frame / reference_image)는 공개 URL 외에도 base64 데이터 URI(data:image/jpeg;base64,...)를 사용할 수 있습니다. 미디어를 공개적으로 호스팅할 수 없거나 공급자의 가져오기가 시간 초과되는 경우에는 base64를 사용합니다. 제출 시간은 이미지 크기에 따라 늘어나므로 클라이언트 timeout을 최소 300초로 설정하고, 시간 초과 후 무작정 재시도하지 마십시오. 미디어 다운로드 실패를 참조하십시오.프롬프트 길이 제한
input.prompt은 20,000자로 제한됩니다. 중국어 문자 또는 라틴 문자는 각각 1자로 계산됩니다(바이트 또는 token이 아님). 동일한 규칙이 wan3.0-video 및 wan3.0-video-prime에도 적용됩니다.- 제한을 초과하면 거부되지 않고 잘립니다: 제공업체가 20,000자를 초과하는 부분을 자동으로 잘라냅니다(끝부분의 초과 내용이 삭제됨). 작업은 여전히 생성되고 과금되며 400 오류가 발생하지 않습니다. 따라서 지나치게 긴 프롬프트가 허용된 것처럼 보이는 것입니다. 실제로 적용되는 것은 처음 20,000자뿐입니다.
- 참조 미디어는 제한을 변경하지 않습니다:
reference_image/reference_audio/reference_video을 추가해도 프롬프트 제한이 줄어들지 않습니다. 미디어에는 별도의 제한이 있습니다. 참조 이미지는 최대 10개이며 각각 ≤ 20MB, 참조 동영상은 최대 5개이며 총 길이 ≤ 15초 및 각각 ≤ 100MB, 참조 오디오는 최대 5개이며 총 길이 ≤ 15초 및 각각 ≤ 15MB입니다. - 사용된 프롬프트 확인: 제공업체의 작업 결과에는 작업 생성 시 제출한 원본 프롬프트인
output.orig_prompt이 포함됩니다. 잘린 후의 텍스트를 제공하는 문서화된 필드는 없습니다. 실제로 적용된 내용을 확인하려면 제출한 내용의 처음 20,000자를 사용해야 합니다(특히prompt_extend: false을 사용하는 경우). - 클라이언트 측에서 검증: 제한을 초과해도 오류가 발생하지 않으므로, 제출 전에 길이를 확인해야 합니다(예: Python의
if len(prompt) > 20000). 이렇게 하면 프로덕션 환경에서 자동으로 조용히 잘리는 것을 방지할 수 있습니다.
코드 샘플
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": "wan3.0-video",
"input": {
"prompt": "A lighthouse by the sea at dusk, slow dolly-in, waves on the rocks, cinematic lighting"
},
"parameters": {
"resolution": "720P",
"ratio": "16:9",
"duration": 5,
"prompt_extend": 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", # required when creating a task
}
body = {
"model": "wan3.0-video",
"input": {"prompt": "A lighthouse by the sea at dusk, slow dolly-in, waves on the rocks"},
"parameters": {"resolution": "720P", "ratio": "16:9", "duration": 5, "prompt_extend": True},
}
resp = requests.post(url, json=body, headers=headers, timeout=30)
task_id = resp.json()["output"]["task_id"]
print("task_id:", task_id)
const res = await fetch(
"https://api.apiyi.com/wan/api/v1/services/aigc/video-generation/video-synthesis",
{
method: "POST",
headers: {
Authorization: "Bearer sk-your-api-key",
"Content-Type": "application/json",
"X-DashScope-Async": "enable",
},
body: JSON.stringify({
model: "wan3.0-video",
input: { prompt: "A lighthouse by the sea at dusk, slow dolly-in, waves on the rocks" },
parameters: { resolution: "720P", ratio: "16:9", duration: 5, prompt_extend: true },
}),
}
);
const data = await res.json();
console.log("task_id:", data.output.task_id);
이미지-동영상(첫 프레임)
{
"model": "wan3.0-video",
"input": {
"prompt": "The cat turns toward the camera and blinks",
"media": [{ "type": "first_frame", "url": "https://example.com/cat.jpg" }]
},
"parameters": { "resolution": "720P", "duration": 5 }
}
참조-동영상(참조 이미지 + 참조 동영상)
{
"model": "wan3.0-video-prime",
"input": {
"prompt": "Replace the person in video 1 with the person in image 1, keep everything else",
"media": [
{ "type": "reference_image", "url": "https://example.com/person.jpg" },
{ "type": "reference_video", "url": "https://example.com/source.mp4" }
]
},
"parameters": { "resolution": "720P", "ratio": "9:16", "duration": 5 }
}
참조 동영상 길이가 과금됩니다. 위 예시에서 10초 참조와 5초 출력에는 총 15초가 과금됩니다. 입력 + 출력은 최대 30초로 제한됩니다. 과금 규칙을 참조하십시오.
폴링 및 다운로드
# Poll every 5-10 seconds (never below 3)
curl "https://api.apiyi.com/v1/tasks/$TASK_ID" \
-H "Authorization: Bearer sk-your-api-key"
# Download: result_url is a signed OSS link - do not send Authorization
curl -o out.mp4 "$RESULT_URL"
| 상태 | 의미 | 다음 단계 |
|---|---|---|
submitted | 대기 중 | 계속 폴링 |
in_progress | 생성 중 | 계속 폴링 |
completed | 완료 | result_url에서 다운로드 |
failed | 실패 | error.message 확인; 과금되지 않음 |
가격 한눈에 보기
기본 요율은 **Alibaba 공식 가격의 98%**이며, 최대 충전 보너스 적용 시 **약 81.7%**까지 낮아집니다.| 모델 | 해상도 | 기본 요율 | 10% 보너스 적용 시 | 20% 보너스 적용 시 | 20% 보너스 적용 가격(CNY) |
|---|---|---|---|---|---|
wan3.0-video | 480P | $0.0294/초 | $0.0267/초 | $0.0245/초 | ¥0.1715/초 |
wan3.0-video | 720P | $0.0588/초 | $0.0535/초 | $0.049/초 | ¥0.343/초 |
wan3.0-video | 1080P | $0.1176/초 | $0.1069/초 | $0.098/초 | ¥0.686/초 |
wan3.0-video-prime | 480P | $0.063/초 | $0.0573/초 | $0.0525/초 | ¥0.3675/초 |
wan3.0-video-prime | 720P | $0.126/초 | $0.1145/초 | $0.105/초 | ¥0.735/초 |
wan3.0-video-prime | 1080P | $0.252/초 | $0.2291/초 | $0.21/초 | ¥1.47/초 |
가격은 제공업체의 공식 요율과 일치하며 해당 요율에 따라 변경될 수 있습니다. 위 표는 참고용일 뿐이며, 상단 내비게이션의 모델 가격 탭이 기준입니다: 모델 가격.
전체 매개변수, 과금 규칙 및 모범 사례
Wan3.0 개요
헤더
본문
application/json
이 페이지가 도움이 되었나요?