Skip to main content
POST
/
v1
/
video
/
generations
Wan 2.7 Video Generation
curl --request POST \
  --url https://api.gravitex.ai/v1/video/generations \
  --header 'Authorization: <authorization>'

Documentation Index

Fetch the complete documentation index at: https://docs.gravitex.ai/llms.txt

Use this file to discover all available pages before exploring further.

Introduction

Wan 2.7 is Alibaba Cloud Bailian’s video generation family: text-to-video (Wan2.7-t2v), image-to-video (Wan2.7-i2v), reference-to-video (Wan2.7-r2v), and video editing (Wan2.7-videoedit). It supports 720P and 1080P output. Use GravitexAI’s unified video API: submit a task to get a task_id, then query the task to poll status and get url.
Wan 2.7 passes underlying DashScope parameters via metadata.input and metadata.parameters, unlike the flat fields used by Wan 2.5.

Authentication

Authorization
string
required
Bearer Token, e.g. Bearer sk-xxxxxxxxxx

Supported models

Model IDDescriptionResolutionMax durationHighlights
wan2.7-t2v-2026-04-25Text-to-video720P, 1080P15sMulti-shot narrative, custom audio
wan2.7-i2v-2026-04-25Image-to-video720P, 1080P15sFirst frame, first+last frame, continuation
wan2.7-r2vReference-to-video720P, 1080P10s (with video ref) / 15s (without)Multi-modal refs, voice clone, multi-character

Call flow

  1. Submit: POST /v1/video/generations with model, prompt, duration, and Wan parameters in metadata.
  2. Poll: GET /v1/video/generations/{task_id} every 3–15 seconds until succeeded or failed.
  3. Result: On success, url contains the video (typically valid for 24 hours—download promptly).

Request structure

FieldTypeRequiredDescription
modelstringYesModel ID (see table above)
promptstringYesVideo prompt (same as metadata.input.prompt)
durationintegerNoDuration in seconds; keep in sync with metadata.parameters.duration
metadata.inputobjectYesprompt, media, audio_url, negative_prompt, etc.
metadata.parametersobjectNoresolution, ratio, duration, prompt_extend, watermark, seed

Submit response

{
  "task_id": "video_69095b4ce0048190893a01510c0c98b0",
  "status": "submitted",
  "format": "mp4"
}

Query response (success)

{
  "task_id": "video_69095b4ce0048190893a01510c0c98b0",
  "status": "succeeded",
  "format": "mp4",
  "url": "https://gravitex-ads.oss-cn-guangzhou.aliyuncs.com/2025/11/18/abc123/video.mp4"
}

Usage scenarios

Generate video from text with multi-shot prompts, prompt rewriting, and optional custom audio.
metadata.input.prompt
string
required
Text prompt. Use shot timestamps, e.g. “Shot 1 [0-3s] … Shot 2 [3-6s] …”
metadata.input.negative_prompt
string
Negative prompt, max 500 characters
metadata.input.audio_url
string
Custom audio URL (wav/mp3), 2–30s, max 15MB
metadata.parameters.resolution
string
default:"720P"
720P or 1080P
metadata.parameters.ratio
string
default:"16:9"
Aspect ratio: 16:9, 9:16, 1:1, 4:3, 3:4
metadata.parameters.duration
integer
default:"5"
Duration in seconds, 2–15
metadata.parameters.prompt_extend
boolean
default:"true"
Enable prompt rewriting
metadata.parameters.watermark
boolean
default:"false"
Add watermark
Multi-shot example:
curl -X POST "https://api.gravitex.ai/v1/video/generations" \
  -H "Authorization: Bearer sk-xxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "wan2.7-t2v-2026-04-25",
    "prompt": "Shot 1 [0-3s] Wide: rainy NYC street at night. Shot 2 [3-6s] Medium: detective enters an old building.",
    "duration": 6,
    "metadata": {
      "input": {
        "prompt": "Shot 1 [0-3s] Wide: rainy NYC street at night. Shot 2 [3-6s] Medium: detective enters an old building."
      },
      "parameters": {
        "resolution": "720P",
        "ratio": "16:9",
        "duration": 6,
        "prompt_extend": true,
        "watermark": false
      }
    }
  }'

Parameter reference

Common parameters

ParameterTypeDescription
durationintegerT2V/I2V: 2–15s; R2V: 2–10s with video refs, else 2–15s
resolutionstring720P or 1080P
prompt_extendbooleanPrompt rewriting, default true
watermarkbooleanWatermark, default false
seedintegerRandom seed, [0, 2147483647]

T2V & R2V

ParameterTypeDescription
ratiostring16:9, 9:16, 1:1, 4:3, 3:4. I2V aspect follows assets—omit ratio

Media limits

TypeFormatsSizeNotes
ImageJPEG, JPG, PNG, BMP, WEBP≤ 20MB240–8000px, aspect 1:8–8:1
Audio (driving_audio)WAV, MP3≤ 15MB2–30s
Audio (reference_voice)WAV, MP3≤ 15MB1–10s
VideoMP4, MOV≤ 100MBfirst_clip: 2–10s; reference_video: 1–30s

Error handling

HTTPMeaningAction
400Invalid parametersCheck metadata and media limits
401UnauthorizedCheck API Key
429Rate limitedRetry later
502Upstream errorRetry later
On failure, status is failed and error.message has details.

FAQ

url and task_id are typically valid for 24 hours. Download and store promptly.
Only wan2.7-r2v supports reference_voice on reference_image or reference_video (1–10s audio URL).
  • First frame: first_frame (optional driving_audio)
  • First + last: first_frame + last_frame
  • Continuation: first_clip
Wan 2.7 uses metadata.input / metadata.parameters and media; Wan 2.5 uses flat top-level fields. See Submit video task.

Submit video task

Unified submit endpoint and multi-model parameters

Query video task

Poll status and get video URL