Wan 2.7

ModelCapabilityRequired fields
wan2.7-t2vText to videoinput.prompt
wan2.7-i2vImage to video (first frame, optional last frame)input.prompt, a first_frame in input.media[] (legacy spelling: input.img_url)

Wan 2.7's official protocol is Alibaba Bailian's DashScope asynchronous video synthesis API. The ModelGo gateway accepts the official paths and request/response shapes unchanged: create → poll → fetch content. Which supplier renders the clip is a routing decision inside the gateway and invisible to the caller; when a request lands on the official Bailian channel, your request body is forwarded as you wrote it and the gateway only replaces model (legacy-spelling fields are rewritten to the official spelling).

With the official DashScope SDK, point base_url (DASHSCOPE_HTTP_BASE_URL) at https://api.modelgo.ai and use your ModelGo API key as api_key.

1. Create a task

POST https://api.modelgo.ai/api/v1/services/aigc/video-generation/video-synthesis

Headers: Authorization: Bearer $MODELGO_API_KEY, X-DashScope-Async: enable, Content-Type: application/json.

Text to video

bash
curl https://api.modelgo.ai/api/v1/services/aigc/video-generation/video-synthesis \
  -H "Authorization: Bearer $MODELGO_API_KEY" \
  -H "X-DashScope-Async: enable" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "wan2.7-t2v",
    "input": {"prompt": "A fluffy orange kitten playing with a ball of yarn on a sunny windowsill"},
    "parameters": {"resolution": "1080P", "duration": 5, "prompt_extend": true}
  }'

Image to video

bash
curl https://api.modelgo.ai/api/v1/services/aigc/video-generation/video-synthesis \
  -H "Authorization: Bearer $MODELGO_API_KEY" \
  -H "X-DashScope-Async: enable" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "wan2.7-i2v",
    "input": {
      "prompt": "The cat slowly tilts its head and blinks",
      "media": [{"type": "first_frame", "url": "https://example-cdn.com/cat.jpg"}]
    },
    "parameters": {"resolution": "720P", "duration": 5}
  }'

Response

json
{
  "output": {"task_id": "gw_e99647a0-692d-4fdd-ae46-e1d777e72bf5", "task_status": "PENDING", "submit_time": "2026-09-07 17:05:59.000"},
  "request_id": "gw_e99647a0-692d-4fdd-ae46-e1d777e72bf5"
}

output.task_id is the gateway task id; use it to poll and to fetch content.

2. Parameters

FieldTypeApplies toDescription
modelstringallwan2.7-t2v or wan2.7-i2v
input.promptstringallRequired. Scene and motion description
input.media[]object[]allBailian's official wan2.7 spelling, items {"type": ..., "url": ...}: first_frame, last_frame, driving_audio, first_clip (video continuation, i2v only, see below). first_frame / last_frame / first_clip are i2v only and are refused on t2v (never silently treated as text-to-video); driving_audio works on both models; one type must not repeat; any other type is refused. The first-frame URL must be publicly downloadable
input.img_urlstringi2vLegacy spelling of a first_frame in media; new integrations should use media[]
input.last_frame_urlstringi2vLegacy spelling of a last_frame in media
input.audio_urlstringallDriving audio URL (wav/mp3), the official spelling on t2v; on i2v use a driving_audio in media (audio_url is accepted as a legacy spelling). One slot must not be given in both spellings
input.negative_promptstringallNegative prompt
parameters.resolutionstringallTier 720P / 1080P, default 1080P
parameters.ratiostringallAspect ratio such as 16:9 (default) / 9:16 / 1:1; with resolution it determines the output size (see the table below). aspect_ratio is accepted too; if both are sent they must match. See the official documentation for the full list
parameters.sizestringt2vPixel spelling of the same tier, e.g. 1280*720, 1920*1080; if sent together with ratio, the aspect ratios must match
parameters.durationintallDuration in seconds, default 5
parameters.prompt_extendbooleanallLet the upstream rewrite the prompt
parameters.watermarkbooleanallAdd a watermark
parameters.seedintallRandom seed

