$npx -y skills add cinience/alicloud-skills --skill aliyun-wan-r2vUse when generating reference-based videos with Alibaba Cloud Model Studio Wan R2V models (wan2.6-r2v-flash, wan2.6-r2v). Use when creating multi-shot videos from reference video/image material, preserving character style, or documenting reference-to-video request/response flows.
| 1 | Category: provider |
| 2 | |
| 3 | # Model Studio Wan R2V |
| 4 | |
| 5 | ## Validation |
| 6 | |
| 7 | ```bash |
| 8 | mkdir -p output/aliyun-wan-r2v |
| 9 | python -m py_compile skills/ai/video/aliyun-wan-r2v/scripts/prepare_r2v_request.py && echo "py_compile_ok" > output/aliyun-wan-r2v/validate.txt |
| 10 | ``` |
| 11 | |
| 12 | Pass criteria: command exits 0 and `output/aliyun-wan-r2v/validate.txt` is generated. |
| 13 | |
| 14 | ## Output And Evidence |
| 15 | |
| 16 | - Save reference input metadata, request payloads, and task outputs in `output/aliyun-wan-r2v/`. |
| 17 | - Keep at least one polling result snapshot. |
| 18 | |
| 19 | Use Wan R2V for reference-to-video generation. This is different from i2v (single image to video). |
| 20 | |
| 21 | ## Critical model names |
| 22 | |
| 23 | Use one of these exact model strings: |
| 24 | - `wan2.6-r2v-flash` |
| 25 | - `wan2.6-r2v` |
| 26 | |
| 27 | Newer official releases may prefer the flash variant for lower latency and lower cost. |
| 28 | |
| 29 | ## Prerequisites |
| 30 | |
| 31 | - Install SDK in a virtual environment: |
| 32 | |
| 33 | ```bash |
| 34 | python3 -m venv .venv |
| 35 | . .venv/bin/activate |
| 36 | python -m pip install dashscope |
| 37 | ``` |
| 38 | - Set `DASHSCOPE_API_KEY` in your environment, or add `dashscope_api_key` to `~/.alibabacloud/credentials`. |
| 39 | |
| 40 | ## Normalized interface (video.generate_reference) |
| 41 | |
| 42 | ### Request |
| 43 | - `prompt` (string, required) |
| 44 | - `reference_video` (string | bytes, required) |
| 45 | - `reference_image` (string | bytes, optional) |
| 46 | - `duration` (number, optional) |
| 47 | - `fps` (number, optional) |
| 48 | - `size` (string, optional) |
| 49 | - `seed` (int, optional) |
| 50 | |
| 51 | ### Response |
| 52 | - `video_url` (string) |
| 53 | - `task_id` (string, when async) |
| 54 | - `request_id` (string) |
| 55 | |
| 56 | ## Async handling |
| 57 | |
| 58 | - Prefer async submission for production traffic. |
| 59 | - Poll task result with 15-20s intervals. |
| 60 | - Stop polling when `SUCCEEDED` or terminal failure status is returned. |
| 61 | |
| 62 | ## Local helper script |
| 63 | |
| 64 | Prepare a normalized request JSON and validate response schema: |
| 65 | |
| 66 | ```bash |
| 67 | .venv/bin/python skills/ai/video/aliyun-wan-r2v/scripts/prepare_r2v_request.py \ |
| 68 | --prompt "Generate a short montage with consistent character style" \ |
| 69 | --reference-video "https://example.com/reference.mp4" |
| 70 | ``` |
| 71 | |
| 72 | ## Output location |
| 73 | |
| 74 | - Default output: `output/aliyun-wan-r2v/videos/` |
| 75 | - Override base dir with `OUTPUT_DIR`. |
| 76 | |
| 77 | ## Workflow |
| 78 | |
| 79 | 1) Confirm user intent, region, identifiers, and whether the operation is read-only or mutating. |
| 80 | 2) Run one minimal read-only query first to verify connectivity and permissions. |
| 81 | 3) Execute the target operation with explicit parameters and bounded scope. |
| 82 | 4) Verify results and save output/evidence files. |
| 83 | |
| 84 | ## References |
| 85 | |
| 86 | - `references/sources.md` |