feat(alibaba): support wan3 all-in-one video generation (#19445)
Wan3 (wan3.0-video) is one model id that serves text-to-video, image-to-video (first and last frame), and reference-to-video. The existing provider derived both the wire protocol and the generation mode from substrings of the model id (isWan27Model, detectMode), so wan3 fell through both checks: it was classified t2v and sent the legacy wan2.6 shape — parameters.size instead of the resolution tier, no ratio, and input.media never built, silently dropping every reference image and video. This splits protocol detection from mode detection. detectProtocol returns legacy / wan27 / wan3; mode detection stays for the ids that actually name their mode. wan3 builds input.media from whatever the request carries, so a bare prompt is text-to-video, a start image is image-to-video, and references are reference-to-video — with no id suffix involved. Also for wan3: last_frame is a real slot rather than an ignored-with-warning option, the 480P tier is accepted alongside 720P/1080P, the audio boolean is forwarded (wan2.7 suppresses it because audio is always on there), and shot_type warns as it does on wan2.7. reference_audio, file, and link have no top-level call option, so they're reachable through providerOptions.alibaba.media, whose type enum is extended; ratio gains wan3's adaptive default. doStatus now parses and surfaces wan3's extra usage facts — input_video_duration, fps, ratio — as providerMetadata.alibaba.usage. These are spread conditionally, so metadata for wan2.x is unchanged. input_video_duration matters downstream: wan3 counts input video toward its 30s ceiling, and consumers billing on duration need the output figure separated from the total. wan2.6/wan2.7 request shaping is untouched.
J
Josh committed
37892136ad221bbc3cc8e5ea270b6c1109866e1d
Parent: 9de0baf
Committed by GitHub <noreply@github.com>
on 8/25/2026, 12:04:47 AM