Wan 2.2 Image to Video Flash Serverless API
Transform a single image and text prompt into a coherent, dynamic video.
1import requests
2import json
3
4url = "https://api.segmind.com/v1/wan-2.2-i2v-flash"
5headers = {
6 "x-api-key": "YOUR_API_KEY",
7 "Content-Type": "application/json"
8}
9
10data = {
11 "prompt": "4K cinematic close-up of a bloodied, battle-worn Viking warrior kneeling in a snowy sacred cave, eyes wide and glassy with intensity.His long braided blonde beard is frosted with snow, blood streaks run down his face and shoulders. The background is dimly lit by a flickering flame behind him — ancient carvings and symbols glow faintly on the icy stone wall. Camera slowly pushes in on his face as snow swirls in slow motion, and he breathes heavily, lips slightly parted.Suddenly, subtle glitch effects ripple across his face — like time distorting — as if a divine force is entering his mind.In the distance, an echo of a woman’s voice is heard whispering prophecy. As his eyes narrow, a faint blue rune glow reflects in his iris, foreshadowing something ancient and powerful.The camera holds as his expression changes — from fear… to understanding… to resolve.",
12 "image": "https://segmind-resources.s3.amazonaws.com/output/310df0db-0c5e-4c5a-8c78-5db73fbc7c91-bcd49a2d-a0a9-465e-aefd-ca9b5ebb11a7.jpeg",
13 "negative_prompt": "Avoid depicting busy urban environments.",
14 "resolution": "720P",
15 "prompt_extend": true,
16 "watermark": false
17}
18
19response = requests.post(url, headers=headers, json=data)
20
21if response.status_code == 200:
22 result = response.json()
23 print(json.dumps(result, indent=2))
24else:
25 print(f"Error: {response.status_code}")
26 print(response.text) 1import requests
2import json
3
4url = "https://api.segmind.com/v1/wan-2.2-i2v-flash"
5headers = {
6 "x-api-key": "YOUR_API_KEY",
7 "Content-Type": "application/json"
8}
9
10data = {
11 "prompt": "4K cinematic close-up of a bloodied, battle-worn Viking warrior kneeling in a snowy sacred cave, eyes wide and glassy with intensity.His long braided blonde beard is frosted with snow, blood streaks run down his face and shoulders. The background is dimly lit by a flickering flame behind him — ancient carvings and symbols glow faintly on the icy stone wall. Camera slowly pushes in on his face as snow swirls in slow motion, and he breathes heavily, lips slightly parted.Suddenly, subtle glitch effects ripple across his face — like time distorting — as if a divine force is entering his mind.In the distance, an echo of a woman’s voice is heard whispering prophecy. As his eyes narrow, a faint blue rune glow reflects in his iris, foreshadowing something ancient and powerful.The camera holds as his expression changes — from fear… to understanding… to resolve.",
12 "image": "https://segmind-resources.s3.amazonaws.com/output/310df0db-0c5e-4c5a-8c78-5db73fbc7c91-bcd49a2d-a0a9-465e-aefd-ca9b5ebb11a7.jpeg",
13 "negative_prompt": "Avoid depicting busy urban environments.",
14 "resolution": "720P",
15 "prompt_extend": true,
16 "watermark": false
17}
18
19response = requests.post(url, headers=headers, json=data)
20
21if response.status_code == 200:
22 result = response.json()
23 print(json.dumps(result, indent=2))
24else:
25 print(f"Error: {response.status_code}")
26 print(response.text)API Endpoint
https://api.segmind.com/v1/wan-2.2-i2v-flashParameters
imagerequiredstring (uri)Base image is used to establish the video's theme. Choose images with strong visual elements or futuristic items.
promptrequiredstringA descriptive prompt guides the video generation with vivid storytelling. Try a vibrant imaginary or futuristic setting for best effects.
negative_promptoptionalstringExcludes specific details from the final video. Avoid elements like chaotic environments for clearer messaging.
"Avoid depicting busy urban environments."prompt_extendoptionalbooleanEnhances the prompt automatically for better results. Enable this for complex or lengthy descriptions.
trueresolutionoptionalstringDefines the output video quality. Use 720P for high clarity or 480P for faster processing.
"720P""480P""720P"seedoptionalintegerControls the randomness of video generation. Set a number for consistency or leave blank for variability.
nullwatermarkoptionalbooleanAdds an 'AI Generated' tag to outputs. Use for transparency in generated media.
falseResponse Type
Returns: Video
Common Error Codes
The API returns standard HTTP status codes. Detailed error messages are provided in the response body.
Bad Request
Invalid parameters or request format
Unauthorized
Missing or invalid API key
Forbidden
Insufficient permissions
Not Found
Model or endpoint not found
Insufficient Credits
Not enough credits to process request
Rate Limited
Too many requests
Server Error
Internal server error
Bad Gateway
Service temporarily unavailable
Timeout
Request timed out