$npx -y skills add cinience/alicloud-skills --skill aliyun-wan-animate-moveUse when generating motion videos from a person image and a reference video with DashScope Wan 2.2 animate-move model (wan2.2-animate-move). Use when transferring actions, expressions, or dance moves from a reference video onto a character image via the image2video async API.
| 1 | # Wan 2.2 Animate Move (Image-to-Motion) |
| 2 | |
| 3 | ## Validation |
| 4 | |
| 5 | ```bash |
| 6 | mkdir -p output/aliyun-wan-animate-move |
| 7 | python -m py_compile skills/ai/video/aliyun-wan-animate-move/scripts/generate_animate_move.py && echo "py_compile_ok" > output/aliyun-wan-animate-move/validate.txt |
| 8 | ``` |
| 9 | |
| 10 | Pass criteria: command exits 0 and `output/aliyun-wan-animate-move/validate.txt` is generated. |
| 11 | |
| 12 | ## Output And Evidence |
| 13 | |
| 14 | - Save task IDs, polling responses, and final video URLs to `output/aliyun-wan-animate-move/`. |
| 15 | - Keep at least one end-to-end run log for troubleshooting. |
| 16 | |
| 17 | ## Prerequisites |
| 18 | |
| 19 | - Install SDK (recommended in a venv): |
| 20 | |
| 21 | ```bash |
| 22 | python3 -m venv .venv |
| 23 | . .venv/bin/activate |
| 24 | python -m pip install requests |
| 25 | ``` |
| 26 | - Set `DASHSCOPE_API_KEY` in your environment, or add `dashscope_api_key` to `~/.alibabacloud/credentials`. |
| 27 | |
| 28 | ## Critical model names |
| 29 | |
| 30 | - `wan2.2-animate-move` -- supports motion transfer from reference video to character image |
| 31 | |
| 32 | ## Capabilities |
| 33 | |
| 34 | | Capability | Description | Required inputs | |
| 35 | |---|---|---| |
| 36 | | Motion transfer | Transfer actions/expressions from reference video to character image | `image_url` + `video_url` | |
| 37 | |
| 38 | ## Service modes |
| 39 | |
| 40 | | Mode | Description | |
| 41 | |---|---| |
| 42 | | `wan-std` | Standard mode, faster generation, cost-effective, suitable for preview and basic animation | |
| 43 | | `wan-pro` | Professional mode, smoother animation, better quality, longer processing time | |
| 44 | |
| 45 | ## API endpoint (async only) |
| 46 | |
| 47 | ``` |
| 48 | POST https://dashscope.aliyuncs.com/api/v1/services/aigc/image2video/video-synthesis |
| 49 | ``` |
| 50 | |
| 51 | Required headers: |
| 52 | - `Authorization: Bearer $DASHSCOPE_API_KEY` |
| 53 | - `Content-Type: application/json` |
| 54 | - `X-DashScope-Async: enable` |
| 55 | |
| 56 | Singapore endpoint: replace `dashscope.aliyuncs.com` with `dashscope-intl.aliyuncs.com`. |
| 57 | |
| 58 | ## Normalized interface |
| 59 | |
| 60 | ### Request |
| 61 | - `image_url` (string, required) -- public HTTP/HTTPS URL of the character image |
| 62 | - `video_url` (string, required) -- public HTTP/HTTPS URL of the reference motion video |
| 63 | - `watermark` (boolean, optional) -- add watermark (default: false) |
| 64 | - `mode` (string, required) -- `wan-std` or `wan-pro` |
| 65 | - `check_image` (boolean, optional) -- whether to perform image detection (default: true) |
| 66 | |
| 67 | ### Image input limits |
| 68 | |
| 69 | - Formats: JPG, JPEG, PNG, BMP, WEBP |
| 70 | - Resolution: [200, 4096] pixels per side |
| 71 | - Aspect ratio: 1:3 to 3:1 |
| 72 | - Max size: 5MB |
| 73 | - Content: single person, facing camera, face fully visible, moderate proportion in frame |
| 74 | |
| 75 | ### Video input limits |
| 76 | |
| 77 | - Formats: MP4, AVI, MOV |
| 78 | - Duration: 2-30s |
| 79 | - Resolution: [200, 2048] pixels per side |
| 80 | - Aspect ratio: 1:3 to 3:1 |
| 81 | - Max size: 200MB |
| 82 | - Content: single person, facing camera, face fully visible, moderate proportion in frame |
| 83 | |
| 84 | ### Response (task creation) |
| 85 | - `output.task_id` (string) -- use for polling, valid 24 hours |
| 86 | - `output.task_status` (string) -- PENDING | RUNNING | SUCCEEDED | FAILED | CANCELED | UNKNOWN |
| 87 | - `request_id` (string) |
| 88 | |
| 89 | ### Response (task result) |
| 90 | - `output.video_url` (string) -- generated video URL |
| 91 | - `usage.video_count` (integer) |
| 92 | - `usage.video_duration` (integer) -- duration in seconds |
| 93 | |
| 94 | ## Quick start (Python + HTTP) |
| 95 | |
| 96 | ```python |
| 97 | import os |
| 98 | import json |
| 99 | import time |
| 100 | import requests |
| 101 | |
| 102 | API_KEY = os.getenv("DASHSCOPE_API_KEY") |
| 103 | BASE_URL = "https://dashscope.aliyuncs.com/api/v1" |
| 104 | |
| 105 | def create_animate_move_task(image_url: str, video_url: str, mode: str = "wan-std") -> str: |
| 106 | """Create an animate-move task and return task_id.""" |
| 107 | payload = { |
| 108 | "model": "wan2.2-animate-move", |
| 109 | "input": { |
| 110 | "image_url": image_url, |
| 111 | "video_url": video_url, |
| 112 | "watermark": False, |
| 113 | }, |
| 114 | "parameters": { |
| 115 | "mode": mode, |
| 116 | }, |
| 117 | } |
| 118 | resp = requests.post( |
| 119 | f"{BASE_URL}/services/aigc/image2video/video-synthesis", |
| 120 | headers={ |
| 121 | "Authorization": f"Bearer {API_KEY}", |
| 122 | "Content-Type": "application/json", |
| 123 | "X-DashScope-Async": "enable", |
| 124 | }, |
| 125 | json=payload, |
| 126 | ) |
| 127 | resp.raise_for_status() |
| 128 | data = resp.json() |
| 129 | return data["output"]["task_id"] |
| 130 | |
| 131 | |
| 132 | def poll_task(task_id: str, interval: int = 15) -> dict: |
| 133 | """Poll until task completes. Returns final response.""" |
| 134 | while True: |
| 135 | resp = requests.get( |
| 136 | f"{BASE_URL}/tasks/{task_id}", |
| 137 | headers={"Authorization": f"Bearer {API_KEY}"}, |
| 138 | ) |
| 139 | resp.raise_for_status() |
| 140 | data = resp.json() |
| 141 | status = data["output"]["task_status"] |
| 142 | if status in ("SUCCEEDED", "FAILED", "CANCELED"): |
| 143 | return data |
| 144 | time.sleep(interval) |
| 145 | ``` |
| 146 | |
| 147 | ## Error handling |
| 148 | |
| 149 | | Error | Likely cause | Action | |
| 150 | |---|---|---| |
| 151 | | 401/403 | Missing or invalid `DASHSCOPE_API_KEY` | Check env var or credentials file | |
| 152 | | 400 `InvalidParameter` | Unsupported image/v |