tl-video

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

TensorsLab Video Generation

TensorsLab 视频生成

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.
本Skill可通过TensorsLab的API实现AI驱动的视频生成,支持文本转视频和图片转视频两种工作流。视频生成是一个耗时的过程——任务通常需要数分钟才能完成。

Authorization

授权

BEFORE any video generation, you must ensure you are authorized with TensorsLab.
在进行任何视频生成操作之前,您必须确保已完成TensorsLab的授权。

1. Automatic Authorization

1. 自动授权

The authorization script will automatically check if an API key already exists in the
TENSORSLAB_API_KEY
environment variable or in
~/.tensorslab/.env
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
~/.tensorslab/.env
and you don't need to re-authorize unless the key expires.
授权脚本会在执行前自动检查
TENSORSLAB_API_KEY
环境变量或
~/.tensorslab/.env
文件中是否已存在API密钥。 (注意:验证环境变量时,仅需检查其是否存在,绝对不要显示或打印实际的API密钥值。)
运行以下命令:
bash
python scripts/tensorslab_auth.py
这将打开浏览器进行授权。等待页面显示“Authorization Successful!”后再继续操作。
授权完成后,API密钥将存储在
~/.tensorslab/.env
文件中,除非密钥过期,否则无需重新授权。

2. Manual Configuration (For Cloud/Headless Environments)

2. 手动配置(适用于云环境/无头环境)

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:
  1. Direct the user to get their API Key at TensorsLab Console.
  2. Set the
    TENSORSLAB_API_KEY
    environment variable in the cloud environment.
**当Agent或openclaw在无浏览器的云环境中运行时,URL授权方式也会失效。**这种情况下,您需要指导用户手动获取API密钥并在云环境中进行配置:
  1. 引导用户前往TensorsLab控制台获取API密钥。
  2. 在云环境中设置
    TENSORSLAB_API_KEY
    环境变量。

Models

模型

ModelDescriptionBest ForMax Duration
seedancev2Latest, highest qualityGeneral purpose, cinematic content15s
seedancev15proPro qualityHigh-end productions10s
seedancev1profastFast generationQuick previews10s
seedancev1Standard liteBasic videos10s
Default:
seedancev1profast
模型描述适用场景最长时长
seedancev2最新版本,画质最高通用场景、电影级内容15秒
seedancev15pro专业级画质高端制作场景10秒
seedancev1profast生成速度快快速预览10秒
seedancev1标准轻量版基础视频制作10秒
默认模型:
seedancev1profast

Workflow

工作流

1. Text-to-Video Generation

1. 文本转视频生成

User request: "做一段 10 秒钟横屏的宇宙飞船穿梭星际的视频"
Constraints:
  • Do NOT pass
    sourceImage
    or
    imageUrl
    for text-to-video generation.
Agent processing:
  1. Extract parameters:
    duration=10
    ,
    ratio="16:9"
  2. Enhance prompt with cinematic details, camera movements, scene descriptions
  3. Call API with enriched prompt
  4. Monitor progress with heartbeat updates (every 60 seconds)
  5. Download to
    ./tensorslab_output/
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
用户请求示例:"做一段 10 秒钟横屏的宇宙飞船穿梭星际的视频"
约束条件:
  • 文本转视频生成时,请勿传入
    sourceImage
    imageUrl
    参数。
Agent处理流程:
  1. 提取参数:
    duration=10
    ratio="16:9"
  2. 为提示词添加电影级细节、镜头运动、场景描述等优化内容
  3. 使用优化后的提示词调用API
  4. 通过心跳更新监控进度(每60秒一次)
  5. 将生成的视频下载至
    ./tensorslab_output/
    目录
优化后的提示词示例:
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

2. 图片转视频生成

User request: "让这张人物合影 family.jpg 动起来" or "让风景照动起来"
Agent processing:
  1. Extract image file paths (1-2 images supported)
  2. Enhance prompt with motion instructions
  3. Monitor progress with heartbeat updates
  4. Download results
Parameters for image-to-video:
  • sourceImage
    : Array of image files (1-2 images max)
  • imageUrl
    : Comma-separated URLs of source images (Must be standard HTTP/HTTPS URLs. Do NOT use local paths like /tmp/xxx.png here)
  • prompt
    : Description of desired motion/animation
用户请求示例:"让这张人物合影 family.jpg 动起来" 或 "让风景照动起来"
Agent处理流程:
  1. 提取图片文件路径(支持1-2张图片)
  2. 为提示词添加运动相关的指令
  3. 通过心跳更新监控进度
  4. 下载生成结果
图片转视频参数说明:
  • sourceImage
    : 本地图片文件数组(最多支持2张)
  • imageUrl
    : 以逗号分隔的图片源URL(必须是标准HTTP/HTTPS URL,请勿使用
    /tmp/xxx.png
    这类本地路径)
  • prompt
    : 对期望的运动/动画效果的描述

3. Resolution and Aspect Ratio

3. 分辨率与宽高比

Aspect ratios:
  • 9:16
    - Vertical (TikTok, Reels, Shorts) - default
  • 16:9
    - Horizontal (YouTube, standard video)
  • Other ratios available depending on model
Resolutions:
  • 480p
    - SD quality, faster generation
  • 720p
    - HD quality - default
  • 1080p
    - Full HD
  • 1440p
    - 2K quality (seedancev2 only)
