跳转到主要内容

Luma

Luma Dream Machine 提供高质量的视频生成能力。官方文档:docs.lumalabs.ai

创建视频

POST /luma/generations

请求参数

参数类型必填说明
user_promptstring视频描述提示词
model_namestring模型名称:ray-v1ray-v2
durationstring视频时长(秒)
resolutionstring分辨率:540p720p1080p
expand_promptboolean是否自动扩展提示词
image_urlstring首帧参考图片 URL
image_end_urlstring尾帧参考图片 URL

请求示例

curl -X POST https://crazyrouter.com/luma/generations \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "user_prompt": "A drone shot flying over a tropical island with crystal clear water",
    "model_name": "ray-v2",
    "duration": "5",
    "resolution": "720p",
    "expand_prompt": true
  }'

响应示例

{
  "id": "luma_gen_abc123",
  "state": "queued",
  "created_at": "2024-03-01T12:00:00Z"
}

图生视频

传入 image_url 作为首帧:
{
  "user_prompt": "The person in the image starts walking forward",
  "model_name": "ray-v2",
  "image_url": "https://example.com/portrait.jpg"
}
首尾帧模式:
{
  "user_prompt": "Smooth transition between two scenes",
  "model_name": "ray-v2",
  "image_url": "https://example.com/start.jpg",
  "image_end_url": "https://example.com/end.jpg"
}

查询任务

GET /luma/generations/{task_id}
cURL
curl https://crazyrouter.com/luma/generations/luma_gen_abc123 \
  -H "Authorization: Bearer YOUR_API_KEY"

响应示例

{
  "id": "luma_gen_abc123",
  "state": "completed",
  "created_at": "2024-03-01T12:00:00Z",
  "video": {
    "url": "https://storage.cdn-luma.com/...",
    "download_url": "https://storage.cdn-luma.com/..."
  }
}

延长视频

POST /luma/generations/{task_id}/extend
延长已完成的视频。
cURL
curl -X POST https://crazyrouter.com/luma/generations/luma_gen_abc123/extend \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "user_prompt": "Continue the drone shot, camera pans to reveal a beach resort"
  }'

任务状态

状态说明
queued排队中
dreaming生成中
completed已完成
failed失败