Please rotate your device

To continue exploring this website, please rotate your device to a vertical orientation

Wan 2.2 T2V

Wan-AI/Wan2.2-T2V-A14B

14B parameter text-to-video generation model from Wan AI.

image generation

Generate a video from a text prompt. The response contains a base64-encoded video.

Input

python
import requests
import base64
import os

# Supported video sizes:
# 720x1280, 1280x720, 480x832, 832x480,
# 704x1280, 1280x704, 1024x704, 704x1024

res = requests.post(
    "https://model-{MODEL_ID}.api.baseten.co/production/predict",
    headers={"Authorization": f"Api-Key {os.environ['BASETEN_API_KEY']}"},
    json={
        "prompt": "A cat playing piano in a jazz club, cinematic lighting",
        "size": "1280x720",
        "sampling_steps": 40,
        "guide_scale": [3.0, 4.0],
        "seed": 42,
    },
)

# Save the base64-encoded video to an mp4 file
video_data = base64.b64decode(res.json()["video"])
with open("wan2_output.mp4", "wb") as f:
    f.write(video_data)

Output

json
{
  "video": "AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZj..."
}