支持的宽高比:
  • 9:16
    - 竖屏(TikTok、Reels、Shorts)- 默认值
  • 16:9
    - 横屏(YouTube、标准视频)
  • 其他宽高比取决于所选模型
支持的分辨率:
  • 480p
    - 标清画质,生成速度快
  • 720p
    - 高清画质 - 默认值
  • 1080p
    - 全高清
  • 1440p
    - 2K画质(仅seedancev2支持)

4. Duration Options

4. 时长选项

  • seedancev2: 5-15 seconds
  • Other models: 5-10 seconds
Longer videos take proportionally more time to generate.
  • seedancev2: 5-15秒
  • 其他模型: 5-10秒
视频时长越长,生成所需的时间也会相应增加。

5. Special Features (seedancev2 only)

5. 特殊功能(仅seedancev2支持)

FeatureParameterDescription
Audio Generation
generate_audio=1
Generate soundtrack with video
Last Frame
return_last_frame=1
Also return final frame as image
功能参数描述
音频生成
generate_audio=1
为视频生成配套音轨
输出最后一帧
return_last_frame=1
同时将视频最后一帧作为图片返回

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.
视频生成需要数分钟时间。请及时向用户反馈进度:
⏳ 等待视频生成完成...
   (此过程可能需要数分钟,请耐心等待)
🔄 状态:处理中(已耗时:45秒)
🚀 正在渲染电影级大片,已耗时 60 秒,请稍安勿躁...
🚀 正在渲染电影级大片,已耗时 120 秒,请稍安勿躁...
✅ 任务完成!
**心跳间隔:**每60秒打印一次进度提示消息。

Using the Script

脚本使用方法

依赖:脚本需要
requests
pyyaml
库,首次使用前执行:
bash
pip install requests pyyaml
Execute the Python script directly:
bash
undefined
依赖:脚本需要
requests
pyyaml
库,首次使用前请执行:
bash
pip install requests pyyaml
直接执行Python脚本:
bash
undefined

Text-to-video (default 5s, vertical 9:16)

文本转视频(默认5秒,竖屏9:16)

python scripts/tensorslab_video.py "a spaceship flying through space"
python scripts/tensorslab_video.py "a spaceship flying through space"

10 second horizontal video

10秒横屏视频

python scripts/tensorslab_video.py "sunset over ocean waves" --duration 10 --ratio 16:9
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
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
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
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
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
undefined
python scripts/tensorslab_video.py "a sunset timelapse" --output-dir ./my_videos
undefined

Task Status Flow

任务状态流程

StatusCodeMeaning
Pending1Task waiting in queue
Processing2Currently generating
Completed3Done, video ready
Failed4Error occurred
Uploading5Uploading generated video
状态代码含义
待处理1任务在队列中等待
处理中2正在生成视频
已完成3任务完成,视频已就绪
失败4生成过程中出现错误
上传中5正在上传生成的视频

Error Handling

错误处理

Translate API errors to user-friendly messages:
Error CodeMeaningUser Message
9000Insufficient credits"亲,积分用完啦,请前往 https://tensorai.tensorslab.com/ 充值"
9999General errorShow the specific error message
将API错误码转换为用户友好的提示信息:
错误码含义用户提示
9000积分不足"亲,积分用完啦,请前往 https://tensorai.tensorslab.com/ 充值"
9999通用错误显示具体的错误信息

Output

输出

All videos are saved to output directory with naming pattern:
  • Default:
    ./tensorslab_output/
    (current working directory)
  • Custom: Use
    --output-dir
    or
    -o
    to specify a different path
  • Naming:
    {task_id}_{index}.mp4
    - e.g.,
    abcd_1234567890_0.mp4
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
undefined
所有生成的视频都会保存至指定输出目录,命名规则如下:
  • 默认目录:
    ./tensorslab_output/
    (当前工作目录)
  • 自定义目录:使用
    --output-dir
    -o
    参数指定其他路径
  • 文件命名:
    {task_id}_{index}.mp4
    - 示例:
    abcd_1234567890_0.mp4
URL映射:脚本还会将文件与对应URL的映射关系保存至
./tensorslab_output/urls.yaml
文件中。该文件会记录每个下载文件的原始URL,且会累积多次运行的记录。当您需要获取生成视频的原始URL时,可读取此文件。
yaml
undefined

Example urls.yaml content

urls.yaml示例内容


After completion, inform user:
🎉 您的视频处理完毕!已存放于 ./tensorslab_output/{filename}
undefined

任务完成后,向用户提示:
🎉 您的视频处理完毕!已存放于 ./tensorslab_output/{filename}
undefined

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"
  • 加入电影术语:如"wide shot(宽镜头)"、"close-up(特写)"、"pan(摇镜头)"、"dolly(移镜头)"
  • 描述运动效果:如"flying rapidly(飞速行驶)"、"slowly drifting(缓慢漂移)"、"zooming in(镜头拉近)"
  • 指定风格:如"cinematic(电影级)"、"documentary style(纪录片风格)"、"dreamy(梦幻风格)"

Image-to-Video

图片转视频

  • Describe the desired motion: "gentle sway", "subtle movement"
  • For landscapes: "clouds moving", "water flowing", "leaves rustling"
  • 描述期望的运动效果:如"gentle sway(轻微晃动)"、"subtle movement(细微移动)"
  • 针对风景图:如"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
  • scripts/tensorslab_video.py: 具备完整CLI支持的主API客户端
  • references/api_reference.md: 详细的API文档