parameters keys not listed above (for example shot_type, deprecated on wan2.7) are not interpreted by the gateway and do not cause an error: as in the official API the upstream ignores them, and billing is unaffected.

Audio

  • The official wan2.7 API has no audio switch, and ModelGo follows it: without a driving_audio in input.media[] (input.audio_url on t2v) the model generates matching background music or sound effects from the picture; with one, your audio drives the soundtrack.
  • So wan2.7 has a single price (the audio tier) — there is no "silent tier". parameters.audio is not a wan2.7 parameter and the gateway does not send it upstream.
  • A request that explicitly asks for silence is refused: parameters.audio=false or a top-level generate_audio=false / "false" returns 400 at create time, costs nothing, and is never turned into a clip with sound that is then billed. true is the same as omitting it and causes no error.

Resolution tiers

Tier16:99:161:14:33:4
720P1280*720720*1280960*9601088*832832*1088
1080P1920*10801080*19201440*14401632*12481248*1632
  • For 4:3 / 3:4, size also accepts Bailian's spelling: 720P 1104*832 / 832*1104, 1080P 1648*1248 / 1248*1648 — the same tier and price as the spelling in the table.
  • Only 720P / 1080P are offered. 4K or a size outside the table is refused at create time (HTTP 400); nothing is rendered at a lower tier silently and nothing is charged.
  • Routed by deliverable tier. The gateway only hands a request to a supplier that renders the stated tier (for example wan2.7-t2v at 720P is currently rendered by the official Bailian lane only); no supplier renders 1080P in its place while 720P is billed. If no supplier can render the tier right now the create returns 400 and nothing is charged.
  • input keys not in the table above (e.g. ref_images_url) are not supported on this endpoint and are refused rather than ignored.

