Skip to content

任务:拓展视频

luma 视频拓展接口,用于对已生成任务进行视频拓展。


概览

  • 请求方法:POST
  • 请求路径:/luma/generations/{task_id}/extend
  • 内容类型:application/json
  • 分类:视频模型(Video)/luma视频

认证方式

  • Header:Authorization: Bearer <token>

路径参数

参数类型必填描述
task_idstring已生成视频的任务 ID

请求参数

JSON 请求体字段

字段类型必填描述
user_promptstring拓展提示词
expand_promptboolean是否开启 prompt 优化
image_urlstring参考图,支持第三方图片地址或 Base64
image_end_urlstring关键帧图,支持第三方图片地址或 Base64
notify_hookstring回调地址

请求示例

curl 示例

bash
curl -X POST "https://api.gpt.ge/luma/generations/your_task_id/extend" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $YOUR_TOKEN" \
  -d '{
    "user_prompt": "add cat",
    "expand_prompt": true,
    "image_url": "https://example.com/reference.png",
    "image_end_url": "https://example.com/keyframe.png",
    "notify_hook": "https://example.com/hook"
  }'

JavaScript (fetch) 示例

javascript
fetch('https://api.gpt.ge/luma/generations/your_task_id/extend', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer YOUR_TOKEN'
  },
  body: JSON.stringify({
    user_prompt: 'add cat',
    expand_prompt: true,
    image_url: 'https://example.com/reference.png',
    image_end_url: 'https://example.com/keyframe.png',
    notify_hook: 'https://example.com/hook'
  })
})
  .then(res => res.json())
  .then(console.log)

Python 示例(requests)

python
import requests

resp = requests.post(
    'https://api.gpt.ge/luma/generations/your_task_id/extend',
    headers={
        'Content-Type': 'application/json',
        'Authorization': 'Bearer YOUR_TOKEN'
    },
    json={
        'user_prompt': 'add cat',
        'expand_prompt': True,
        'image_url': 'https://example.com/reference.png',
        'image_end_url': 'https://example.com/keyframe.png',
        'notify_hook': 'https://example.com/hook'
    }
)
print(resp.json())

返回字段说明

字段类型描述
idstring任务 ID
promptstring提交的提示词
statestring任务状态
created_atstring创建时间
videonull视频结果,暂未生成时为 null
likednull点赞信息,当前为 null
estimate_wait_secondsnull预计等待时间,当前为 null

返回示例(200)

json
{
  "id": "9d4b7516-77e5-481a-b015-48313946f33b",
  "prompt": "cat dance",
  "state": "pending",
  "created_at": "2024-07-01T07:35:13.498660Z",
  "video": null,
  "liked": null,
  "estimate_wait_seconds": null
}