Wan 2.7
Generate, edit or extend 720p and 1080p video from text, frames and references.
Overview
Generate, edit or extend 720p and 1080p video from text, frames and references.
- Model ID:
alibaba/wan-2.7 - Maker: Alibaba
- Type:
video - Timeout: 43200 s
- Typical time: ~47 s
- Endpoint:
POST https://api.kerox.ai/v1/tasks
Request example
Submit a task and get its id at once; get the result by polling (below) or by webhook. webhook_url and metadata are optional. To use a webhook, provide your own public HTTPS address in webhook_url. Every field is in Submit a task.
Set KEROX_API_KEY first. The polling example needs Bash, curl and jq. For Python, install requests with pip install requests.
curl --fail-with-body -X POST https://api.kerox.ai/v1/tasks \
-H "Authorization: Bearer $KEROX_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "alibaba/wan-2.7",
"input": {
"prompt": "a red fox running through fresh snow, cinematic lighting",
"resolution": "720p",
"duration": 5,
"aspect_ratio": "16:9"
}
}'Reference image
curl --fail-with-body -X POST https://api.kerox.ai/v1/tasks \
-H "Authorization: Bearer $KEROX_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "alibaba/wan-2.7",
"input": {
"prompt": "Image 1: the lighthouse beam sweeps slowly across the water",
"resolution": "720p",
"duration": 5,
"aspect_ratio": "16:9",
"images": [
"https://cdn.kerox.ai/assets/samples/seedream-5.5/lighthouse-blue-hour.webp"
],
"mode": "reference"
}
}'First frame
curl --fail-with-body -X POST https://api.kerox.ai/v1/tasks \
-H "Authorization: Bearer $KEROX_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "alibaba/wan-2.7",
"input": {
"prompt": "A lighthouse beam sweeps slowly across the waves",
"resolution": "720p",
"duration": 5,
"aspect_ratio": "16:9",
"first_frame": "https://cdn.kerox.ai/assets/samples/seedream-5.5/lighthouse-blue-hour.webp"
}
}'First and last frames
curl --fail-with-body -X POST https://api.kerox.ai/v1/tasks \
-H "Authorization: Bearer $KEROX_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "alibaba/wan-2.7",
"input": {
"prompt": "Slowly dissolve from the coast to the cabin by the lake",
"resolution": "720p",
"duration": 5,
"aspect_ratio": "16:9",
"first_frame": "https://cdn.kerox.ai/assets/samples/seedream-5.5/lighthouse-blue-hour.webp",
"last_frame": "https://cdn.kerox.ai/assets/samples/seedream-5.0-pro/alpine-cabin-dawn.webp"
}
}'Reference video
curl --fail-with-body -X POST https://api.kerox.ai/v1/tasks \
-H "Authorization: Bearer $KEROX_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "alibaba/wan-2.7",
"input": {
"prompt": "Use the camera motion of Video 1 for a flyover of a rocky coastline",
"resolution": "720p",
"duration": 5,
"aspect_ratio": "16:9",
"videos": [
"https://cdn.kerox.ai/assets/samples/seedance-2.0/sea-stacks-fog.mp4"
]
}
}'Edit a two-second clip
curl --fail-with-body -X POST https://api.kerox.ai/v1/tasks \
-H "Authorization: Bearer $KEROX_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "alibaba/wan-2.7",
"input": {
"prompt": "Turn the paper boat blue",
"mode": "edit",
"videos": [
"https://cdn.kerox.ai/assets/samples/wan-2.7/paper-sail.mp4"
],
"duration": 2
}
}'Extend to seven seconds
curl --fail-with-body -X POST https://api.kerox.ai/v1/tasks \
-H "Authorization: Bearer $KEROX_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "alibaba/wan-2.7",
"input": {
"prompt": "Continue the boat’s drift",
"mode": "extend",
"videos": [
"https://cdn.kerox.ai/assets/samples/wan-2.7/paper-sail.mp4"
],
"duration": 7
}
}'Reference audio
curl --fail-with-body -X POST https://api.kerox.ai/v1/tasks \
-H "Authorization: Bearer $KEROX_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "alibaba/wan-2.7",
"input": {
"prompt": "Show a dinosaur at dusk and time its roar to Audio 1",
"resolution": "720p",
"duration": 5,
"aspect_ratio": "16:9",
"audios": [
"https://interactive-examples.mdn.mozilla.net/media/cc0-audio/t-rex-roar.mp3"
]
}
}'Parameters
The parameter names mean the same on every model.
| Parameter | Description | Values and example |
|---|---|---|
promptstring · Required | Text describing what to generate.Default · Unspecified | Values at least one non-whitespace character; 1–5000 characters Example "A lighthouse at dawn" |
audio_settingstring · Optional | Choose automatic audio or preserve the source soundtrack during a video edit.Default · Unspecified | Values auto, origin Example "auto" |
modestring · Optional | Select reference generation, video editing or extension. Without a mode the input selects text, frame or reference generation.Default · Unspecified | Values reference, edit, extend Example "reference" |
negative_promptstring · Optional | Text describing what the result should not contain.Default · Unspecified | Values at least one non-whitespace character; 1–500 characters Example "blurred lettering" |
imagesstring | string[] · Optional | Images for the model to draw on, in the order the prompt refers to them.Default · Unspecified | Values one public HTTPS URL; one string or an array of 1–5 items; Model file limits: image/jpeg, image/png, image/bmp or image/webp, up to 20 MB each; 240–8,000 px per side, aspect ratio 1:8–8:1 Example "https://example.com/photo.png" |
videosstring | string[] · Optional | Videos for the model to draw on, in the order the prompt refers to them.Default · Unspecified | Values one public HTTPS URL; one string or an array of 1–5 items Example "https://example.com/clip.mp4" |
audiosstring | string[] · Optional | Audio clips for the model to draw on, in the order the prompt refers to them.Default · Unspecified | Values one public HTTPS URL; one string or an array of 1–1 items Example "https://example.com/music.wav" |
first_framestring · Optional | The image a video starts from.Default · Unspecified | Values one public HTTPS URL; Model file limits: image/jpeg, image/png, image/bmp or image/webp, up to 20 MB each; 240–8,000 px per side, aspect ratio 1:8–8:1 Example "https://example.com/start.png" |
last_framestring · Optional | The image a video ends on. Needs first_frame.Default · Unspecified | Values one public HTTPS URL; Model file limits: image/jpeg, image/png, image/bmp or image/webp, up to 20 MB each; 240–8,000 px per side, aspect ratio 1:8–8:1 Example "https://example.com/end.png" |
aspect_ratiostring · Optional | Width to height of the output.Default · Unspecified | Values 16:9, 9:16, 1:1, 4:3, 3:4 Example "16:9" |
resolutionstring · Optional | Output resolution tier. The exact pixels follow from it and aspect_ratio.Default · "720p" | Values 720p, 1080p Example "720p" |
durationinteger · Optional | Length of the output in whole seconds.Default · 5 | Values 0–15 Example 5 |
seedinteger · Optional | The same seed and input give a similar result.Default · Unspecified | Values 0–2147483647 Example 0 |
prompt_extendboolean · Optional | Whether the maker rewrites and expands the prompt before generating. On Wan 3.0 and Prime, file or link enables rewriting automatically and requires true if specified.Default · false | Values true, false Example false |
ninteger · Optional | How many outputs one task may produce.Default · 1 | Values 1 Example 1 |
- Omit mode to select by input. A prompt generates from text, first_frame animates an image and images/videos supply references. For editing or extension send mode=edit or extend with one source clip in videos.
- Reference images are free. Reference videos share five billable input seconds equally across clips. Editing accepts a 2–10 second source and bills input plus output. Omit duration or set it to 0 to match the source length, up to ten output seconds.
- Extension duration is the whole final length including the source, up to 15 seconds. A 2-second source accepts totals of 7–15 seconds. Add at least five whole seconds. Trim fractional sources to whole seconds first.
- Some short or uneven reference and edit clips cannot be offered at the quoted rate after duration rounding. Estimates and submissions explain the adjustment before any charge. Combine references, trim to whole seconds or increase the output duration.
Use a public HTTPS URL directly for images, audio and video. For local media, upload with POST /v1/files and pass the returned url. For upload MIME and size limits, see Files & inputs.
Not supported yet: watermark.
Polling and output
Poll GET /v1/tasks/{id}, or pass webhook_url when you submit and receive the same task object when it finishes: see Webhooks for the setup. Output files expire at expires_at (7 days after completion), so download anything you want to keep. See every task field in Tasks & polling.
Set TASK_ID to the id returned on submission. The script waits up to 10 minutes, prints error on failure and downloads every outputs[].url on success.
(
set -eu
# Set TASK_ID to the id returned by the submit request.
: "${TASK_ID:?Set TASK_ID}"
deadline=$((SECONDS + 600))
while (( SECONDS < deadline )); do
task=$(curl --fail-with-body --silent --show-error --max-time "$((deadline - SECONDS))" https://api.kerox.ai/v1/tasks/"$TASK_ID" \
-H "Authorization: Bearer $KEROX_API_KEY")
case $(jq -er .status <<< "$task") in
succeeded)
if ! jq -e '.outputs | length > 0' <<< "$task" >/dev/null; then
echo "Result files are unavailable." >&2
exit 1
fi
i=0
while IFS= read -r url; do
file_path=${url%%\?*}
filename="output-${i}.${file_path##*.}"
curl --fail-with-body --silent --show-error --max-time 120 "$url" -o "$filename"
printf "%s\n" "$filename"
i=$((i + 1))
done < <(jq -r '.outputs[].url' <<< "$task")
exit 0 ;;
failed) jq -c .error <<< "$task" >&2; exit 1 ;;
processing) sleep 2 ;;
*) echo "Unexpected task status." >&2; exit 1 ;;
esac
done
echo "Poll timed out. Keep TASK_ID to check again later." >&2
exit 1
)Pricing
| Tier | Official / second | Kerox / second | Below official price |
|---|---|---|---|
| 720p | $0.1000 | $0.0900 | 10% |
| 1080p | $0.1500 | $0.1350 | 10% |
Estimate before submitting
The returned amount is what submitting would hold. An estimate creates no task and charges nothing. When exact is false, the final charge may differ from the hold.
curl --fail-with-body -X POST https://api.kerox.ai/v1/estimate \
-H "Authorization: Bearer $KEROX_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "alibaba/wan-2.7",
"input": {
"prompt": "a red fox running through fresh snow, cinematic lighting",
"resolution": "720p",
"duration": 5,
"aspect_ratio": "16:9"
}
}'Input schema (JSON)
The full JSON Schema, nested parameters included
{
"type": "object",
"allOf": [
{
"if": {
"required": [
"first_frame"
],
"properties": {
"first_frame": true
}
},
"then": {
"not": {
"anyOf": [
{
"required": [
"mode"
],
"properties": {
"mode": {
"const": "edit"
}
}
},
{
"required": [
"mode"
],
"properties": {
"mode": {
"const": "extend"
}
}
}
]
}
}
},
{
"if": {
"required": [
"mode"
],
"properties": {
"mode": {
"enum": [
"extend",
"edit"
]
}
}
},
"then": {
"required": [
"videos"
],
"properties": {
"videos": {
"maxItems": 1
}
}
}
},
{
"if": {
"required": [
"mode"
],
"properties": {
"mode": {
"enum": [
"extend"
]
}
}
},
"then": {
"not": {
"anyOf": [
{
"required": [
"images"
],
"properties": {
"images": true
}
},
{
"required": [
"aspect_ratio"
],
"properties": {
"aspect_ratio": true
}
}
]
}
}
},
{
"if": {
"required": [
"mode"
],
"properties": {
"mode": {
"enum": [
"reference"
]
}
}
},
"then": {
"anyOf": [
{
"required": [
"videos"
],
"properties": {
"videos": true
}
},
{
"required": [
"images"
],
"properties": {
"images": true
}
}
]
}
},
{
"if": {
"required": [
"mode"
],
"properties": {
"mode": {
"enum": [
"edit"
]
}
}
},
"else": {
"properties": {
"duration": {
"minimum": 2
}
}
},
"then": {
"properties": {
"images": {
"maxItems": 3
},
"duration": {
"enum": [
0,
2,
3,
4,
5,
6,
7,
8,
9,
10
]
}
}
}
},
{
"if": {
"allOf": [
{
"required": [
"videos"
],
"properties": {
"videos": true
}
},
{
"not": {
"required": [
"mode"
],
"properties": {
"mode": {
"enum": [
"extend",
"edit"
]
}
}
}
}
]
},
"then": {
"properties": {
"duration": {
"maximum": 10
}
}
}
},
{
"if": {
"required": [
"last_frame"
],
"properties": {
"last_frame": true
}
},
"then": {
"anyOf": [
{
"required": [
"first_frame"
],
"properties": {
"first_frame": true
}
},
{
"required": [
"mode"
],
"properties": {
"mode": {
"const": "extend"
}
}
}
]
}
},
{
"if": {
"required": [
"audio_setting"
],
"properties": {
"audio_setting": true
}
},
"then": {
"required": [
"mode"
],
"properties": {
"mode": {
"const": "edit"
}
}
}
},
{
"if": {
"anyOf": [
{
"required": [
"mode"
],
"properties": {
"mode": {
"const": "edit"
}
}
},
{
"required": [
"mode"
],
"properties": {
"mode": {
"const": "reference"
}
}
},
{
"required": [
"images"
],
"properties": {
"images": true
}
},
{
"allOf": [
{
"required": [
"videos"
],
"properties": {
"videos": true
}
},
{
"not": {
"required": [
"mode"
],
"properties": {
"mode": {
"const": "extend"
}
}
}
}
]
}
]
},
"then": {
"not": {
"anyOf": [
{
"required": [
"audios"
],
"properties": {
"audios": true
}
}
]
}
}
},
{
"if": {
"anyOf": [
{
"required": [
"images"
],
"properties": {
"images": true
}
},
{
"required": [
"mode"
],
"properties": {
"mode": {
"const": "reference"
}
}
},
{
"allOf": [
{
"required": [
"videos"
],
"properties": {
"videos": true
}
},
{
"not": {
"required": [
"mode"
],
"properties": {
"mode": {
"const": "extend"
}
}
}
}
]
}
]
},
"then": {
"not": {
"anyOf": [
{
"required": [
"last_frame"
],
"properties": {
"last_frame": true
}
}
]
}
}
},
{
"if": {
"required": [
"mode"
],
"properties": {
"mode": {
"const": "edit"
}
}
},
"then": {
"not": {
"anyOf": [
{
"required": [
"aspect_ratio"
],
"properties": {
"aspect_ratio": true
}
}
]
}
}
}
],
"$schema": "https://json-schema.org/draft/2020-12/schema",
"required": [
"prompt"
],
"properties": {
"prompt": {
"type": "string",
"pattern": "\\S",
"maxLength": 5000,
"minLength": 1,
"description": "Text describing what to generate.",
"x-label-en": "Prompt",
"x-label-zh": "提示词",
"x-tier": "common"
},
"audio_setting": {
"enum": [
"auto",
"origin"
],
"type": "string",
"description": "Choose automatic audio or preserve the source soundtrack during a video edit.",
"x-label-en": "Edit audio",
"x-label-zh": "编辑音轨",
"x-tier": "advanced"
},
"mode": {
"enum": [
"reference",
"edit",
"extend"
],
"type": "string",
"description": "Select reference generation, video editing or extension. Without a mode the input selects text, frame or reference generation.",
"x-label-en": "Video mode",
"x-label-zh": "视频模式",
"x-tier": "common"
},
"negative_prompt": {
"type": "string",
"pattern": "\\S",
"maxLength": 500,
"minLength": 1,
"description": "Text describing what the result should not contain.",
"x-label-en": "Negative prompt",
"x-label-zh": "负向提示词",
"x-tier": "advanced"
},
"images": {
"oneOf": [
{
"type": "string",
"pattern": "^https://"
},
{
"type": "array",
"items": {
"type": "string",
"pattern": "^https://"
},
"maxItems": 5,
"minItems": 1
}
],
"description": "Images for the model to draw on, in the order the prompt refers to them.",
"x-label-en": "Reference images",
"x-label-zh": "参考图",
"x-tier": "common"
},
"videos": {
"oneOf": [
{
"type": "string",
"pattern": "^https://"
},
{
"type": "array",
"items": {
"type": "string",
"pattern": "^https://"
},
"maxItems": 5,
"minItems": 1
}
],
"description": "Videos for the model to draw on, in the order the prompt refers to them.",
"x-label-en": "Reference videos",
"x-label-zh": "参考视频",
"x-tier": "advanced"
},
"audios": {
"oneOf": [
{
"type": "string",
"pattern": "^https://"
},
{
"type": "array",
"items": {
"type": "string",
"pattern": "^https://"
},
"maxItems": 1,
"minItems": 1
}
],
"description": "Audio clips for the model to draw on, in the order the prompt refers to them.",
"x-label-en": "Reference audio",
"x-label-zh": "参考音频",
"x-tier": "advanced"
},
"first_frame": {
"type": "string",
"pattern": "^https://",
"description": "The image a video starts from.",
"x-label-en": "First frame",
"x-label-zh": "首帧",
"x-tier": "common"
},
"last_frame": {
"type": "string",
"pattern": "^https://",
"description": "The image a video ends on. Needs `first_frame`.",
"x-label-en": "Last frame",
"x-label-zh": "尾帧",
"x-tier": "advanced"
},
"aspect_ratio": {
"enum": [
"16:9",
"9:16",
"1:1",
"4:3",
"3:4"
],
"type": "string",
"description": "Width to height of the output.",
"x-label-en": "Aspect ratio",
"x-label-zh": "画面比例",
"x-tier": "common"
},
"resolution": {
"enum": [
"720p",
"1080p"
],
"type": "string",
"default": "720p",
"description": "Output resolution tier. The exact pixels follow from it and `aspect_ratio`.",
"x-label-en": "Resolution",
"x-label-zh": "分辨率",
"x-tier": "common"
},
"duration": {
"type": "integer",
"default": 5,
"maximum": 15,
"minimum": 0,
"description": "Length of the output in whole seconds.",
"x-label-en": "Duration",
"x-label-zh": "时长",
"x-tier": "common"
},
"seed": {
"type": "integer",
"maximum": 2147483647,
"minimum": 0,
"description": "The same seed and input give a similar result.",
"x-label-en": "Seed",
"x-label-zh": "随机种子",
"x-tier": "advanced"
},
"prompt_extend": {
"type": "boolean",
"default": false,
"description": "Whether the maker rewrites and expands the prompt before generating. On Wan 3.0 and Prime, file or link enables rewriting automatically and requires true if specified.",
"x-label-en": "Prompt rewrite",
"x-label-zh": "提示词扩写",
"x-tier": "advanced"
},
"n": {
"type": "integer",
"const": 1,
"default": 1,
"description": "How many outputs one task may produce.",
"x-label-en": "Number of outputs",
"x-label-zh": "生成数量",
"x-tier": "advanced"
}
},
"x-unsupported": [
"watermark"
],
"additionalProperties": false
}