Wan Video Generation API

Call Wan (Alibaba DashScope) video generation through LMU AI with the native async protocol: create tasks, poll for results, defaults, and a full polling example.

Wan (Alibaba Cloud Model Studio, DashScope) video generation uses the vendor's native asynchronous protocol, identical to the official DashScope protocol: replace the address in the official SDK or curl command with the LMU AI address and the key with your LMU AI API key, and the request body stays unchanged. For the shared rules on authentication, billing and watermarks, concurrency limits, and error codes, see the Video Generation API overview.

Base URL

https://api.lmuai.ai
OperationEndpoint
Create a taskPOST /api/v1/services/aigc/video-generation/video-synthesis
Query a taskGET /api/v1/tasks/{task_id}

Video generation must be enabled for your group

The API key's group must have "Video generation" enabled; otherwise calls return 403. The model name must match the name enabled for your group exactly (case-sensitive); check available models with GET /v1/models.

1. Create a task

POST /api/v1/services/aigc/video-generation/video-synthesis

The async header X-DashScope-Async: enable is optional; the platform adds it automatically.

ParameterTypeRequiredDescription
modelstringYesFor example wan3.0-video
input.promptstringYesPrompt
input.mediaarrayNoReference media, such as [{"type":"first_frame","url":"…"}]; type can be first_frame or reference_image
parameters.resolutionstringNoResolution tier: 480P / 720P / 1080P, default 1080P
parameters.durationintegerNoLength in seconds, default 5
parameters.watermarkbooleanNoSet uniformly by the platform according to group policy; a client-supplied value may be overridden
curl https://api.lmuai.ai/api/v1/services/aigc/video-generation/video-synthesis \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "wan3.0-video",
    "input": {"prompt": "A Shiba Inu running across a sunny meadow"},
    "parameters": {"resolution": "720P", "duration": 5}
  }'
import requests

BASE = "https://api.lmuai.ai"
HEADERS = {"Authorization": "Bearer YOUR_API_KEY"}

resp = requests.post(f"{BASE}/api/v1/services/aigc/video-generation/video-synthesis", headers=HEADERS, json={
    "model": "wan3.0-video",
    "input": {"prompt": "A Shiba Inu running across a sunny meadow"},
    "parameters": {"resolution": "720P", "duration": 5},
})
resp.raise_for_status()
task_id = resp.json()["output"]["task_id"]
print(task_id)
const BASE = "https://api.lmuai.ai";
const headers = {
  Authorization: "Bearer YOUR_API_KEY",
  "Content-Type": "application/json",
};

const resp = await fetch(`${BASE}/api/v1/services/aigc/video-generation/video-synthesis`, {
  method: "POST",
  headers,
  body: JSON.stringify({
    model: "wan3.0-video",
    input: { prompt: "A Shiba Inu running across a sunny meadow" },
    parameters: { resolution: "720P", duration: 5 },
  }),
});
const data = await resp.json();
console.log(data.output.task_id);

Response:

{
  "request_id": "4909100c-…",
  "output": {
    "task_id": "c65c77fe-323b-4140-8de6-5a7241d9ec44",
    "task_status": "PENDING"
  }
}

2. Query a task

GET /api/v1/tasks/{task_id}

output.task_status values: PENDING → RUNNING → SUCCEEDED / FAILED / CANCELED. On success, the video URL is in output.video_url, and the billed seconds are in usage.duration.

curl https://api.lmuai.ai/api/v1/tasks/TASK_ID \
  -H "Authorization: Bearer YOUR_API_KEY"

Response (success):

{
  "request_id": "…",
  "output": {
    "task_id": "c65c77fe-323b-4140-8de6-5a7241d9ec44",
    "task_status": "SUCCEEDED",
    "video_url": "https://…/output.mp4"
  },
  "usage": {
    "duration": 2.0,
    "video_count": 1
  }
}

No cancel endpoint

Wan has no cancel endpoint: once submitted, a task always runs to completion. Failed tasks are not charged.

3. Complete example: create and poll

import time, requests

BASE = "https://api.lmuai.ai"
HEADERS = {"Authorization": "Bearer YOUR_API_KEY"}

# 1. Create the task
resp = requests.post(f"{BASE}/api/v1/services/aigc/video-generation/video-synthesis", headers=HEADERS, json={
    "model": "wan3.0-video",
    "input": {"prompt": "A Shiba Inu running across a sunny meadow"},
    "parameters": {"resolution": "720P", "duration": 5},
})
resp.raise_for_status()
task_id = resp.json()["output"]["task_id"]

# 2. Poll until a final state (every 10 seconds)
while True:
    task = requests.get(f"{BASE}/api/v1/tasks/{task_id}", headers=HEADERS).json()
    status = task["output"]["task_status"]
    if status in ("SUCCEEDED", "FAILED", "CANCELED", "CANCELLED", "UNKNOWN"):
        break
    time.sleep(10)

# 3. Download (the link is valid for 24 hours)
if status == "SUCCEEDED":
    url = task["output"]["video_url"]
    with open(f"{task_id}.mp4", "wb") as f:
        f.write(requests.get(url).content)
else:
    print("Generation failed:", task)

4. Billing and error codes

Wan is billed by "actual seconds × resolution-tier unit price", and the billed seconds are in usage.duration of the query result. An estimated amount is frozen when the task is created, and an insufficient balance returns 402; on success the task is settled by actual usage, and failed tasks are fully refunded. Each user and each API key can have at most 5 tasks generating at the same time; beyond that, requests return 429.

For the full rules, see Billing and watermarks, Concurrency limits and Error codes in the overview. For the other provider, see the Seedance Video Generation API.

Last updated:

Still have questions? Ask in the LMU AI Community (in Chinese) and sign in with your console account.

On this page