Wan Text to Image
Calls Ali wan2.7-image-pro to perform text-to-image generation.
The public calling convention keeps top-level model, input, response_format, and exposes size, n, watermark, thinking_mode, enable_sequential, color_palette, seed as top-level fields. The prompt is placed in input.messages[0].content[0].text. The request body does not accept a top-level parameters field.
Authorizations
Pass Authorization: Bearer <token> in the request header.
Body
Model name. Available value: wan2.7-image-pro.
wan2.7-image-pro Unified response format. Supported values: url or b64_json.
url, b64_json Controls output image resolution. Supports two modes (do not mix):
Mode 1: Resolution preset (recommended)
Supported presets: 1K, 2K (default), 4K.
- Text-to-image (no input image, non-sequential): supports 1K, 2K, 4K.
- Other scenarios: supports 1K, 2K.
- Pixel totals: 1K = 1024×1024, 2K = 2048×2048, 4K = 4096×4096.
- With input image: output aspect ratio matches the last input image, scaled to the selected resolution.
- Without input image: output is square.
Mode 2: Custom width×height
Format: {width}*{height}, e.g. 1024*768.
- Text-to-image: total pixels [768×768, 4096×4096], aspect ratio [1:8, 8:1].
- Other scenarios: total pixels [768×768, 2048×2048], aspect ratio [1:8, 8:1].
Note: actual output dimensions may differ slightly from the specified values.
Important: n directly affects cost. Cost = unit price × number of successfully generated images. Confirm the model pricing before calling.
Required range: 1 <= n <= 12.
Non-sequential mode: range 1-4, default 1.
Sequential mode: range 1-12, default 12. The actual count is determined by the model and will not exceed n.
1 <= x <= 12Whether to add a watermark. The watermark is positioned at the bottom-right corner with the text 'AI生成'. false (default): no watermark. true: add watermark.
Whether to enable thinking mode. Default true (enabled). When enabled, the model enhances reasoning to improve output quality, but increases generation time. Only effective when sequential mode is disabled. The gateway maps this to upstream parameters.thinking_mode.
Controls generation mode. false (default): normal mode. true: enable sequential (group) image output mode.
Custom color palette. An array of objects containing hex color and ratio. Requires 3-10 colors, recommended 8. Only available when sequential mode is disabled (enable_sequential=false). The gateway maps this to upstream parameters.color_palette.
Random seed. Range [0, 2147483647].
Using the same seed value helps keep generation results relatively stable. If not provided, the algorithm automatically uses a random seed.
Note: the generation process is probabilistic; the same seed does not guarantee identical results every time.
x >= 0