Wan_2.1 Text to Video Serverless API

Create visually impressive and feature varied, lifelike motion videos with Wan2.1 using text prompts.

~104.81s
~$0.855
 1import requests
 2import json
 3
 4url = "https://api.segmind.com/v1/wan2.1-t2v"
 5headers = {
 6    "x-api-key": "YOUR_API_KEY",
 7    "Content-Type": "application/json"
 8}
 9
10data = {
11    "prompt": "A smiling woman walking in London at night",
12    "negative_prompt": "blurry, bad quality, camera shake, distortion, poor composition, low resolution, artifact, watermark",
13    "seed": 9604478,
14    "video_length": 3,
15    "base_model": "14b",
16    "aspect_ratio": "16:9",
17    "steps": 30,
18    "base64": false
19}
20
21response = requests.post(url, headers=headers, json=data)
22
23if response.status_code == 200:
24    result = response.json()
25    print(json.dumps(result, indent=2))
26else:
27    print(f"Error: {response.status_code}")
28    print(response.text)

API Endpoint

POSThttps://api.segmind.com/v1/wan2.1-t2v

Parameters

aspect_ratiorequired
string

Aspect Ratio of the output video

Default: "16:9"
Allowed values :
"1:1""2:3""3:2""3:4""4:3""9:16""16:9"
base_modelrequired
string

Base model for video generation

Default: "14b"
Allowed values :
"1.3b""14b"
promptrequired
string

Prompt for video generation

video_lengthrequired
integer

Length of the generated video in seconds

Default: 3Range: 1 - 5
base64optional
boolean

Output as base64

Default: false
negative_promptoptional
string

Negative prompt for video generation

Default: "blurry, bad quality, camera shake, distortion, poor composition, low resolution, artifact, watermark"
seedoptional
integer

Seed number for video generation

Default: 42424242
stepsoptional
integer

Number of steps for video generation

Default: 30Range: 10 - 70

Response Type

Returns: Video

Common Error Codes

The API returns standard HTTP status codes. Detailed error messages are provided in the response body.

400

Bad Request

Invalid parameters or request format

401

Unauthorized

Missing or invalid API key

403

Forbidden

Insufficient permissions

404

Not Found

Model or endpoint not found

406

Insufficient Credits

Not enough credits to process request

429

Rate Limited

Too many requests

500

Server Error

Internal server error

502

Bad Gateway

Service temporarily unavailable

504

Timeout

Request timed out