linkfox-aigc-videogen

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

AI 生视频(首尾帧/单图模式)

AI Video Generation (First/Last Frame/Single Image Mode)

根据原图(首帧)和可选尾帧图生成视频,支持多种 AI 视频模型,异步创建任务后轮询获取结果。
Generate videos based on the original image (first frame) and optional last frame image, supporting multiple AI video models. Asynchronously create tasks and poll to retrieve results.

核心特点

Core Features

  • 5 种模型选择:覆盖不同风格和时长需求。
  • 首尾帧控制:可选尾帧图控制视频结束画面。
  • 丰富参数:支持 Pro 模式、声音生成、运镜控制、宽高比等。
  • 异步模式:创建任务立即返回 taskId,脚本自动轮询直到完成(超时 20 分钟)。
  • 5 Model Options: Covers different style and duration requirements.
  • First/Last Frame Control: Optional last frame image to control the video's ending scene.
  • Rich Parameters: Supports Pro mode, sound generation, camera movement control, aspect ratio, etc.
  • Asynchronous Mode: Immediately returns
    taskId
    after task creation, and the script automatically polls until completion (timeout after 20 minutes).

模型说明

Model Description

模型(videoType)说明支持时长
KLING可灵5秒/10秒
WAN万相5秒/10秒/15秒
SEEDSeedance/豆包5秒/10秒/15秒
SEED_FASTSeedance 2.0 Fast5秒/10秒/15秒
HAILUO海螺6秒/10秒
Model (videoType)DescriptionSupported Duration
KLINGKeling5s/10s
WANWanxiang5s/10s/15s
SEEDSeedance/Doubao5s/10s/15s
SEED_FASTSeedance 2.0 Fast5s/10s/15s
HAILUOHailuo6s/10s

参数概览

Parameter Overview

  • 必填字段
    imageUrl
    videoType
    videoTime
  • 可选核心
    lastFrameImageUrl
    (尾帧图)、
    prompt
    (2000字以内)
完整参数表、响应字段结构与错误码,见
references/api.md
  • Required Fields:
    imageUrl
    ,
    videoType
    ,
    videoTime
  • Optional Core Fields:
    lastFrameImageUrl
    (last frame image),
    prompt
    (within 2000 characters)
Complete parameter table, response field structure and error codes can be found in
references/api.md
.

调用方式

Calling Methods

  • 创建任务
    POST /aigc/videoGenAsync
    → 返回
    {taskId}
  • 轮询结果
    POST /aigc/taskQuery
    → 传入
    {taskId}
    → 返回状态和结果
  • Python 脚本
    python scripts/aigc_videogen.py '<JSON 参数>'
    (脚本内部自动完成创建+轮询)
异步流程
  1. 脚本调用
    /aigc/videoGenAsync
    创建任务,获得
    taskId
  2. 等待 2 分钟后开始轮询
    /aigc/taskQuery
    ,每 10 秒一次,最长等待 20 分钟
  3. 成功后自动下载视频到会话
    media/
    目录
输出策略(脚本默认行为)
  • 脚本会自动把生成的视频下载转存到会话
    media/
    目录,stdout 输出一行
    Saved full response: <路径数组>
  • 原始 API 响应静默落盘到
    data/
    ,仅在无视频产物时才在 stdout 提示其路径。
读数据建议禁止 Read 转存的视频文件内容。直接把
Saved full response:
后的本地路径提供给用户即可。
  • Create Task:
    POST /aigc/videoGenAsync
    → Returns
    {taskId}
  • Poll for Results:
    POST /aigc/taskQuery
    → Pass in
    {taskId}
    → Returns status and results
  • Python Script:
    python scripts/aigc_videogen.py '<JSON parameters>'
    (the script automatically handles creation + polling internally)
Asynchronous Process:
  1. The script calls
    /aigc/videoGenAsync
    to create a task and obtains
    taskId
  2. Starts polling
    /aigc/taskQuery
    after waiting for 2 minutes, once every 10 seconds, with a maximum wait time of 20 minutes
  3. Automatically downloads the video to the session
    media/
    directory upon success
Output Strategy (Default Script Behavior):
  • The script automatically downloads and saves the generated video to the session
    media/
    directory, and outputs a line
    Saved full response: <path array>
    to stdout.
  • The original API response is silently saved to
    data/
    , and its path is only prompted in stdout when there is no video product.
Data Reading Suggestion: Do NOT read the content of the saved video file. Directly provide the local path after
Saved full response:
to the user.

解决认证和积分问题

Resolve Authentication and Points Issues

发生以下异常情况时,采用 references/onboarding.md 引导解决问题:
When the following exceptions occur, guide users to resolve them using references/onboarding.md:

异常情况

