$npx -y skills add cinience/alicloud-skills --skill aliyun-kling-videoUse when generating videos with Kling v3 models on DashScope (kling/kling-v3-video-generation, kling/kling-v3-omni-video-generation). Use when implementing text-to-video, image-to-video, reference-to-video, smart storyboard, or video editing via the video-synthesis async API.
| 1 | # Kling V3 Video Generation |
| 2 | |
| 3 | ## Validation |
| 4 | |
| 5 | ```bash |
| 6 | mkdir -p output/aliyun-kling-video |
| 7 | python -m py_compile skills/ai/video/aliyun-kling-video/scripts/generate_kling_video.py && echo "py_compile_ok" > output/aliyun-kling-video/validate.txt |
| 8 | ``` |
| 9 | |
| 10 | Pass criteria: command exits 0 and `output/aliyun-kling-video/validate.txt` is generated. |
| 11 | |
| 12 | ## Output And Evidence |
| 13 | |
| 14 | - Save task IDs, polling responses, and final video URLs to `output/aliyun-kling-video/`. |
| 15 | - Keep at least one end-to-end run log for troubleshooting. |
| 16 | |
| 17 | ## Prerequisites |
| 18 | |
| 19 | - Install dependencies (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 (must be Beijing region API Key). |
| 27 | - Enable Kling in [百炼控制台](https://bailian.console.aliyun.com/cn-beijing/?tab=model#/model-market/all) — search "kling" and activate. |
| 28 | |
| 29 | ## Critical model names |
| 30 | |
| 31 | - `kling/kling-v3-video-generation` — standard model: t2v, i2v (first frame, first+last frame) |
| 32 | - `kling/kling-v3-omni-video-generation` — omni model: adds reference-to-video, video editing, multi-subject references |
| 33 | |
| 34 | ## Capabilities |
| 35 | |
| 36 | | Capability | Model | Required media | |
| 37 | |---|---|---| |
| 38 | | Text-to-video | both | none | |
| 39 | | Smart storyboard (multi-shot) | both | none (use `multi_prompt`) | |
| 40 | | Image-to-video (first frame) | both | `first_frame` | |
| 41 | | Image-to-video (first+last frame) | both | `first_frame` + `last_frame` | |
| 42 | | Reference-to-video | omni only | `refer` and/or `feature` | |
| 43 | | Video editing | omni only | `base` + optional `refer` | |
| 44 | |
| 45 | ## API endpoint (async only) |
| 46 | |
| 47 | ``` |
| 48 | POST https://dashscope.aliyuncs.com/api/v1/services/aigc/video-generation/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 | **Region**: Beijing only. No Singapore endpoint. |
| 57 | |
| 58 | ## Normalized interface |
| 59 | |
| 60 | ### Request (input) |
| 61 | - `prompt` (string, conditional) — up to 2500 characters. Required for `shot_type=intelligence`. For omni reference-to-video, use `<<<element_1>>>`, `<<<image_1>>>`, `<<<video_1>>>` to reference media. |
| 62 | - `negative_prompt` (string, optional) — content to exclude |
| 63 | - `media` (array, optional) — media objects with `type` and `url`: |
| 64 | - Standard model types: `first_frame`, `last_frame` |
| 65 | - Omni model types: `first_frame`, `last_frame`, `refer`, `base`, `feature` |
| 66 | - `multi_shot` (boolean, optional) — enable multi-shot generation (default: false) |
| 67 | - `shot_type` (string, conditional) — `intelligence` (AI auto-split) or `customize` (manual). Required when `multi_shot=true`. |
| 68 | - `multi_prompt` (array, optional) — per-shot prompts when `shot_type=customize` |
| 69 | - `element_list` (array, optional) — multi-subject element images (omni model only) |
| 70 | - `keep_original_sound` (string, optional) — `no` (default) or `yes`, for videos (omni model only) |
| 71 | |
| 72 | ### Request (parameters) |
| 73 | - `mode` (string, optional) — `pro` (default, 1080P) or `std` (720P) |
| 74 | - `aspect_ratio` (string, conditional) — `16:9` (default), `9:16`, `1:1`. Required for t2v and reference-to-video. |
| 75 | - `duration` (integer, optional) — video length [3, 15] seconds (default: 5). When using reference video, [3, 10]. |
| 76 | - `audio` (boolean, optional) — generate audio (default: false). Affects pricing. |
| 77 | - `watermark` (boolean, optional) — add "可灵 AI" watermark (default: false) |
| 78 | |
| 79 | ### Media input limits |
| 80 | |
| 81 | **Images** (first_frame, last_frame, refer): |
| 82 | - Formats: JPEG, JPG, PNG (no transparency) |
| 83 | - Resolution: [300, 8000] pixels per side |
| 84 | - Max size: 10MB |
| 85 | |
| 86 | **Videos** (base, feature): |
| 87 | - Formats: mp4, mov |
| 88 | - Duration: 3-10s |
| 89 | - Resolution: [720, 2160] pixels per side |
| 90 | - Frame rate: 24-60 fps |
| 91 | - Max size: 200MB |
| 92 | |
| 93 | ### Media combination rules |
| 94 | |
| 95 | **kling/kling-v3-video-generation**: |
| 96 | - i2v first frame: `first_frame` (1 image) |
| 97 | - i2v first+last: `first_frame` + `last_frame` (1 each) |
| 98 | |
| 99 | **kling/kling-v3-omni-video-generation** (all above plus): |
| 100 | - Reference: `feature` only (1 video), or `refer` only (up to 7 with elements), or `feature+refer` (1 video + up to 4 with elements), or `feature+first_frame` (1 video + 1 image) |
| 101 | - Video editing: `base` only (1 video), or `base+refer` (1 video + up to 4 with elements) |
| 102 | |
| 103 | ### Response (task creation) |
| 104 | - `output.task_id` (string) — valid 24 hours |
| 105 | - `output.task_status` (string) — PENDING | RUNNING | SUCCEEDED | FAILED | CANCELED |
| 106 | - `request_id` (string) |
| 107 | |
| 108 | ### Response (task result) |
| 109 | - `output.video_url` (string) — generated video URL |
| 110 | - `output.watermark_video_url` (string) — watermarked video URL |
| 111 | - `usage.duration` (integer), `usage.size` (string), `usage.fps` (integer), `usage.audio` (boolean) |
| 112 | |
| 113 | ## Quick start (Python + HTTP) |
| 114 | |
| 115 | ```python |
| 116 | import os |
| 117 | import json |
| 118 | import time |
| 119 | import requests |
| 120 | |
| 121 | API_KEY = os.getenv("D |