Developer API / Video

视频生成 API

通过统一的 OpenAI-compatible 接口创建文生视频或图生视频任务,并轮询获取生成结果。不同模型使用同一套请求和查询流程。

POST /v1/videosGET /v1/videos/{task_id}Bearer Auth

快速调用

Base URL:https://api1.link-ai.cc/v1。创建任务成功后,通常每 3–5 秒查询一次状态。
POSThttps://api1.link-ai.cc/v1/videos
curl -X POST "https://api1.link-ai.cc/v1/videos" \
  -H "Authorization: Bearer sk-xxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "video-pro-720p",
    "prompt": "cinematic product commercial, smooth camera movement",
    "duration": 6,
    "aspect_ratio": "16:9"
  }'

图生视频

curl -X POST "https://api1.link-ai.cc/v1/videos" \
  -H "Authorization: Bearer sk-xxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "video-pro-720p",
    "prompt": "the subject slowly turns toward the camera",
    "duration": 6,
    "image": "https://your-cdn.com/reference.jpg",
    "aspect_ratio": "16:9"
  }'

常用模型

模型和权限可能随渠道调整,请以控制台模型列表或 GET /v1/models 的实时结果为准。

video-fast-480pvideo-mini-720pvideo-standard-720pvideo-fast-720pvideo-fast-720p-cheapvideo-pro-480pvideo-pro-720pvideo-pro-720p-cheapvideo-ultra-720pvideo-pro-1080pveo-3-1veo-omni-flashveo-omni-flash-video-editgrok-imagine-video-1.5-fastgrok-imagine-video-1.5-previewsora2

创建任务返回

提交成功会返回公开任务 ID。请保存 idtask_id,后续使用它查询进度。

{
  "id": "task_xxxxxxxxxxxxxxxxx",
  "task_id": "task_xxxxxxxxxxxxxxxxx",
  "object": "video",
  "model": "video-pro-720p",
  "status": "queued",
  "progress": 0,
  "created_at": 1785230000
}

查询任务

GEThttps://api1.link-ai.cc/v1/videos/{task_id}
curl "https://api1.link-ai.cc/v1/videos/task_xxxxxxxxxxxxxxxxx" \
  -H "Authorization: Bearer sk-xxxxxxxx"

完成示例

{
  "id": "task_xxxxxxxxxxxxxxxxx",
  "task_id": "task_xxxxxxxxxxxxxxxxx",
  "object": "video",
  "model": "video-pro-720p",
  "status": "completed",
  "progress": 100,
  "video_url": "https://cdn.example.com/generated/video.mp4",
  "cover_url": "https://cdn.example.com/generated/cover.jpg",
  "output": [
    {"type": "video", "url": "https://cdn.example.com/generated/video.mp4"}
  ]
}
生成结果 URL 可能有有效期。任务完成后请尽快下载并转存到你自己的对象存储。

请求参数

字段类型必填说明
modelstring模型 ID。可只替换模型名切换速度、清晰度或渠道。
promptstring视频内容描述;使用参考素材时应明确描述运动与镜头。
durationinteger视频秒数。可用值由模型决定,平台安全上限为 60 秒。
aspect_ratiostring常用值:16:99:161:14:33:4
sizestring部分模型使用尺寸,如 1280x720720x1280
imagestring单张公网 HTTPS 参考图 URL。
imagesstring[]多张参考图 URL。数量限制取决于模型。
extra_videosstring[]部分 Omni/编辑模型支持的参考视频。
extra_audiosstring[]部分模型支持的参考音频。
metadataobject供应商特定扩展参数。

状态与错误

状态含义建议
queued / pending等待处理继续轮询,建议间隔 3–5 秒。
in_progress / processing生成中读取 progress 展示进度。
completed任务完成video_urloutput 获取结果。
failed / cancelled任务失败读取 error.message,修正参数后重试。
{
  "error": {
    "message": "模型不可用或请求参数不受支持",
    "type": "invalid_request_error",
    "code": "upstream_error"
  }
}