API Reference
OpenAI Video Format (Sora Format) Generate videos by calling the OpenAI video generation interface, supporting models like Sora, and also supporting the use of the OpenAI video format to call...
Generate videos by calling the OpenAI video generation interface, supporting models like Sora, and also supporting the use of the OpenAI video format to call Kling, Jimeng, and Vidu.
Parameter Type Required Description Authorization string Yes User Authentication Token (Bearer: sk-xxxx)
Parameter Type Required Description prompt string Yes Text prompt describing the video to be generated model string No Video generation model, defaults to sora-2 seconds string No Video duration (seconds), defaults to 4 seconds size string No Output resolution, format is width x height, defaults to 720x1280 input_reference file No Input image file (used for Image-to-Video), the input image must match the corresponding width and height (size) metadata string No Extended parameters (JSON string format)
The purpose of the metadata parameter is to pass parameters specific to non-Sora models, such as Aliyun Wanxiang's image URL, watermark, and prompt intelligent rewriting. The format of the metadata parameter is a JSON string, for example:
{
"img_url" : "https://example.com/image.jpg" ,
"watermark" : false ,
"prompt_extend" : true
}
curl https://api.zipflow.xyz/v1/videos \
-H "Authorization: Bearer sk-xxxx" \
-F "prompt=一个穿着宇航服的宇航员在月球上行走, 高品质, 电影级" \
-F "model=sora-2" \
-F "seconds=5" \
-F "size=1920x1080"
curl https://api.zipflow.xyz/v1/videos \
-H "Authorization: Bearer sk-xxxx" \
-F "prompt=猫咪慢慢睁开眼睛,伸懒腰" \
-F "model=sora-2" \
-F "seconds=3" \
-F "size=1920x1080" \
-F "input_reference=@/path/to/cat.jpg"
curl https://api.zipflow.xyz/v1/videos \
-H "Authorization: Bearer sk-xxxx" \
-F "prompt=一只可爱的小猫在花园里玩耍,阳光明媚,色彩鲜艳" \
-F "model=wan2.5-t2v-preview" \
-F "seconds=5" \
-F "size=1920*1080"
curl https://api.zipflow.xyz/v1/videos \
-H "Authorization: Bearer sk-xxxx" \
-F "prompt=让这张图片动起来,添加自然的运动效果" \
-F "model=wan2.5-i2v-preview" \
-F "seconds=5" \
-F "size=1280P" \
-F 'metadata={"img_url":"https://example.com/image.jpg"}'
{
"id" : "video_123" ,
"object" : "video" ,
"model" : "sora-2" ,
"created_at" : 1640995200 ,
"status" : "processing" ,
"progress" : 0
}
Field Type Description id string Video Task ID object string Object type, fixed as "video" model string Name of the model used created_at integer Creation timestamp status string Task status (processing: in progress) progress integer Generation progress percentage
Query the status and result of the video generation task based on the Task ID
GET /v1/videos/{video_id}
Parameter Type Required Description video_id string Yes Video Task ID
curl 'https://api.zipflow.xyz/v1/videos/video_123' \
-H "Authorization: Bearer sk-xxxx"
{
"id" : "video_123" ,
"object" : "video" ,
"model" : "sora-2" ,
"created_at" : 1640995200 ,
"status" : "succeeded" ,
"progress" : 100 ,
"expires_at" : 1641081600 ,
"size" : "1920x1080" ,
"seconds" : "5" ,
"quality" : "standard"
}
Field Type Description id string Video Task ID object string Object type, fixed as "video" model string Name of the model used created_at integer Creation timestamp status string Task status (processing: in progress, succeeded: successful, failed: failed) progress integer Generation progress percentage expires_at integer Resource expiration timestamp size string Video resolution seconds string Video duration (seconds) quality string Video quality url string Video download link (upon completion)
Retrieve detailed information about the video generation task based on the Task ID
GET /v1/videos/{video_id}
Parameter Type Required Description video_id string Yes Identifier of the video task to retrieve
curl 'https://api.zipflow.xyz/v1/videos/video_123' \
-H "Authorization: Bearer sk-xxxx"
{
"id" : "video_123" ,
"object" : "video" ,
"model" : "sora-2" ,
"created_at" : 1640995200 ,
"status" : "succeeded" ,
"progress" : 100 ,
"expires_at" : 1641081600 ,
"size" : "1920x1080" ,
"seconds" : "5" ,
"quality" : "standard" ,
"remixed_from_video_id" : null ,
"error" : null
}
Field Type Description id string Unique identifier for the video task object string Object type, fixed as "video" model string Name of the model generating the video status string Current lifecycle status of the video task progress integer Approximate completion percentage of the generation task created_at integer Unix timestamp (seconds) when the task was created expires_at integer Unix timestamp (seconds) when the downloadable resource expires, if set size string Resolution of the generated video seconds string Duration (seconds) of the generated video clip quality string Video quality remixed_from_video_id string Identifier of the source video if this video is a remix error object Object containing error information if generation failed
Download the completed video content
GET /v1/videos/{video_id}/content
Parameter Type Required Description video_id string Yes Identifier of the video to download
Parameter Type Required Description variant string No Type of downloadable resource to return, defaults to MP4 video
curl 'https://api.zipflow.xyz/v1/videos/video_123/content' \
-H "Authorization: Bearer sk-xxxx" \
-o "video.mp4"
Directly returns the video file stream, Content-Type is video/mp4
Field Description Content-Type Video file type, usually video/mp4 Content-Length Video file size (bytes) Content-Disposition File download information
{
"error" : {
"message" : "string" ,
"type" : "invalid_request_error"
}
}
{
"error" : {
"message" : "string" ,
"type" : "invalid_request_error"
}
}
{
"error" : {
"message" : "string" ,
"type" : "invalid_request_error"
}
}
{
"error" : {
"message" : "string" ,
"type" : "invalid_request_error"
}
}
{
"error" : {
"message" : "string" ,
"type" : "server_error"
}
}
sora-2: Sora video generation model
Aliyun Wanxiang (Ali Wan): Uses wan2.5-t2v-preview (Text-to-Video), wan2.5-i2v-preview (Image-to-Video), wan2.2-i2v-flash, wan2.2-i2v-plus, wanx2.1-i2v-plus, wanx2.1-i2v-turbo
Kling AI (Kling): Uses kling-v1, kling-v2-master
Jimeng: Uses jimeng_vgfm_t2v_l20, jimeng_vgfm_i2v_l20
Vidu: Uses viduq1
Text-to-Video (t2v) : Generates video using only a text prompt
Image-to-Video (i2v) : Generates video using a text prompt + image
Keyframe-to-Video (kf2v) : Generates video by specifying the first and last frame images
Audio Generation (s2v) : Supports combining audio with video
480P : 832×480, 480×832, 624×624
720P : 1280×720, 720×1280, 960×960, 1088×832, 832×1088
1080P : 1920×1080, 1080×1920, 1440×1440, 1632×1248, 1248×1632
watermark: Whether to add a watermark (default false)
prompt_extend: Whether to enable prompt intelligent rewriting (default true)
audio: Whether to add audio (only supported by wan2.5)
seed: Random seed
wan2.5-i2v-preview : Wanxiang 2.5 preview version, supports video with sound, recommended
wan2.2-i2v-flash : Wanxiang 2.2 Flash version, fast generation speed, silent video
wan2.2-i2v-plus : Wanxiang 2.2 Pro version, higher image quality, silent video
wanx2.1-i2v-plus : Wanxiang 2.1 Pro version, stable version
wanx2.1-i2v-turbo : Wanxiang 2.1 Turbo version
Request Format : Use multipart/form-data format, which is the official OpenAI recommended method
input_reference Parameter : Used for Image-to-Video functionality, use the @filename syntax when uploading an image file
Prompt Optimization : Use detailed and specific descriptive words, including style and quality requirements
Parameter Settings : Set duration and resolution reasonably according to requirements
Aliyun Wanxiang Special Instructions :
Direct file upload is not supported , all resources are passed via URL
Use the metadata parameter to pass all extended parameters (JSON string format)
Image-to-Video uses metadata.img_url to pass the image URL
Keyframe-to-Video uses metadata.first_frame_url and metadata.last_frame_url
Error Handling : Implement appropriate retry mechanisms and error handling
Asynchronous Processing : Video generation is an asynchronous task, requiring polling for status checks
Resource Management : Download and clean up unnecessary video files promptly
async function generateVideoWithFormData () {
const formData = new FormData ();
formData. append ( 'prompt' , '一个穿着宇航服的宇航员在月球上行走, 高品质, 电影级' );
formData. append ( 'model' , 'sora-2' );
formData. append ( 'seconds' , '5' );
formData. append ( 'size' , '1920x1080' );
const response = await fetch ( 'https://api.zipflow.xyz/v1/videos' , {
method: 'POST' ,
headers: {
'Authorization' : 'Bearer sk-xxxx'
},
body: formData
});
const result = await response. json ();
return result.id;
}
// Image-to-Video Example
async function generateVideoWithImage () {
const formData = new FormData ();
formData. append ( 'prompt' , '猫咪慢慢睁开眼睛,伸懒腰' );
formData. append ( 'model' , 'sora-2' );
formData. append ( 'seconds' , '3' );
formData. append ( 'size' , '1920x1080' );
// 添加图片文件
const imageFile = document. getElementById ( 'imageInput' ).files[ 0 ];
formData. append ( 'input_reference' , imageFile);
const response = await fetch ( 'https://api.zipflow.xyz/v1/videos' , {
method: 'POST' ,
headers: {
'Authorization' : 'Bearer sk-xxxx'
},
body: formData
});
const result = await response. json ();
return result.id;
}
// Aliyun Wanxiang Text-to-Video
async function generateAliVideo () {
const formData = new FormData ();
formData. append ( 'prompt' , '一只可爱的小猫在花园里玩耍,阳光明媚,色彩鲜艳' );
formData. append ( 'model' , 'wan2.5-t2v-preview' );
formData. append ( 'seconds' , '5' );
formData. append ( 'size' , '1920*1080' );
formData. append ( 'metadata' , JSON . stringify ({
watermark: false ,
prompt_extend: true
}));
const response = await fetch ( 'https://api.zipflow.xyz/v1/videos' , {
method: 'POST' ,
headers: {
'Authorization' : 'Bearer sk-xxxx'
},
body: formData
});
const result = await response. json ();
return result.id;
}
// Aliyun Wanxiang Image-to-Video
async function generateAliImageToVideo () {
const formData = new FormData ();
formData. append ( 'prompt' , '让这张图片动起来,添加自然的运动效果' );
formData. append ( 'model' , 'wan2.5-i2v-preview' );
formData. append ( 'seconds' , '3' );
formData. append ( 'resolution' , '720P' );
formData. append ( 'input_reference' , imageFile);
formData. append ( 'metadata' , JSON . stringify ({
watermark: false ,
prompt_extend: true
}));
const response = await fetch ( 'https://api.zipflow.xyz/v1/videos' , {
method: 'POST' ,
headers: {
'Authorization' : 'Bearer sk-xxxx'
},
body: formData
});
const result = await response. json ();
return result.id;
}
// Aliyun Wanxiang Keyframe-to-Video
async function generateAliKeyframeVideo () {
const formData = new FormData ();
formData. append ( 'prompt' , '从开始到结束的平滑过渡动画' );
formData. append ( 'model' , 'wan2.2-kf2v-flash' );
formData. append ( 'seconds' , '4' );
formData. append ( 'metadata' , JSON . stringify ({
first_frame_url: 'https://example.com/start.jpg' ,
last_frame_url: 'https://example.com/end.jpg' ,
resolution: '720P' ,
watermark: false
}));
const response = await fetch ( 'https://api.zipflow.xyz/v1/videos' , {
method: 'POST' ,
headers: {
'Authorization' : 'Bearer sk-xxxx'
},
body: formData
});
const result = await response. json ();
return result.id;
}