TensorsLab Video Generation
Overview
This skill enables AI-powered video generation through TensorsLab's API, supporting both text-to-video and image-to-video workflows. Video generation is a time-intensive process - tasks typically take several minutes to complete.
Authorization
BEFORE any video generation, you must ensure you are authorized with TensorsLab.
1. Automatic Authorization
The authorization script will automatically check if an API key already exists in the
environment variable or in
before proceeding.
(Note: When you need to verify the environment variable, ONLY check if it exists. NEVER display or print the actual API key value.)
Run:
bash
python scripts/tensorslab_auth.py
This will open a browser for authorization. Wait for "Authorization Successful!" before proceeding.
After authorization, the API key is stored in
and you don't need to re-authorize unless the key expires.
2. Manual Configuration (For Cloud/Headless Environments)
When the agent or openclaw operates in a cloud environment without a browser, the URL authorization method will also fail. In this scenario, you must instruct the user to manually acquire their API key and configure it in the cloud environment:
- Direct the user to get their API Key at TensorsLab Console.
- Set the environment variable in the cloud environment.
Models
| Model | Description | Best For | Max Duration |
|---|
| seedancev2 | Latest, highest quality | General purpose, cinematic content | 15s |
| seedancev15pro | Pro quality | High-end productions | 10s |
| seedancev1profast | Fast generation | Quick previews | 10s |
| seedancev1 | Standard lite | Basic videos | 10s |
Workflow
1. Text-to-Video Generation
User request: "做一段 10 秒钟横屏的宇宙飞船穿梭星际的视频"
Constraints:
- Do NOT pass or for text-to-video generation.
Agent processing:
- Extract parameters: ,
- Enhance prompt with cinematic details, camera movements, scene descriptions
- Call API with enriched prompt
- Monitor progress with heartbeat updates (every 60 seconds)
- Download to
Example enhanced prompt:
Cinematic wide shot of a spaceship rapidly flying through space, passing glowing
nebulae and distant stars, lens flares, dramatic camera movement, epic scale,
movie-quality visual effects, smooth 24fps motion
2. Image-to-Video Generation
User request: "让这张人物合影 family.jpg 动起来" or "让风景照动起来"
Agent processing:
- Extract image file paths (1-2 images supported)
- Enhance prompt with motion instructions
- Monitor progress with heartbeat updates
- Download results
Parameters for image-to-video:
- : Array of image files (1-2 images max)
- : Comma-separated URLs of source images (Must be standard HTTP/HTTPS URLs. Do NOT use local paths like /tmp/xxx.png here)
- : Description of desired motion/animation
3. Resolution and Aspect Ratio
Aspect ratios:
- - Vertical (TikTok, Reels, Shorts) - default
- - Horizontal (YouTube, standard video)
- Other ratios available depending on model
Resolutions:
- - SD quality, faster generation
- - HD quality - default
- - Full HD
- - 2K quality (seedancev2 only)
4. Duration Options
- seedancev2: 5-15 seconds
- Other models: 5-10 seconds
Longer videos take proportionally more time to generate.
5. Special Features (seedancev2 only)
| Feature | Parameter | Description |
|---|
| Audio Generation | | Generate soundtrack with video |
| Last Frame | | Also return final frame as image |
Progress Tracking
Video generation takes several minutes. Keep users informed:
⏳ Waiting for video generation to complete...
(This may take several minutes - please be patient)
🔄 Status: Processing (elapsed: 45s)
🚀 正在渲染电影级大片,已耗时 60 秒,请稍安勿躁...
🚀 正在渲染电影级大片,已耗时 120 秒,请稍安勿躁...
✅ Task completed!
Heartbeat interval: Print encouraging message every 60 seconds.
Using the Script
bash
pip install requests pyyaml
Execute the Python script directly:
bash
# Text-to-video (default 5s, vertical 9:16)
python scripts/tensorslab_video.py "a spaceship flying through space"
# 10 second horizontal video
python scripts/tensorslab_video.py "sunset over ocean waves" --duration 10 --ratio 16:9
# Image-to-video with local file
python scripts/tensorslab_video.py "make this photo come alive" --source portrait.jpg
# Image-to-video with URL
python scripts/tensorslab_video.py "make this photo come alive" --image-url https://example.com/portrait.jpg
# Fast preview
python scripts/tensorslab_video.py "abstract flowing colors" --model seedancev1profast
# High quality with audio
python scripts/tensorslab_video.py "epic mountain timelapse" --resolution 1440p --duration 10 --audio
# Custom output directory
python scripts/tensorslab_video.py "a sunset timelapse" --output-dir ./my_videos
Task Status Flow
| Status | Code | Meaning |
|---|
| Pending | 1 | Task waiting in queue |
| Processing | 2 | Currently generating |
| Completed | 3 | Done, video ready |
| Failed | 4 | Error occurred |
| Uploading | 5 | Uploading generated video |
Error Handling
Translate API errors to user-friendly messages:
Output
All videos are saved to output directory with naming pattern:
- Default: (current working directory)
- Custom: Use or to specify a different path
- Naming: - e.g.,
URL mapping: The script also saves file-to-URL mappings in
./tensorslab_output/urls.yaml
. This file tracks the original URLs for each downloaded file and accumulates entries across multiple runs. When you need the original URL of a generated video, read this file.
yaml
# Example urls.yaml content
abcd_1234567890_0.mp4: https://tensorai.tensorslab.com/videos/abcd_1234567890_0.mp4
After completion, inform user:
🎉 您的视频处理完毕!已存放于 ./tensorslab_output/{filename}
Tips for Better Results
Text-to-Video
- Include cinematic terms: "wide shot", "close-up", "pan", "dolly"
- Describe motion: "flying rapidly", "slowly drifting", "zooming in"
- Specify style: "cinematic", "documentary style", "dreamy"
Image-to-Video
- Describe the desired motion: "gentle sway", "subtle movement"
- For landscapes: "clouds moving", "water flowing", "leaves rustling"
Resources
- scripts/tensorslab_video.py: Main API client with full CLI support
- references/api_reference.md: Detailed API documentation