Video continuation (first_clip, i2v only)

  • Send {"type": "first_clip", "url": "<video URL>"} in input.media[] (or the flat input.first_clip_url) to continue from an existing video. The clip must be a 2–10 s mp4 / mov at a publicly downloadable URL (not an authenticated address such as this gateway's own /v1/videos/{id}/content).
  • wan2.7-i2v only. It cannot be combined with first_frame (img_url) or driving_audio (audio_url); it may be paired with last_frame. Any violation is refused at creation with 400 and costs nothing.
  • Billed as i2v, at the same tier price as a non-continuation i2v call.
  • Not every supplier channel can carry a continuation: the gateway only routes it to channels confirmed to support it, and returns 400 (no charge) when none is available.

First-frame image requirements (i2v)

  • A direct link the upstream can GET: no auth, no redirects, no Referer / Cookie dependency.
  • Some hosts return 403 to non-browser fetches; the task then fails (task_status=FAILED) and is not billed. Use your own object storage or CDN.

3. Poll the task

GET https://api.modelgo.ai/api/v1/tasks/{task_id}

bash
curl https://api.modelgo.ai/api/v1/tasks/gw_e99647a0-692d-4fdd-ae46-e1d777e72bf5 \
  -H "Authorization: Bearer $MODELGO_API_KEY"

When finished:

json
{
  "output": {
    "task_id": "gw_e99647a0-692d-4fdd-ae46-e1d777e72bf5",
    "task_status": "SUCCEEDED",
    "submit_time": "2026-09-07 17:05:59.000",
    "end_time": "2026-09-07 17:09:06.000",
    "video_url": "https://api.modelgo.ai/v1/videos/gw_e99647a0-692d-4fdd-ae46-e1d777e72bf5/content"
  },
  "usage": {"video_duration": 6, "video_count": 1},
  "request_id": "gw_e99647a0-692d-4fdd-ae46-e1d777e72bf5"
}
  • task_status: PENDING → RUNNING → SUCCEEDED / FAILED. On failure output.code / output.message carry the reason and the task is not billed.
  • Generation usually takes 1–3 minutes; poll every 5–10 s with backoff.
  • output.video_url points at the gateway content endpoint and requires the API key. Do not persist it; artifacts have a retention period.

4. Download the video

GET https://api.modelgo.ai/v1/videos/{task_id}/content

bash
curl https://api.modelgo.ai/v1/videos/gw_e99647a0-692d-4fdd-ae46-e1d777e72bf5/content \
  -H "Authorization: Bearer $MODELGO_API_KEY" -o cat.mp4

Streams video/mp4, Range supported. Only the API key that owns the task (or a console session of the same tenant) may fetch it; 409 while not completed, 404 once expired or unknown.

5. Full example (Python, SDK style)

python
import os, time, requests

BASE = "https://api.modelgo.ai"
H = {"Authorization": f"Bearer {os.environ['MODELGO_API_KEY']}", "X-DashScope-Async": "enable"}

def synthesize(model: str, inp: dict, params: dict, out: str, timeout: int = 600) -> None:
    r = requests.post(f"{BASE}/api/v1/services/aigc/video-generation/video-synthesis",
                      json={"model": model, "input": inp, "parameters": params}, headers=H, timeout=30)
    r.raise_for_status()
    task_id = r.json()["output"]["task_id"]
    deadline = time.time() + timeout
    while True:
        if time.time() > deadline:
            raise TimeoutError(task_id)
        o = requests.get(f"{BASE}/api/v1/tasks/{task_id}", headers=H, timeout=30).json()["output"]
        if o["task_status"] == "SUCCEEDED":
            break
        if o["task_status"] == "FAILED":
            raise RuntimeError(o.get("message") or o.get("code"))
        time.sleep(8)
    with requests.get(o["video_url"], headers=H, stream=True, timeout=120) as c:
        c.raise_for_status()
        with open(out, "wb") as f:
            for chunk in c.iter_content(1 << 20):
                f.write(chunk)

synthesize("wan2.7-t2v", {"prompt": "A fluffy orange kitten playing with yarn"}, {"resolution": "1080P", "duration": 5}, "t2v.mp4")
synthesize("wan2.7-i2v", {"prompt": "The cat slowly tilts its head and blinks", "media": [{"type": "first_frame", "url": "https://example-cdn.com/cat.jpg"}]}, {"resolution": "720P", "duration": 5}, "i2v.mp4")

6. Billing

  • Video seconds × resolution-tier unit price. The requested duration is pre-authorized at create time; the task settles on the delivered seconds (usage.video_duration). The upstream may deliver one extra second (5 s requested, 6 s delivered) — 6 s are billed.
  • A request without a duration is pre-authorized at the default (Wan / Kling 5 s, Veo 8 s) and that default is sent to the supplier; settlement uses the supplier-reported delivered length rounded half-up to whole seconds (5.041 → 5, 5.5 → 6), which may differ from the requested duration by ±1 s.
  • A refused create (400) or a failed generation (FAILED) is not billed and the hold is released.
  • wan2.7 has no silent tier: every request is billed at the audio-tier unit price (see "Audio" above).
  • Unit prices are those shown in the console model list.

Common errors

SymptomCauseFix
Create returns 400resolution / size outside 720P / 1080P; input.prompt missing; input.img_url (or a media first_frame) missing on i2v; input.img_url / input.last_frame_url sent with a t2v model (use wan2.7-i2v); unsupported input key, or an input.media[] type that is unsupported or duplicates a legacy field; ratio outside the allowed values, or disagreeing with aspect_ratio / size; no supplier renders the requested tier right nowFix per the parameter table or switch model / tier
Create returns 400 mentioning has no audio switchThe request carried parameters.audio=false or generate_audio=false; wan2.7 cannot render silenceRemove the field (the official API has no such parameter); strip the audio track after download if you need a silent clip
task_status=FAILEDUpstream could not fetch img_url, or generation failedUse a publicly downloadable direct link
Poll returns task_not_foundtask_id was not created by this keyCheck task_id and the key
/content returns 409 / 404Not completed / artifact expiredPoll to SUCCEEDED; download promptly