* feat(baoyu-imagine): add DashScope Wan 2.7 image model support Closes #139. Adds the new `wan2.7-image-pro` and `wan2.7-image` model family to the DashScope provider so users can call Wan 2.7 directly through the official Aliyun (Bailian) API instead of going through Replicate. - Register `wan2.7-image-pro` and `wan2.7-image` as a new `wan27` family in the DashScope provider with their own size resolution rules: pixel range `[768*768, 4096*4096]` for `wan2.7-image-pro` text-to-image, `[768*768, 2048*2048]` for `wan2.7-image-pro` with refs and for the base `wan2.7-image` model in any mode, with aspect ratios validated against the documented `[1:8, 8:1]` band. - Allow up to 9 reference images per request (image editing / multi-image fusion). Local files are inlined as base64 data URLs; `http(s)://` paths are forwarded as-is. Other DashScope models still reject `--ref` with a hint to switch to a wan2.7 model or another provider. - Drop `prompt_extend` from the request body for the Wan 2.7 family (not part of the Wan 2.7 API surface) and skip the Qwen-only negative prompt for this family. - Allow `--provider dashscope --ref ...` in `detectProvider` so users can opt into Wan 2.7 reference workflows, while keeping Wan 2.7 out of the auto-detect ref priority list. - Add provider, reference, and usage-example documentation, plus unit tests covering family routing, size derivation across the three pixel-budget modes, ratio rejection, explicit-size validation, and the new `--provider dashscope` ref opt-in path. Made-with: Cursor * fix(baoyu-imagine): force n=1 for DashScope wan2.7 to avoid silent multi-image billing Cross-checked the implementation against the official Wan 2.7 image generation & editing API reference and found that the API defaults `parameters.n` to 4 in non-collage mode (1-4 range, billed per image). baoyu-imagine has single-image save semantics — only the first image in the response is kept — so without an explicit `n: 1` users would silently pay for 3 discarded images per request. - Always send `parameters.n: 1` in the wan2.7 request body - Reject `--n > 1` for wan2.7 with a clear error pointing at the single-image save semantics - Add tests asserting the request body shape (n=1, no prompt_extend, no negative_prompt) and the --n>1 rejection - Document the defaults-vs-skill mismatch in the dashscope reference Made-with: Cursor * Fix DashScope Wan 2.7 review feedback
4.5 KiB
DashScope (阿里通义万象)
Read when the user picks --provider dashscope, sets default_model.dashscope, or asks for Qwen-Image behavior. The SKILL.md only names the default — this file covers model families, sizing rules, and limits.
Model Families
qwen-image-2.0* — recommended modern family. Members: qwen-image-2.0-pro, qwen-image-2.0-pro-2026-03-03, qwen-image-2.0, qwen-image-2.0-2026-03-03.
- Free-form
sizein宽*高format - Total pixels must be between
512*512and2048*2048 - Default ≈
1024*1024 - Best choice for custom ratios (e.g.
21:9) and text-heavy Chinese/English layouts
Fixed-size family — qwen-image-max, qwen-image-max-2025-12-30, qwen-image-plus, qwen-image-plus-2026-01-09, qwen-image.
- Only five sizes allowed:
1664*928,1472*1104,1328*1328,1104*1472,928*1664 - Default is
1664*928 qwen-imagecurrently has the same capability asqwen-image-plus
wan2.7-image* — multimodal Wan 2.7 family. Members: wan2.7-image-pro, wan2.7-image.
- Free-form
sizein宽*高format, plus aspect-ratio inference wan2.7-image-protext-to-image (no--ref): total pixels in[768*768, 4096*4096], ratio in[1:8, 8:1]wan2.7-image-prowith reference images andwan2.7-image(all scenarios): total pixels in[768*768, 2048*2048], ratio in[1:8, 8:1]- Default:
1024*1024(--quality normal) or2048*2048(--quality 2k); 4K requires explicit--size - Supports up to 9 reference images in
--ref(image editing / multi-image fusion) - Reference images are sent inline as base64 (or passed through if the path is an
http(s)://URL) - API does NOT use
prompt_extend; the skill omits it for this family - The Wan 2.7 API defaults
nto 4 in non-collage mode and bills per generated image. baoyu-imagine forcesn: 1and rejects--n > 1to avoid silently paying for and discarding extra images.
Legacy — z-image-turbo, z-image-ultra, wanx-v1. Only use when the user explicitly asks for legacy behavior.
Size Resolution
--sizewins over--ar- For
qwen-image-2.0*: prefer explicit--size; otherwise infer from--arusing the recommended table below - For
qwen-image-max/plus/image: only use the five fixed sizes; if the requested ratio doesn't fit, switch toqwen-image-2.0-pro - For
wan2.7-image*: explicit--sizeis validated against the per-mode pixel/ratio limits; otherwise the size is derived from--arand--quality(normal≈ 1K,2k≈ 2K). To request 4K withwan2.7-image-protext-to-image, pass--sizeexplicitly (e.g.4096*4096,3840*2160) --qualityis a baoyu-imagine preset, not an official DashScope field. The mapping ofnormal/2konto theqwen-image-2.0*andwan2.7-image*tables is an implementation choice, not an API guarantee
Recommended qwen-image-2.0* sizes
| Ratio | normal |
2k |
|---|---|---|
1:1 |
1024*1024 |
1536*1536 |
2:3 |
768*1152 |
1024*1536 |
3:2 |
1152*768 |
1536*1024 |
3:4 |
960*1280 |
1080*1440 |
4:3 |
1280*960 |
1440*1080 |
9:16 |
720*1280 |
1080*1920 |
16:9 |
1280*720 |
1920*1080 |
21:9 |
1344*576 |
2048*872 |
Reference Images
- Only
wan2.7-image-proandwan2.7-imageaccept--ref. Other DashScope models (qwen-image-2.0*, qwen-image-max/plus/image, legacy) reject--refand the user is steered to a different provider/model. - Up to 9 reference images per request. Local files are inlined as base64 data URLs;
http(s)://URLs are forwarded as-is. - Supplying any
--refautomatically clamps the wan2.7-image-pro pixel ceiling from 4K to 2K (the API only supports 4K for pure text-to-image with no image input).
Not Exposed
DashScope APIs also support negative_prompt, prompt_extend, watermark, thinking_mode, seed, bbox_list, enable_sequential, and color_palette. baoyu-imagine does not expose them as CLI flags today; the wan2.7 family relies on the API defaults (e.g. thinking_mode=true). The skill always sends n=1 for wan2.7 — if you want grid/collage mode you currently need to call the API directly.