Wan Alpha Serverless API
Generate transparent-background video with a real alpha channel.
POST /v2/wan-alpha · submit + poll 1# pip install "segmind>=1.1.0"
2# export SEGMIND_API_KEY="YOUR_API_KEY"
3from segmind import SegmindClient, InferenceFailed, InferenceTimeout
4
5# Async (v2) — recommended for long-running / video models.
6# run() blocks up to 600s; submit_async + job.wait(timeout=...) sets a longer
7# deadline and keeps the request_id so you can re-poll later.
8client = SegmindClient() # reads SEGMIND_API_KEY
9payload = {
10 "prompt": "Medium shot. A red fox trots and turns its head, its thick fur and bushy tail ruffled by the wind. The background of this video is transparent. Realistic style.",
11 "negative_prompt": "",
12 "resolution": "832*480",
13 "num_frames": 81,
14 "fps": 16,
15 "output_format": "webm",
16 "output_quality": 85,
17 "seed": 92979684,
18 "remove_first_frame": False,
19 "remove_last_frame": False,
20}
21job = client.submit_async("wan-alpha", **payload)
22print(job.request_id) # available immediately
23try:
24 result = job.wait(timeout=900, interval=2.0)
25 print(result["status"]) # COMPLETED
26 print(result.get("output")) # model output (e.g. video URL)
27except InferenceTimeout as e:
28 print("still running:", e.request_id) # re-poll later with this id
29except InferenceFailed as e:
30 print("failed:", e.detail)
31
32# Fast models (<=600s) can use the one-liner instead:
33# result = segmind.run("wan-alpha", **payload) 1# pip install "segmind>=1.1.0"
2# export SEGMIND_API_KEY="YOUR_API_KEY"
3from segmind import SegmindClient, InferenceFailed, InferenceTimeout
4
5# Async (v2) — recommended for long-running / video models.
6# run() blocks up to 600s; submit_async + job.wait(timeout=...) sets a longer
7# deadline and keeps the request_id so you can re-poll later.
8client = SegmindClient() # reads SEGMIND_API_KEY
9payload = {
10 "prompt": "Medium shot. A red fox trots and turns its head, its thick fur and bushy tail ruffled by the wind. The background of this video is transparent. Realistic style.",
11 "negative_prompt": "",
12 "resolution": "832*480",
13 "num_frames": 81,
14 "fps": 16,
15 "output_format": "webm",
16 "output_quality": 85,
17 "seed": 92979684,
18 "remove_first_frame": False,
19 "remove_last_frame": False,
20}
21job = client.submit_async("wan-alpha", **payload)
22print(job.request_id) # available immediately
23try:
24 result = job.wait(timeout=900, interval=2.0)
25 print(result["status"]) # COMPLETED
26 print(result.get("output")) # model output (e.g. video URL)
27except InferenceTimeout as e:
28 print("still running:", e.request_id) # re-poll later with this id
29except InferenceFailed as e:
30 print("failed:", e.detail)
31
32# Fast models (<=600s) can use the one-liner instead:
33# result = segmind.run("wan-alpha", **payload)API Endpoint
https://api.segmind.com/v1/wan-alphaParameters
promptrequiredstringWhat the video should show. Include the words "transparent background" and a shot type (close-up / medium shot / wide shot) - the model needs both to key the subject cleanly. A style tag helps.
fpsoptionalintegerPlayback frame rate, 5 to 30. Use 16 for natural motion. This sets how long the frames take to play back, not how many are generated, so it does not change the price.
16Range: 5 - 30negative_promptoptionalstringWhat to keep out of the clip. Leave blank to use the model default.
""num_framesoptionalintegerFrames to generate, 81 to 121 in steps of 4. At the default 16 fps, 81 frames is about 5 seconds and 121 about 7.5 seconds.
81Range: 81 - 121output_formatoptionalstringWebM video or animated WebP, both carrying the alpha channel. WebM is the one most editors and browsers composite directly.
"webm""webm""webp"output_qualityoptionalintegerEncoder quality, 1 to 100. Use 85 for balance and 95 for fine detail; higher keeps more detail in a larger file.
85Range: 1 - 100remove_first_frameoptionalbooleanDrop the opening frame, which can carry keying artifacts. Enable if edges flicker.
falseremove_last_frameoptionalbooleanDrop the closing frame, which can carry keying artifacts. Enable if edges flicker.
falseresolutionoptionalstringOutput size and aspect. Use 480p for drafts and 720p for final delivery. The 512 x 512 presets render at 480p and are scaled down, so they cost the same as the 480p pair.
"832*480""832*480""480*832""1280*720""720*1280""512*512 (fit horizontal)""512*512 (fit vertical)"seedoptionalintegerReuse a seed to reproduce a clip. -1 picks a random one.
-1Response Type
Returns: Video
Asynchronous requests (v2)
Use Async for video, long-running (>~60s), or high-concurrency workloads; Sync is simplest for fast image & LLM calls. Async submits a request and you poll it to completion.
- 1
POST /v2/wan-alphaSubmit — returns request_id, status_url, response_url
- 2
GET /v2/requests/{id}/statusPoll — until COMPLETED or FAILED
- 3
GET /v2/requests/{id}Result — final response body
Status states
- A FAILED request is served as HTTP 422 — the body still carries the error detail.
- An unknown or expired request_id returns HTTP 404.
- Results are retained for 1 hour, then expire.
- Content / RAI blocks surface as FAILED, not a separate state.
- Track completion by polling the status endpoint.
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