LTX-2 AI
LTX-2 开发者参考

LTX-2 API 文档

创建异步文生视频或图生视频任务,再轮询返回的任务 ID,直到视频生成完成。

基础 URLhttps://ltx-2ai.com
管理 API Key

身份验证

将 API Key 作为 Bearer Token 发送。请求包含 JSON 正文时,还需携带 Content-Type: application/json。

HTTP headers
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json

视频生成是异步任务。建议每 5-10 秒轮询一次 status;更短的间隔只会增加负载,不会让任务更快完成。

创建视频任务

POSThttps://ltx-2ai.com/api/video/ltx-2/generate

创建 LTX-2 任务并立即返回 task_id。本页覆盖文生视频和图生视频请求。

生成模式

文生视频

只发送 prompt,不发送 image;输出画幅由 aspect_ratio 控制。

图生视频

发送 prompt 和公网可访问的图片 URL;输出画幅由输入图片决定。

参数

名称类型必填说明
typestring可选:text-to-video 或 image-to-video。省略时,提供 image 即自动选择图生视频。
promptstring视频描述,长度 3-2000 个字符;两种模式均必填。
imagestring公网图片 URL。图生视频必填;同时兼容 image_url 和 imageUrl。
resolutionstring480p、720p 或 1080p,默认 720p。
aspect_ratiostring文生视频支持 16:9 或 9:16,默认 16:9。
durationinteger视频时长 5-20 秒,默认 5 秒。
seedinteger随机种子;使用 -1 获得随机结果。
publicboolean任务是否可以出现在公共画廊。

请求示例

cURL
curl --request POST \
  --url https://ltx-2ai.com/api/video/ltx-2/generate \
  --header 'Authorization: Bearer YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
    "type": "image-to-video",
    "prompt": "The subject turns toward the camera and smiles naturally",
    "image": "https://example.com/input.jpg",
    "resolution": "720p",
    "duration": 5,
    "seed": -1
  }'

响应示例

200 OK
{
  "code": 200,
  "message": "success",
  "data": {
    "task_id": "n50abc123def456ltx2",
    "status": "IN_PROGRESS",
    "consumed_credits": 24
  }
}

查询任务状态

GEThttps://ltx-2ai.com/api/video/ltx-2/status

通过 GET 查询参数发送 task_id,也支持使用 JSON 正文的 POST 请求。任务为 IN_PROGRESS 时继续轮询。

参数

名称类型必填说明
task_idstringgenerate 接口返回的任务 ID。

请求示例

cURL
curl --request GET \
  --url 'https://ltx-2ai.com/api/video/ltx-2/status?task_id=n50abc123def456ltx2' \
  --header 'Authorization: Bearer YOUR_API_KEY'

响应示例

200 OK
{
  "code": 200,
  "message": "success",
  "data": {
    "task_id": "n50abc123def456ltx2",
    "status": "SUCCESS",
    "consumed_credits": 24,
    "error_message": null,
    "created_at": "2026-08-07T12:00:00Z",
    "request": {
      "type": "image-to-video",
      "prompt": "The subject turns toward the camera and smiles naturally",
      "image": "https://example.com/input.jpg",
      "resolution": "720p",
      "duration": 5
    },
    "response": [
      "https://cdn.example.com/video.mp4"
    ]
  }
}

状态值

IN_PROGRESS

视频正在排队或渲染,请继续轮询。

SUCCESS

生成完成,response 数组中包含视频 URL。

FAILED

生成失败,请查看 error_message;任务服务会退回已扣积分。

错误响应

HTTP说明
400缺少必填参数或参数无效。
401Bearer API Key 缺失或无效。
404找不到该 task_id 对应的任务。
405接口不支持当前 HTTP 方法。
500生成或状态查询暂时异常,请稍后重试或联系支持。