Skip to content

Text-to-Video

Introduction

As artificial intelligence technology continues to advance, Text-to-Video (TTV) models are gradually becoming an essential tool in the field of content creation. These models transform input text into dynamic videos, endowing words with visual effects and expanding the dimensions of expression. Not only do they help creators save significant time, but they also generate high-quality, creative visual content. The potential of Text-to-Video models has been fully demonstrated in various application scenarios, including education, advertising, and entertainment.

Next, we will explore some best practices for Text-to-Video models to help you better utilize this cutting-edge technology in practical operations.

Best Practices

Using MaaS Haiper Video as an example

Send Request

Generate Video
curl -X POST "https://genaiapi.cloudsway.net/v1/ai/LPUqHEAjfon/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"
        }
      }'

The generated video has a default resolution of 720P, but you can also choose to upgrade the video resolution to 1080P.

Increase Video Resolution

Increasing the video resolution upgrades it from the default 720P to 1080P. This operation is equivalent to regenerating a video (with the same duration), and will incur additional charges.

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"
        }
      }'
Extend Video Duration

Can be extended up to 16 seconds; please enter the desired extension duration (extendDuration) in the request below.

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
        }
      }'

return taskid

The above requests will return a taskid

{
  "taskId": "1234abcd"
}

Query Video Task Result

Use the returned taskid to query the video task result.

curl -X GET "https://genaiapi.cloudsway.net/v1/ai/LPUqHEAjf/video/tasks/1234abcd" \
  -H "Authorization: Bearer RWxxxxxxxx0Gd"

Response

progress represents the task progress, and when progress is 1, it means completion. Visit mediaurl to retrieve the video link.

{
  "status": "SUCCESS",
  "mediaUrl": "https://generated-video-url.mp4",
  "expireTime": 1724241996259,
  "progress": 0.85
}