典名词元DMTOKENSHome
API DocumentationThird-Party Tools Tutorial
AI Model APIVideoVidu

Single Image/First-Last Frame/Reference Frame/Intelligent Multi-Frame Video Generation VQ2P

POST/api/v1/video/generation

Header Parameters

Authorization*string

Format: Authorization: Bearer sk-xxxxxx

Request Body

application/json

_action*string

Fixed value i2v

model*string

Model name, supported: viduq2-pro

resolution?string

Resolution, supported: 540p / 720p / 1080p; default 720p for reference-to-video non-subject invocation mode; default 720p for reference-to-video subject invocation mode.

seed?integer

Random Seed

bgm?boolean

Whether to enable background music, default false. In the non-subject invocation mode for reference-to-video, the 9-second and 10-second durations do not take effect.

image*object

Image Information (supported only in single-image-to-video mode)

imageUrl*string

Image Link

prompt*string

Generated prompt text (for Smart Multi-frame Video Generation mode, use "placeholder text, just enter text as a placeholder (to be adjusted later)")

duration?integer

Video duration in seconds (not supported for intelligent multi-frame video generation). Single-image-to-video mode: [1,10]. First-and-last-frame-to-video mode: [1,8]. Reference-to-video non-subject invocation mode: [1,10]. Reference-to-video subject invocation mode: optional 0-10 (0 seconds for auto-recommendation).

voiceId?string

Voice ID (supported only in single-image-to-video mode)

headtailImages*object

First and last frame image information (only supported in reference-to-video mode)

headImage*string

First Frame Image Information

tailmage*string

Last Frame Image Information

characterImages*array<object>

Reference image information (supported only in reference-to-video non-subject invocation mode). Note: If no video is uploaded, 1-7 images are supported; if a video is uploaded, 1-4 images are supported.

[]?object
imageUrl*string

Image Link

videos*array<object>

Video Information (Supported only in non-subject invocation mode for reference-based video generation) Note: Supports uploading 1 to 2 videos.

[]?object
videoUrl*string

Video Link

mediaId*string

Media Asset ID

aspectRatio?string

Aspect ratio, default 16:9. Reference-to-video non-subject invocation mode: 16:9 / 9:16 / 3:4 / 4:3 / 1:1. Reference-to-video subject invocation mode supports: 16:9 / 9:16 / 1:1.

subjects*array<object>

Reference subject information (supported only in reference-to-video subject invocation mode) Note: serverId mode: the ID returned by the subject API; video, text, and image subjects can be used, with a maximum of 4 image or text subjects and up to 2 video subjects.

[]?object
images*array<object>

Refer to the main image information

[]?object
imageUrl*string

Image URL

serverId*string

Refer to the subject identifier information, which must be generated by calling the Create Subject API.

id*string

Identification information of the prompt, where @xxx is used in the prompt. When serverId is passed, the value of this parameter must be set to the elementName of the entity.

voiceId?string

Reference subject voice, optional

audio?boolean

Whether to enable audio (only supported in the reference-to-video subject invocation mode). false: Direct audio and video output is not required, outputting a silent video. true: Direct audio and video output is required, outputting a video with dialogue and background audio. Note 1: The voice_id parameter takes effect only when this parameter is set to true.

movementAmplitude?string

Motion amplitude, optional, defaults to auto (supported only in reference-to-video subject call mode): auto, small, medium, large

startImage*object

First frame image (used only in the intelligent multi-frame video generation mode, required. Note: Supports PNG, JPEG, JPG, and WEBP formats; image size must not exceed 50 MB; aspect ratio must be less than 1:4 or 4:1)

imageUrl*string

Image Link

imageSettings*array<object>

Smart Multi-Frame Configuration (used only in Smart Multi-Frame Video Generation mode, required. Note: Minimum 2 frames and maximum 9 frames per task)

[]?object
keyImage*object

Keyframe image, serving as the last frame of this video segment or the first frame of the next segment

imageUrl*string

Image Link

prompt?string

Extension prompt used to control the extended video content, with a maximum length of 1500 characters.

duration?integer

Multi-frame duration, the video duration between different keyframes, defaults to 5 seconds, with options ranging from 2 to 7 seconds.

metaData?string

Metadata identifier, JSON-formatted string, pass-through field (supported only in intelligent multi-frame video generation mode, optional)

callbackUrl?string

Callback URL (supported only in Smart Multi-Frame Video Generation mode, optional)

payload?string

Pass-through parameters without any processing, for data transmission only, up to 1048576 characters (supported only in intelligent multi-frame video generation mode, optional)

Response Body

application/json

Success

TypeScript Definitions

Use the response body type in TypeScript.

code*integer

Status Code

data*object

Data Object

urls*array<string>

Result Set

[]?string
usage*object

Usage Information

images*integer

Image Count

seconds*integer

Video Duration in Seconds

input_tokens*integer

Input Token Count

total_tokens*integer

Total Tokens

output_tokens*integer

Output token count

expired*string

Validity Period

task_id*string

Task ID

task_status*string

Task Status

message*string

Status Information

request_id*string

Request ID

curl -X POST "https://api.ygw.ai/api/v1/video/generation" \  -H "Authorization: string" \  -H "Content-Type: application/json" \  -d '{    "_action": "string",    "model": "string",    "image": {      "imageUrl": "string"    },    "prompt": "string",    "headtailImages": {      "headImage": "string",      "tailmage": "string"    },    "characterImages": [      {        "imageUrl": "string"      }    ],    "videos": [      {        "videoUrl": "string",        "mediaId": "string"      }    ],    "subjects": [      {        "images": [          {            "imageUrl": "string"          }        ],        "serverId": "string",        "id": "string"      }    ],    "startImage": {      "imageUrl": "string"    },    "imageSettings": [      {        "keyImage": {          "imageUrl": "string"        }      }    ]  }'
{
  "code": 0,
  "data": {
    "urls": [
      "string"
    ],
    "usage": {
      "images": 0,
      "seconds": 0,
      "input_tokens": 0,
      "total_tokens": 0,
      "output_tokens": 0
    },
    "expired": "string",
    "task_id": "string",
    "task_status": "string"
  },
  "message": "string",
  "request_id": "string"
}