Skip to main content
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": "..."
}
The Playground on the right lets you debug directly: put Bearer sk-your-api-key in Authorization, fill in model / input.media / parameters, and send the request. A successful submission returns a task_id; see below for polling and download.
This page is the creation endpoint for wan2.7-i2v (image-to-video): give a first frame + prompt to bring the image to life, and optionally pass driving_audio to make the portrait follow the audio’s mouth movements and rhythm. For the full async flow, see the Wan Overview.
  • Audio drive is exclusive to wan2.7-i2v: HappyHorse i2v does not support driving_audio, so lip-sync / rap must use wan2.7-i2v.
  • input.media is required, otherwise the upstream returns image-to-video model ... must provide an image. Each media url must be a public https link that can be fetched directly with GET.
  • Creation requests go to /wan/api/v1/... with X-DashScope-Async: enable; do not use /v1/videos.

Code examples

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"])

Parameter and media quick reference

ParameterTypeRequiredDefaultNotes
modelstringFixed wan2.7-i2v
input.promptstringText prompt
input.mediaarraySee the media table below
parameters.resolutionstring720P720P / 1080P
parameters.durationint52-15 second integer
parameters.prompt_extendbooltrueSmart rewriting, recommended on
parameters.watermarkboolfalse”AI generated” watermark

media[] values

typeRequiredCountNotes
first_frame1First frame; the video starts from this image
driving_audio1Driving audio (wav/mp3); makes the portrait follow the audio’s mouth movements and rhythm

Response format

{
  "output": { "task_id": "f8ca39a0-6f4b-4ec2-99bf-8b9649d946c4", "task_status": "PENDING" },
  "request_id": "..."
}

Check status and download

Once you have the task_id, follow these three steps to poll status and download the mp4:
  • Poll GET /v1/tasks/{task_id} (with Authorization; the query does not need the X-DashScope-Async header), every 5-10 seconds (not < 3 seconds), until status becomes completed.
  • Status values: submitted (queued) / in_progress (generating; progress often sitting at 30% is normal) / completed (success) / failed (check error).
  • Download: GET the result_url from the response directly, without the Authorization header (it is an OSS signed direct link — sending Auth returns 403); result_url expires in 24 hours by default, so save it promptly.
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
The above is the quick check/download path for “already have a task_id”. For the full polling loop (with timeout fallback) and Python client, see Wan Overview · Async call flow.

Authorizations

Authorization
string
header
required

The API Key obtained from the APIYI console

Headers

X-DashScope-Async
enum<string>
default:enable
required

Async processing switch; must be set to enable

Available options:
enable

Body

application/json
model
enum<string>
default:wan2.7-i2v
required

Model ID; for image-to-video, fixed wan2.7-i2v (legacy version wan2.6-i2v)

Available options:
wan2.7-i2v,
wan2.6-i2v
input
object
required
parameters
object

Response

Task submitted; returns task_id and PENDING status

output
object
request_id
string

Unique request identifier

Example:

"..."