ApiframeApiframe Docs
Video GenerationWan

Wan 2.7

Generate videos from text or images with the Alibaba Wan 2.7 model — first-and-last-frame, video continuation, automatic audio, up to 1080p.

Use in Apiframe Studio

POST /v2/videos/generatemodel: "wan-2.7"

Combined text-to-video and image-to-video generation at 720p or 1080p, 2–15 seconds. Supports first-and-last-frame (FLF) constraints, continuation from an existing video clip, custom driving audio, and automatic prompt expansion. When no audio is provided the model auto-generates a matching soundtrack.

The mode is selected automatically:

  • Provide neither image nor first_clip → text-to-video.
  • Provide image → image-to-video (optionally with last_frame for FLF).
  • Provide first_clip → continuation from the given video (optionally with last_frame).

image and first_clip are mutually exclusive.

See Video Generation overview for common request fields, response format, and error codes.

Model-specific parameters

ParameterTypeRequiredDefaultDescription
wan27Params.imagestringNoFirst-frame image URL for I2V. Mutually exclusive with first_clip.
wan27Params.last_framestringNoOptional last-frame image URL. Requires image (FLF) or first_clip (continuation with target last frame).
wan27Params.first_clipstringNoSource clip (2–10 s) to continue from. Mutually exclusive with image.
wan27Params.audiostringNoDriving audio URL (wav/mp3, 3–30 s, ≤ 15 MB). Omit to auto-generate.
wan27Params.resolutionstringNo"1080p"Output resolution: "720p" or "1080p".
wan27Params.aspect_ratiostringNoT2V only. One of "16:9", "9:16", "1:1", "4:3", "3:4". I2V inherits aspect ratio from the input.
wan27Params.durationnumberNo5Video duration in seconds (integer, 2–15).
wan27Params.negative_promptstringNoElements to avoid in the generated video.
wan27Params.enable_prompt_expansionbooleanNoEnable automatic prompt optimization.
wan27Params.seednumberNoRandom seed for reproducible generation.

Credit cost

Pricing is per second of generated video (credits = rate × duration).

ModeResolutionCredits / second
T2V720p17
T2V1080p17
I2V (image or first_clip)720p17
I2V (image or first_clip)1080p26

A 10-second I2V clip at 1080p therefore costs 26 × 10 = 260 credits.

Code examples

curl -X POST https://api.apiframe.ai/v2/videos/generate \
  -H "X-API-Key: afk_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "A cinematic slow-motion shot of a tiger running through tall grass at golden hour",
    "model": "wan-2.7",
    "wan27Params": {
      "duration": 8,
      "resolution": "1080p",
      "aspect_ratio": "16:9",
      "enable_prompt_expansion": true
    }
  }'
import requests

response = requests.post(
    "https://api.apiframe.ai/v2/videos/generate",
    headers={
        "X-API-Key": "afk_your_api_key_here",
        "Content-Type": "application/json",
    },
    json={
        "prompt": "A cinematic slow-motion shot of a tiger running through tall grass at golden hour",
        "model": "wan-2.7",
        "wan27Params": {
            "duration": 8,
            "resolution": "1080p",
            "aspect_ratio": "16:9",
            "enable_prompt_expansion": True,
        },
    },
)
print(response.json())
const response = await fetch("https://api.apiframe.ai/v2/videos/generate", {
  method: "POST",
  headers: {
    "X-API-Key": "afk_your_api_key_here",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    prompt: "A cinematic slow-motion shot of a tiger running through tall grass at golden hour",
    model: "wan-2.7",
    wan27Params: {
      duration: 8,
      resolution: "1080p",
      aspect_ratio: "16:9",
      enable_prompt_expansion: true,
    },
  }),
});
console.log(await response.json());

Image-to-video (with optional last frame)

curl -X POST https://api.apiframe.ai/v2/videos/generate \
  -H "X-API-Key: afk_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "The person turns to camera and smiles",
    "model": "wan-2.7",
    "wan27Params": {
      "image": "https://example.com/start.jpg",
      "last_frame": "https://example.com/end.jpg",
      "duration": 5,
      "resolution": "720p"
    }
  }'

Continuation from an existing clip

curl -X POST https://api.apiframe.ai/v2/videos/generate \
  -H "X-API-Key: afk_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "The dragon takes off and flies over the mountains",
    "model": "wan-2.7",
    "wan27Params": {
      "first_clip": "https://example.com/intro.mp4",
      "duration": 8,
      "resolution": "1080p"
    }
  }'

Try it

POST/v2/videos/generateTry it

On this page