Skip to content

图生视频-基于首帧

阿里百炼图生视频接口(基于首帧),用于通过首帧图像和文本提示生成视频。


概览

  • 请求方法:POST
  • 请求路径:/task/bailian/image2video
  • 内容类型:application/json
  • 分类:视频模型(Video)/阿里百炼

认证方式

  • Header:Authorization: Bearer <token>

请求参数

字段类型必填描述
modelstring模型名称,支持 wan2.6-i2vwan2.6-i2v-flashwan2.5-i2v-preview
input.promptstring文本提示词,描述视频期望元素和视觉特点
input.img_urlstring首帧图片 URL 或 Base64 数据,图片尺寸需与输出尺寸保持一致
input.audio_urlstring音频文件 URL,支持 wav、mp3,时长 3~30s,文件不超过 15MB
input.negative_promptstring反向提示词,描述不希望出现的内容
input.templatestring视频特效模板名称
parameters.prompt_extendboolean是否开启 prompt 智能改写,默认 true
parameters.durationinteger视频时长(秒),具体取值依赖模型
parameters.shot_typestring镜头类型,singlemulti,仅在 prompt_extend=true 时生效
parameters.seedinteger随机种子,范围 [0,2147483647]
parameters.resolutionstring输出分辨率档位,支持 480P720P1080P 等,具体可用值依赖模型
parameters.audioboolean是否生成有声视频,仅支持 wan2.6-i2v-flash,无声视频可省费用

请求示例

curl 示例

bash
curl -X POST "https://api.gpt.ge/task/bailian/image2video" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $YOUR_TOKEN" \
  -d '{
    "model": "wan2.6-i2v-flash",
    "input": {
      "prompt": "一幅都市奇幻艺术的场景。一个充满动感的涂鸦艺术角色。一个由喷漆所画成的少年,正从一面混凝土墙上活过来。他一边用极快的语速演唱一首英文rap,一边摆着一个经典的、充满活力的说唱歌手姿势。场景设定在夜晚一个充满都市感的铁路桥下。灯光来自一盏孤零零的街灯,营造出电影般的氛围,充满高能量和惊人的细节。视频的音频部分完全由少年的rap构成,没有其他对话或杂音。",
      "img_url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/wpimhv/rap.png"
    },
    "parameters": {
      "resolution": "720P",
      "prompt_extend": true,
      "duration": 5,
      "audio": true
    }
  }'

JavaScript (fetch) 示例

javascript
fetch('https://api.gpt.ge/task/bailian/image2video', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer YOUR_TOKEN'
  },
  body: JSON.stringify({
    model: 'wan2.6-i2v-flash',
    input: {
      prompt: '一幅都市奇幻艺术的场景。一个充满动感的涂鸦艺术角色。一个由喷漆所画成的少年,正从一面混凝土墙上活过来。他一边用极快的语速演唱一首英文rap,一边摆着一个经典的、充满活力的说唱歌手姿势。场景设定在夜晚一个充满都市感的铁路桥下。灯光来自一盏孤零零的街灯,营造出电影般的氛围,充满高能量和惊人的细节。视频的音频部分完全由少年的rap构成,没有其他对话或杂音。',
      img_url: 'https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/wpimhv/rap.png'
    },
    parameters: {
      resolution: '720P',
      prompt_extend: true,
      duration: 5,
      audio: true
    }
  })
})
  .then(res => res.json())
  .then(console.log)

Python 示例(requests)

python
import requests

payload = {
    'model': 'wan2.6-i2v-flash',
    'input': {
        'prompt': '一幅都市奇幻艺术的场景。一个充满动感的涂鸦艺术角色。一个由喷漆所画成的少年,正从一面混凝土墙上活过来。他一边用极快的语速演唱一首英文rap,一边摆着一个经典的、充满活力的说唱歌手姿势。场景设定在夜晚一个充满都市感的铁路桥下。灯光来自一盏孤零零的街灯,营造出电影般的氛围,充满高能量和惊人的细节。视频的音频部分完全由少年的rap构成,没有其他对话或杂音。',
        'img_url': 'https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/wpimhv/rap.png'
    },
    'parameters': {
        'resolution': '720P',
        'prompt_extend': True,
        'duration': 5,
        'audio': True
    }
}

resp = requests.post(
    'https://api.gpt.ge/task/bailian/image2video',
    headers={
        'Content-Type': 'application/json',
        'Authorization': 'Bearer YOUR_TOKEN'
    },
    json=payload
)
print(resp.json())

返回字段说明

字段类型描述
request_idstring请求 ID
outputobject输出任务信息
output.task_idstring任务 ID
output.task_statusstring任务状态

返回示例(200)

json
{
  "request_id": "9f829e8a-6db3-4998-8515-134223f0fc11",
  "output": {
    "task_id": "ac22cbc8-3fb3-45b6-9091-d8a7b41650bc",
    "task_status": "PENDING"
  }
}