Video Generate Skill
This skill generates videos using Doubao Seedance 1.0/1.5 models.
Trigger Conditions
- User wants to generate videos from text descriptions
- User wants to create videos based on images (first/last frame)
- User wants to create videos with reference materials (images, videos, audio)
- User asks for video generation capabilities
Usage
Environment Variables
Before using this skill, ensure the following environment variables are set:
ARK_API_KEY or MODEL_VIDEO_API_KEY or MODEL_AGENT_API_KEY: API key for the video generation service
MODEL_VIDEO_API_BASE: API base URL (optional, has default)
MODEL_VIDEO_NAME: Model name (optional, has default)
Function Signature
async def video_generate(
params: list,
batch_size: int = 10,
max_wait_seconds: int = 1200,
model_name: str = None,
) -> Dict:
Parameters
params (list[dict])
A list of video generation requests. Each item is a dict with the following fields:
Required per item:
video_name (str): Name/identifier of the output video file
prompt (str): Text describing the video to generate. Supports Chinese and English.
Optional per item - Input Materials:
first_frame (str): URL for the first frame image
last_frame (str): URL for the last frame image
reference_images (list[str]): 1-4 reference image URLs for style/content guidance
reference_videos (list[str]): 0-3 reference video URLs (mp4/mov, 2-15s each, total ≤15s)
reference_audios (list[str]): 0-3 reference audio URLs (mp3/wav, 2-15s each, total ≤15s)
Optional per item - Video Output Parameters:
ratio (str): Aspect ratio. Options: "16:9" (default), "9:16", "4:3", "3:4", "1:1", "2:1", "21:9", "adaptive"
duration (int): Video length in seconds. Range: 2-12s depending on model
resolution (str): Video resolution. Options: "480p", "720p", "1080p"
frames (int): Total frame count. Must be in [29, 289] and follow format 25 + 4n
camera_fixed (bool): Lock camera movement. Default: false
seed (int): Random seed for reproducibility. Range: [-1, 2^32-1]
watermark (bool): Whether to add watermark. Default: false
generate_audio (bool): Whether to generate audio. Only Seedance 1.5 supports this
tools (list[dict]): Tool configuration, e.g., [{"type": "web_search"}]
Input Modes
- Text-to-Video: Only provide prompt, no images/videos
- First Frame Guidance: Provide first_frame for starting image
- First + Last Frame Guidance: Provide both for transition video
- Reference Images: Provide reference_images for style/content guidance
- Multimodal Reference: Combine reference_images, reference_videos, reference_audios
Return Value
Script Return Info
The video_generate.py script will return these info:
{
"status": "success" | "partial_success" | "error",
"success_list": [{"video_name": "video_url"}],
"error_list": ["video_name"],
"error_details": [{"video_name": "...", "error": {...}}],
"pending_list": [{"video_name": "...", "task_id": "cgt-xxx", ...}]
}
Based on the script return info, the final response returned to the user consists of a description of the video generation task and the video URL(s). You may download the video from the URL, but the video URL should still be provided to the user for viewing and downloading.
Note: the URL is the 'url' in the success_list of script return info.
The URL must return in two ways:
Final Return Info
For OpenClaw
First, save/download the generated video to an allowed directory:
- Recommended:
~/.openclaw/workspace/
Use the message tool to send the video with these parameters:
{
"action": "send",
"message": "Optional text description",
"media": "/root/.openclaw/workspace/generated-video.mp4"
}
- The tool will automatically: read the local file, upload to the channel server as a web URL, and send as a video message
Verify success: Check that the tool returns {"ok": true} to confirm the video was sent successfully
Normal Text not message tool: After generation, show list of videos with Markdown format, for example:
<video src="https://example.com/video1.mp4" width="640" controls>video-1</video>
Very important:
The video URL must be an original online resource link starting with https://, not a local video address you have downloaded.
For Normal
You should return three types of information:
- File format, return the video file (if you have some other methods to send the video file) and the local path of the video, for example:
local_path: /root/.openclaw/workspace/skills/video-generate/xxx.mp4
- After generation, show list of videos with Markdown format, for example:
<video src="https://example.com/video1.mp4" width="640" controls>video-1</video>
<video src="https://example.com/video2.mp4" width="640" controls>video-2</video>
Code Implementation
See scripts/video_generate.py for the full implementation.
Example Usage
# Text-to-Video
python scripts/video_generate.py -p "小猫骑着滑板穿过公园" -n cat_park -r 16:9 -d 5 --resolution 720p
# First Frame Guidance
python scripts/video_generate.py -p "小猫跳起来" -n cat_jump -f "https://example.com/cat.png" -r adaptive -d 5
# First + Last Frame Guidance
python scripts/video_generate.py -p "平滑过渡动画" -n transition \
-f "https://example.com/start.png" \
-l "https://example.com/end.png" \
-d 6
# Reference Images (style/content guidance)
python scripts/video_generate.py -p "[图1]戴着眼镜的男生和[图2]柯基小狗坐在草坪上" -n styled \
--ref-images "https://example.com/boy.png" "https://example.com/dog.png" \
-r 16:9 -d 5
# Multimodal Reference (video + audio)
python scripts/video_generate.py -p "将视频中的人物换成[图1]中的男孩" -n multimodal \
--ref-images "https://example.com/boy.png" \
--ref-videos "https://example.com/source.mp4" \
--ref-audios "https://example.com/voice.wav" \
-d 5
# With Audio Generation (Seedance 1.5 only)
python scripts/video_generate.py -p "女孩抱着狐狸,可以听到风声和树叶沙沙声" -n with_audio \
-f "https://example.com/girl_fox.png" \
--generate-audio \
-m doubao-seedance-1-5-pro-251215 \
-d 6 --resolution 1080p
# Query task status
python scripts/video_generate.py -q "cgt-20260222165751-wsnw8"
# Use specific model
python scripts/video_generate.py -p "A futuristic city" -m doubao-seedance-2-5-260628
# No watermark
python scripts/video_generate.py -p "A beautiful landscape" --no-watermark
Command Line Options
| Option |
Short |
Description |
--prompt |
-p |
Text description of the video (required) |
--name |
-n |
Video name identifier (default: video) |
--model |
-m |
Model name (default: doubao-seedance-2-5-260628) |
--ratio |
-r |
Aspect ratio (default: 16:9) |
--duration |
-d |
Video duration in seconds (2-12) |
--resolution |
|
Video resolution: 480p, 720p, 1080p |
--first-frame |
-f |
First frame image URL |
--last-frame |
-l |
Last frame image URL |
--ref-images |
|
Reference image URLs (space-separated, 1-4 images) |
--ref-videos |
|
Reference video URLs (space-separated, 0-3 videos) |
--ref-audios |
|
Reference audio URLs (space-separated, 0-3 audios) |
--generate-audio |
|
Generate audio (Seedance 1.5 only) |
--seed |
|
Random seed for reproducibility |
--no-watermark |
|
Disable watermark |
--timeout |
-t |
Max wait time in seconds (default: 1200) |
--query-task |
-q |
Query task status by task_id |
Model Fallback
If you encounter a model-related error (like ModelNotOpen), you can downgrade to these models:
doubao-seedance-1-5-pro-251215
doubao-seedance-1-0-pro-250528
Error Handling
- IF the script raises the error "PermissionError: ARK_API_KEY or MODEL_VIDEO_API_KEY or MODEL_AGENT_API_KEY not found in environment variables", inform the user that they need to provide the
ARK_API_KEY or MODEL_VIDEO_API_KEY or MODEL_AGENT_API_KEY environment variable. Write it to the environment variable file in the workspace. If the file already exists, append it to the end. Ensure the environment variable format is correct, make the environment variable effective, and retry the video generation task that just failed.
Notes
- Keep prompt concise (recommended ≤ 500 characters)
- For first/last frame, ensure aspect ratios match your chosen ratio
- Reference images: 1-4 images, formats: jpeg/png/webp/bmp/tiff/gif
- Reference videos: 0-3 videos, formats: mp4/mov, total duration ≤ 15s
- Reference audios: 0-3 audios, formats: mp3/wav, total duration ≤ 15s
- Multimodal requires at least one image or video (audio-only not supported)
- Audio generation is only supported by Seedance 1.5 pro
- If polling times out, use
--query-task with the returned task_id
1---2name: byted-seedance-video-generate3description: Generate videos using Seedance models. Invoke when user wants to create videos from text prompts, images, or reference materials.4---5
6# Video Generate Skill
7
8This skill generates videos using Doubao Seedance 1.0/1.5 models.
9
10## Trigger Conditions
11
121. User wants to generate videos from text descriptions
132. User wants to create videos based on images (first/last frame)
143. User wants to create videos with reference materials (images, videos, audio)
154. User asks for video generation capabilities
16
17## Usage
18
19### Environment Variables
20
21Before using this skill, ensure the following environment variables are set:
22
23- `ARK_API_KEY` or `MODEL_VIDEO_API_KEY` or `MODEL_AGENT_API_KEY`: API key for the video generation service
24- `MODEL_VIDEO_API_BASE`: API base URL (optional, has default)
25- `MODEL_VIDEO_NAME`: Model name (optional, has default)
26
27### Function Signature
28
29```python
30async def video_generate(
31 params: list,
32 batch_size: int = 10,
33 max_wait_seconds: int = 1200,
34 model_name: str = None,
35) -> Dict:
36```
37
38### Parameters
39
40#### params (list[dict])
41
42A list of video generation requests. Each item is a dict with the following fields:
43
44**Required per item:**
45
46- `video_name` (str): Name/identifier of the output video file
47- `prompt` (str): Text describing the video to generate. Supports Chinese and English.
48
49**Optional per item - Input Materials:**
50
51- `first_frame` (str): URL for the first frame image
52- `last_frame` (str): URL for the last frame image
53- `reference_images` (list[str]): 1-4 reference image URLs for style/content guidance
54- `reference_videos` (list[str]): 0-3 reference video URLs (mp4/mov, 2-15s each, total ≤15s)
55- `reference_audios` (list[str]): 0-3 reference audio URLs (mp3/wav, 2-15s each, total ≤15s)
56
57**Optional per item - Video Output Parameters:**
58
59- `ratio` (str): Aspect ratio. Options: "16:9" (default), "9:16", "4:3", "3:4", "1:1", "2:1", "21:9", "adaptive"
60- `duration` (int): Video length in seconds. Range: 2-12s depending on model
61- `resolution` (str): Video resolution. Options: "480p", "720p", "1080p"
62- `frames` (int): Total frame count. Must be in [29, 289] and follow format 25 + 4n
63- `camera_fixed` (bool): Lock camera movement. Default: false
64- `seed` (int): Random seed for reproducibility. Range: [-1, 2^32-1]
65- `watermark` (bool): Whether to add watermark. Default: false
66- `generate_audio` (bool): Whether to generate audio. Only Seedance 1.5 supports this
67- `tools` (list[dict]): Tool configuration, e.g., `[{"type": "web_search"}]`
68
69### Input Modes
70
711. **Text-to-Video**: Only provide prompt, no images/videos
722. **First Frame Guidance**: Provide first_frame for starting image
733. **First + Last Frame Guidance**: Provide both for transition video
744. **Reference Images**: Provide reference_images for style/content guidance
755. **Multimodal Reference**: Combine reference_images, reference_videos, reference_audios
76
77### Return Value
78
79## Script Return Info
80
81The video_generate.py script will return these info:
82
83```python
84{
85 "status": "success" | "partial_success" | "error",
86 "success_list": [{"video_name": "video_url"}],
87 "error_list": ["video_name"],
88 "error_details": [{"video_name": "...", "error": {...}}],
89 "pending_list": [{"video_name": "...", "task_id": "cgt-xxx", ...}]
90}
91```
92
93Based on the script return info, the final response returned to the user consists of a description of the video generation task and the video URL(s). You may download the video from the URL, but the video URL should still be provided to the user for viewing and downloading.
94
95Note: the URL is the 'url' in the success_list of script return info.
96The URL must return in two ways:
97
98## Final Return Info
99
100### For OpenClaw
1011. **First, save/download the generated video to an allowed directory**:
102 - Recommended: `~/.openclaw/workspace/`
103
1042. **Use the `message tool` to send the video** with these parameters:
105 ```json
106 {
107 "action": "send",
108 "message": "Optional text description",
109 "media": "/root/.openclaw/workspace/generated-video.mp4"
110 }
111 ```
112 - The tool will automatically: read the local file, upload to the channel server as a web URL, and send as a video message
113
1143. **Verify success**: Check that the tool returns `{"ok": true}` to confirm the video was sent successfully
115
1164. **Normal Text** not message tool: After generation, show list of videos with Markdown format, for example:
117 ```
118 <video src="https://example.com/video1.mp4" width="640" controls>video-1</video>
119 ```
120 **Very important**:
121 The video URL must be an **original online resource link** starting with `https://`, **not** a local video address you have downloaded.
122
123### For Normal
124You should return three types of information:
1251. File format, return the video file (if you have some other methods to send the video file) and the local path of the video, for example:
126local_path: /root/.openclaw/workspace/skills/video-generate/xxx.mp4
1272. After generation, show list of videos with Markdown format, for example:
128```
129<video src="https://example.com/video1.mp4" width="640" controls>video-1</video>
130<video src="https://example.com/video2.mp4" width="640" controls>video-2</video>
131```
132
133## Code Implementation
134
135See [scripts/video_generate.py](scripts/video_generate.py) for the full implementation.
136
137## Example Usage
138
139```bash
140# Text-to-Video
141python scripts/video_generate.py -p "小猫骑着滑板穿过公园" -n cat_park -r 16:9 -d 5 --resolution 720p
142
143# First Frame Guidance
144python scripts/video_generate.py -p "小猫跳起来" -n cat_jump -f "https://example.com/cat.png" -r adaptive -d 5
145
146# First + Last Frame Guidance
147python scripts/video_generate.py -p "平滑过渡动画" -n transition \
148 -f "https://example.com/start.png" \
149 -l "https://example.com/end.png" \
150 -d 6
151
152# Reference Images (style/content guidance)
153python scripts/video_generate.py -p "[图1]戴着眼镜的男生和[图2]柯基小狗坐在草坪上" -n styled \
154 --ref-images "https://example.com/boy.png" "https://example.com/dog.png" \
155 -r 16:9 -d 5
156
157# Multimodal Reference (video + audio)
158python scripts/video_generate.py -p "将视频中的人物换成[图1]中的男孩" -n multimodal \
159 --ref-images "https://example.com/boy.png" \
160 --ref-videos "https://example.com/source.mp4" \
161 --ref-audios "https://example.com/voice.wav" \
162 -d 5
163
164# With Audio Generation (Seedance 1.5 only)
165python scripts/video_generate.py -p "女孩抱着狐狸,可以听到风声和树叶沙沙声" -n with_audio \
166 -f "https://example.com/girl_fox.png" \
167 --generate-audio \
168 -m doubao-seedance-1-5-pro-251215 \
169 -d 6 --resolution 1080p
170
171# Query task status
172python scripts/video_generate.py -q "cgt-20260222165751-wsnw8"
173
174# Use specific model
175python scripts/video_generate.py -p "A futuristic city" -m doubao-seedance-2-5-260628
176
177# No watermark
178python scripts/video_generate.py -p "A beautiful landscape" --no-watermark
179```
180
181### Command Line Options
182
183| Option | Short | Description |
184| -------- | ------- | ------------- |
185| `--prompt` | `-p` | Text description of the video (required) |
186| `--name` | `-n` | Video name identifier (default: video) |
187| `--model` | `-m` | Model name (default: doubao-seedance-2-5-260628) |
188| `--ratio` | `-r` | Aspect ratio (default: 16:9) |
189| `--duration` | `-d` | Video duration in seconds (2-12) |
190| `--resolution` | | Video resolution: 480p, 720p, 1080p |
191| `--first-frame` | `-f` | First frame image URL |
192| `--last-frame` | `-l` | Last frame image URL |
193| `--ref-images` | | Reference image URLs (space-separated, 1-4 images) |
194| `--ref-videos` | | Reference video URLs (space-separated, 0-3 videos) |
195| `--ref-audios` | | Reference audio URLs (space-separated, 0-3 audios) |
196| `--generate-audio` | | Generate audio (Seedance 1.5 only) |
197| `--seed` | | Random seed for reproducibility |
198| `--no-watermark` | | Disable watermark |
199| `--timeout` | `-t` | Max wait time in seconds (default: 1200) |
200| `--query-task` | `-q` | Query task status by task_id |
201
202## Model Fallback
203
204If you encounter a model-related error (like `ModelNotOpen`), you can downgrade to these models:
205
206- `doubao-seedance-1-5-pro-251215`
207- `doubao-seedance-1-0-pro-250528`
208
209## Error Handling
210
211- IF the script raises the error "PermissionError: ARK_API_KEY or MODEL_VIDEO_API_KEY or MODEL_AGENT_API_KEY not found in environment variables", inform the user that they need to provide the `ARK_API_KEY` or `MODEL_VIDEO_API_KEY` or `MODEL_AGENT_API_KEY` environment variable. Write it to the environment variable file in the workspace. If the file already exists, append it to the end. Ensure the environment variable format is correct, make the environment variable effective, and retry the video generation task that just failed.
212
213## Notes
214
215- Keep prompt concise (recommended ≤ 500 characters)
216- For first/last frame, ensure aspect ratios match your chosen ratio
217- Reference images: 1-4 images, formats: jpeg/png/webp/bmp/tiff/gif
218- Reference videos: 0-3 videos, formats: mp4/mov, total duration ≤ 15s
219- Reference audios: 0-3 audios, formats: mp3/wav, total duration ≤ 15s
220- Multimodal requires at least one image or video (audio-only not supported)
221- Audio generation is only supported by Seedance 1.5 pro
222- If polling times out, use `--query-task` with the returned task_id