POST
/
v3
/
async
/
wan-t2v
curl --request POST \
  --url https://api.novita.ai/v3/async/wan-t2v \
  --header 'Authorization: <authorization>' \
  --header 'Content-Type: <content-type>' \
  --data '{
  "extra": {
    "webhook": {
      "url": "<string>",
      "test_mode": {
        "enabled": true,
        "return_task_status": "<string>"
      }
    }
  },
  "model_name": "<string>",
  "width": 123,
  "height": 123,
  "loras": [
    {
      "path": "<string>",
      "scale": {}
    }
  ],
  "seed": 123,
  "prompt": "<string>",
  "negative_prompt": "<string>",
  "steps": 123,
  "guidance_scale": 123,
  "flow_shift": 123
}'
{
  "task_id": "<string>"
}

Accelerated inference for Wan 2.1 14B Text-to-Video, a comprehensive and open suite of video foundation models that pushes the boundaries of video generation. By default, the API will generate a video with 5 seconds.

This is an asynchronous API; only the task_id will be returned. You should use the task_id to request the Task Result API to retrieve the video generation results.

Request Headers

Content-Type
string
required

Supports: application/json

Authorization
string
required

Bearer authentication format, for example: Bearer {{API Key}}.

Request Body

extra
object

Optional extra parameters for the request.

model_name
string
required

Name of the model checkpoint.

Supports: wan2.1-t2v.

width
integer
required

Width of the output video.

Supports: 480, 720, 832, 1280.

height
integer
required

Height of the output video.

Supports:

  • 832 for width of 480
  • 480 for width of 832
  • 720 for width of 1280
  • 1280 for width of 720
loras
object[]

LoRA models to be applied to the video generation.

Currently supports up to 3 LoRAs.

seed
integer
required

A seed is a number generates noise, which, makes generation deterministic. Using the same seed and set of parameters will produce identical content each time.

Range: -1 <= x <= 9999999999.

prompt
string
required

Prompt text required to guide the generation.

Range: 1 <= x <= 2000.

negative_prompt
string

Negative prompts instruct the model on what elements to avoid generating.

Range: 0 <= x <= 2000.

steps
integer

The number of inference steps.

Range: 1 <= x <= 40. Default: 30.

guidance_scale
float

Guidance scale parameter controls how closely the generated content follows the prompt.

Range: 0 <= x <= 10. Default: 5.0.

flow_shift
float

The flow_shift parameter primarily affects the speed and magnitude of object movement in the video. Higher values produce more pronounced and faster movement, while lower values make the motion slower and more subtle.

Range: 1 <= x <= 10. Default: 5.0.

Response

task_id
string
required

Use the task_id to request the Task Result API to retrieve the generated outputs.

Example

Here is an example of how to use the Wan 2.1 Text to Video API.

  1. Generate a task_id by sending a POST request to the Wan 2.1 Text to Video API.

Request:

curl --location 'https://api.novita.ai/v3/async/wan-t2v' \
--header 'Authorization: Bearer {{API Key}}' \
--header 'Content-Type: application/json' \
--data '{
    "model_name": "wan2.1-t2v",
    "height": 1280,
    "width": 720,
    "seed": -1,
    "prompt": "3D animation of a small, round, fluffy creature with big, expressive eyes explores a vibrant, enchanted forest. The creature, a whimsical blend of a rabbit and a squirrel, has soft blue fur and a bushy, striped tail. It hops along a sparkling stream, its eyes wide with wonder. The forest is alive with magical elements: flowers that glow and change colors, trees with leaves in shades of purple and silver, and small floating lights that resemble fireflies. The creature stops to interact playfully with a group of tiny, fairy-like beings dancing around a mushroom ring. The creature looks up in awe at a large, glowing tree that seems to be the heart of the forest."
}'

Response:

{
    "task_id": "{Returned Task ID}"
}
  1. Use task_id to get output videos.

HTTP status codes in the 2xx range indicate that the request has been successfully accepted, while status codes in the 5xx range indicate internal server errors.

You can get videos url in videos of response.

Request:

curl --location --request GET 'https://api.novita.ai/v3/async/task-result?task_id={Returned Task ID}' \
--header 'Authorization: Bearer {{API Key}}'

Response:

{
    "task": {
        "task_id": "{Returned Task ID}",
        "task_type": "WAN_TXT_TO_VIDEO",
        "status": "TASK_STATUS_SUCCEED",
        "reason": "",
        "eta": 0,
        "progress_percent": 100
    },
    "images": [],
    "videos": [
        {
            "video_url": "{The URL of the generated video}",
            "video_url_ttl": "3600",
            "video_type": "mp4"
        }
    ]
}

Video files: