Wan 2.7
| Model | Capability | Required fields |
|---|---|---|
wan2.7-t2v | Text to video | input.prompt |
wan2.7-i2v | Image 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) athttps://api.modelgo.aiand use your ModelGo API key asapi_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
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
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
{
"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
| Field | Type | Applies to | Description |
|---|---|---|---|
model | string | all | wan2.7-t2v or wan2.7-i2v |
input.prompt | string | all | Required. Scene and motion description |
input.media[] | object[] | all | Bailian'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_url | string | i2v | Legacy spelling of a first_frame in media; new integrations should use media[] |
input.last_frame_url | string | i2v | Legacy spelling of a last_frame in media |
input.audio_url | string | all | Driving 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_prompt | string | all | Negative prompt |
parameters.resolution | string | all | Tier 720P / 1080P, default 1080P |
parameters.ratio | string | all | Aspect 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.size | string | t2v | Pixel spelling of the same tier, e.g. 1280*720, 1920*1080; if sent together with ratio, the aspect ratios must match |
parameters.duration | int | all | Duration in seconds, default 5 |
parameters.prompt_extend | boolean | all | Let the upstream rewrite the prompt |
parameters.watermark | boolean | all | Add a watermark |
parameters.seed | int | all | Random 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_audioininput.media[](input.audio_urlon 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.audiois not a wan2.7 parameter and the gateway does not send it upstream. - A request that explicitly asks for silence is refused:
parameters.audio=falseor a top-levelgenerate_audio=false/"false"returns400at create time, costs nothing, and is never turned into a clip with sound that is then billed.trueis the same as omitting it and causes no error.
Resolution tiers
| Tier | 16:9 | 9:16 | 1:1 | 4:3 | 3:4 |
|---|---|---|---|---|---|
| 720P | 1280*720 | 720*1280 | 960*960 | 1088*832 | 832*1088 |
| 1080P | 1920*1080 | 1080*1920 | 1440*1440 | 1632*1248 | 1248*1632 |
- For 4:3 / 3:4,
sizealso accepts Bailian's spelling: 720P1104*832/832*1104, 1080P1648*1248/1248*1648— the same tier and price as the spelling in the table. - Only 720P / 1080P are offered.
4Kor asizeoutside the table is refused at create time (HTTP400); 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-t2vat 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 returns400and nothing is charged. inputkeys 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>"}ininput.media[](or the flatinput.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-i2vonly. It cannot be combined withfirst_frame(img_url) ordriving_audio(audio_url); it may be paired withlast_frame. Any violation is refused at creation with400and 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}
curl https://api.modelgo.ai/api/v1/tasks/gw_e99647a0-692d-4fdd-ae46-e1d777e72bf5 \
-H "Authorization: Bearer $MODELGO_API_KEY"When finished:
{
"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 failureoutput.code/output.messagecarry the reason and the task is not billed.- Generation usually takes 1–3 minutes; poll every 5–10 s with backoff.
output.video_urlpoints 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
curl https://api.modelgo.ai/v1/videos/gw_e99647a0-692d-4fdd-ae46-e1d777e72bf5/content \
-H "Authorization: Bearer $MODELGO_API_KEY" -o cat.mp4Streams 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)
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
durationis 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
| Symptom | Cause | Fix |
|---|---|---|
Create returns 400 | resolution / 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 now | Fix per the parameter table or switch model / tier |
Create returns 400 mentioning has no audio switch | The request carried parameters.audio=false or generate_audio=false; wan2.7 cannot render silence | Remove the field (the official API has no such parameter); strip the audio track after download if you need a silent clip |
task_status=FAILED | Upstream could not fetch img_url, or generation failed | Use a publicly downloadable direct link |
Poll returns task_not_found | task_id was not created by this key | Check task_id and the key |
/content returns 409 / 404 | Not completed / artifact expired | Poll to SUCCEEDED; download promptly |