Text-to-Video API
Version History
Version |
Date |
Changes |
v1.0 |
2024-08-29 |
Initial release |
MaaS Haiper Video
Parameter |
Description |
Example |
basePath |
The base path for calling the mass API, includes the fixed path /v1/ai |
https://genaiapi.cloudsway.net/v1/ai |
endpointPath |
A randomly generated path segment for calling the mass API |
LPUqHEAjfonOmohV |
AccessKey |
The access key for calling the mass API |
RWxxxxxxxx0Gd |
taskId |
The task ID for asynchronous video processing tasks |
1234abcd |
According to the above example, the final request path for the Generate Video
API is https://genaiapi.cloudsway.net/v1/ai/LPUqHEAjfonOmohV/video/generate
Generate Video
Request Method
POST
Request Path
{basePath}/{endpointPath}/video/generate
Parameter |
Description |
Example |
Authorization |
AccessKey Bearer ${AccessKey} |
Bearer RWxxxxxxxx0Gd |
Request Body
Field Name |
Type |
Required |
Description |
Example Value |
prompt |
String |
Yes |
Prompt for video generation |
"Generate a video of a sunset over the ocean." |
negativePrompt |
String |
No |
Negative prompt |
"Avoid dark and gloomy scenes." |
config |
Object |
No |
Configuration options |
|
- sourceImage |
URI |
No |
Public URL of the source image, supports http and https |
"https://demo.jpg" |
settings |
Object |
No |
Settings |
|
- seed |
Number |
No |
Default is -1, random seed for sampling |
42 |
- duration |
Number |
No |
Default is 2, duration of the output video, supports 2, 4, and 8 |
2 |
- aspectRatio |
String |
No |
Default is 16:9, valid values are (16:9, 9:16, 3:4, 4:3, 1:1) |
"16:9" |
Response
Field Name |
Type |
Description |
Example Value |
taskId |
String |
Unique identifier of the task |
"1234abcd" |
Example
Request
curl -X POST "https://genaiapi.cloudsway.net/v1/ai/LPUqHEAjfonOmohV/video/generate" \
-H "Authorization: Bearer RWxxxxxxxx0Gd" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Generate a video of a sunset over the ocean.",
"negativePrompt": "Avoid dark and gloomy scenes.",
"config": {
"sourceImage": "https://demo.jpg"
},
"settings": {
"seed": 42,
"duration": 2,
"aspectRatio": "16:9"
}
}'
Response
{
"taskId": "1234abcd"
}
Upscale Video
Request Method
POST
Request Path
{basePath}/{endpointPath}/video/upscale
Parameter |
Description |
Example |
Authorization |
AccessKey Bearer ${AccessKey} |
Bearer RWxxxxxxxx0Gd |
Request Body
Field Name |
Type |
Required |
Description |
Example Value |
config |
Object |
Yes |
Configuration options |
|
- sourceVideo |
URI |
Yes |
Public URL of the source video, supports http and https |
"https://demo.mp4" |
Response
Field Name |
Type |
Description |
Example Value |
taskId |
String |
Unique identifier of the task |
"1234abcd" |
Example
Request
curl -X POST "https://genaiapi.cloudsway.net/v1/ai/LPUqHEAjfonOmohV/video/upscale" \
-H "Authorization: Bearer RWxxxxxxxx0Gd" \
-H "Content-Type: application/json" \
-d '{
"config": {
"sourceVideo": "https://demo.mp4"
}
}'
Response
{
"taskId": "1234abcd"
}
Extend Video
Request Method
POST
Request Path
{basePath}/{endpointPath}/video/extend
Parameter |
Description |
Example |
Authorization |
AccessKey Bearer ${AccessKey} |
Bearer RWxxxxxxxx0Gd |
Request Body
Field Name |
Type |
Required |
Description |
Example Value |
prompt |
String |
No |
Prompt for video generation |
"Generate a video of a sunset over the ocean." |
negativePrompt |
String |
No |
Negative prompt |
"Avoid dark and gloomy scenes." |
config |
Object |
Yes |
Configuration options |
|
- sourceVideo |
URI |
Yes |
Public URL of the source video, supports http and https |
"https://demo.mp4" |
- extendDuration |
Number |
No |
Default is 4, duration to extend the video, supports 2 and 4 seconds |
4 |
settings |
Object |
No |
Settings |
|
- seed |
Number |
No |
Default is -1, random seed for sampling |
42 |
- guidanceScale |
Number |
No |
Default is 7.5, guidance scale setting |
7.5 |
Response
Field Name |
Type |
Description |
Example Value |
taskId |
String |
Unique identifier of the task |
"1234abcd" |
Example
Request
curl -X POST "https://genaiapi.cloudsway.net/v1/ai/LPUqHEAjfonOmohV/video/extend" \
-H "Authorization: Bearer RWxxxxxxxx0Gd" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Generate a video of a sunset over the ocean.",
"negativePrompt": "Avoid dark and gloomy scenes.",
"config": {
"sourceVideo": "https://demo.mp4",
"extendDuration": 4
},
"settings": {
"seed": 42,
"guidanceScale": 7.5
}
}'
Response
{
"taskId": "1234abcd"
}
Query Video Task Result
Request Method
GET
Request Path
{basePath}/{endpointPath}/video/tasks/{taskId}
Parameter |
Description |
Example |
Authorization |
AccessKey Bearer ${AccessKey} |
Bearer RWxxxxxxxx0Gd |
Path Variables
Field Name |
Type |
Description |
Example Value |
taskId |
String |
Unique identifier of the task |
"1234abcd" |
Response
Field Name |
Type |
Description |
Example Value |
status |
String |
Task status, possible values: PENDING , IN_PROGRESS , SUCCESS , FAIL |
SUCCESS |
mediaUrl |
String |
URL of the generated media file |
|
expireTime |
Number |
Timestamp of the URL expiration time |
1724241996259 |
progress |
Number |
Progress, 1 means completed |
0.85 |
Example
Request
curl -X GET "https://genaiapi.cloudsway.net/v1/ai/LPUqHEAjfonOmohV/video/tasks/1234abcd" \
-H "Authorization: Bearer RWxxxxxxxx0Gd"
Response
{
"status": "SUCCESS",
"mediaUrl": "https://generated-video-url.mp4",
"expireTime": 1724241996259,
"progress": 0.85
}