Exception Scenarios

  • 未配置API Key:环境变量未配置
    LINKFOX_AGENT_API_KEY
    ,也未配置
    LINKFOXAGENT_API_KEY
  • 响应401或402状态码
  • 响应提示积分或余额不足:消息含"积分余额不足/计费不足/余额不足/quota exceeded/insufficient balance/套餐到期/需充值/请充值",或类似含义的内容。
  • API Key Not Configured: The environment variable
    LINKFOX_AGENT_API_KEY
    or
    LINKFOXAGENT_API_KEY
    is not configured.
  • Response with 401 or 402 Status Code
  • Response Indicates Insufficient Points or Balance: Messages containing "insufficient points balance/insufficient billing/insufficient balance/quota exceeded/insufficient balance/package expired/need to recharge/please recharge" or similar meanings.

使用指引

Usage Guidelines

  1. 模型选择:一般商品视频用
    KLING
    ;长时长用
    WAN
    /
    SEED
  2. 首尾帧:传
    imageUrl
    (首帧,必传)+ 可选
    lastFrameImageUrl
    (尾帧),支持模型:KLING仅Pro / WAN / SEED。
  3. 时长匹配:必须传模型支持的时长值,否则报错。
  4. 提示词:可选,2000 字以内,描述期望的动态效果。
  1. Model Selection: Use
    KLING
    for general product videos; use
    WAN
    /
    SEED
    for longer durations.
  2. First/Last Frames: Pass
    imageUrl
    (first frame, required) + optional
    lastFrameImageUrl
    (last frame). Supported models: KLING (Pro mode only) / WAN / SEED.
  3. Duration Matching: Must pass a duration value supported by the model, otherwise an error will occur.
  4. Prompt: Optional, within 2000 characters, describing the desired dynamic effects.

示例

Examples

1. KLING — 商品展示
json
{"imageUrl": "https://example.com/product.jpg", "videoType": "KLING", "videoTime": 10, "prompt": "商品展示视频"}
3. WAN 万相 — 带声音和运镜
json
{"imageUrl": "https://example.com/scene.jpg", "videoType": "WAN", "videoTime": 15, "voice": true, "camera": "single"}
4. SEED — 高分辨率
json
{"imageUrl": "https://example.com/scene.jpg", "videoType": "SEED", "videoTime": 10, "resolution": "1080p", "aspectRatio": "16:9"}
1. KLING — Product Display
json
{"imageUrl": "https://example.com/product.jpg", "videoType": "KLING", "videoTime": 10, "prompt": "Product display video"}
3. WAN Wanxiang — With Sound and Camera Movement
json
{"imageUrl": "https://example.com/scene.jpg", "videoType": "WAN", "videoTime": 15, "voice": true, "camera": "single"}
4. SEED — High Resolution
json
{"imageUrl": "https://example.com/scene.jpg", "videoType": "SEED", "videoTime": 10, "resolution": "1080p", "aspectRatio": "16:9"}

展示规则

Display Rules

  • 只展示转存后的本地路径:把
    Saved full response:
    后的本地视频路径告诉用户,例如「视频已保存至:xxx/a.mp4」。
  • 禁止 Read 视频文件、禁止展示 base64 内容。
  • 禁止把原始 API 返回的临时 URL 直接给用户(带签名、会过期)。
  • Only Display Saved Local Path: Tell users the local video path after
    Saved full response:
    , e.g., "Video saved to: xxx/a.mp4".
  • Do NOT read video files, do NOT display base64 content.
  • Do NOT directly provide the temporary URL returned by the original API to users (it is signed and will expire).

限制

Limitations

  • 提示词最大 2000 字符。
  • 生成时间较长,通常 100-600 秒。脚本自动轮询,超时 20 分钟。
  • KLING 尾帧图仅 Pro 模式下支持。
  • 本接口仅支持单图/首尾帧模式。多参考图请使用
    linkfox-aigc-videogen-multi
  • 失败时不重试(仅尝试 1 次)。
  • Maximum prompt length is 2000 characters.
  • Generation time is relatively long, usually 100-600 seconds. The script automatically polls, with a timeout of 20 minutes.
  • KLING's last frame image is only supported in Pro mode.
  • This interface only supports single image/first-last frame mode. For multiple reference images, use
    linkfox-aigc-videogen-multi
    .
  • No retries on failure (only one attempt).

不适用

Not Applicable Scenarios

不适用
  • 多参考图生视频 →
    linkfox-aigc-videogen-multi
  • 图片生成 →
    linkfox-aigc-imagegen
  • 文本生成 →
    linkfox-aigc-textgen
Not applicable for:
  • Video generation with multiple reference images → Use
    linkfox-aigc-videogen-multi
  • Image generation → Use
    linkfox-aigc-imagegen
  • Text generation → Use
    linkfox-aigc-textgen

反馈

Feedback

参见
references/api.md
See
references/api.md
.