POST
javascript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 const axios = require('axios'); const fs = require('fs'); const path = require('path'); async function toB64(imgPath) { const data = fs.readFileSync(path.resolve(imgPath)); return Buffer.from(data).toString('base64'); } const api_key = "YOUR API-KEY"; const url = "https://api.segmind.com/v1/wan2.7-image"; const data = { "prompt": "A cinematic aerial view of a dense green forest at golden hour, rays of sunlight piercing through the canopy, misty valleys below, photorealistic, 8K", "image": "toB64('undefined')", "negative_prompt": "blurry, low quality, distorted, watermark", "size": "2K", "watermark": false }; (async function() { try { const response = await axios.post(url, data, { headers: { 'x-api-key': api_key } }); console.log(response.data); } catch (error) { console.error('Error:', error.response.data); } })();
RESPONSE
image/jpeg
HTTP Response Codes
200 - OKImage Generated
401 - UnauthorizedUser authentication failed
404 - Not FoundThe requested URL does not exist
405 - Method Not AllowedThe requested HTTP method is not allowed
406 - Not AcceptableNot enough credits
500 - Server ErrorServer had some issue with processing

Attributes


promptstr *

Describe image: subject, setting, style, and mood.


imageimage ( default: 1 )

Reference or source image for editing or style transfer.


negative_promptstr ( default: blurry, low quality, distorted, watermark )

Elements to exclude. Removes artifacts and unwanted styles.


sizeenum:str ( default: 2K )

Output resolution. 1K for drafts, 2K for production quality.

Allowed values:


seedint ( default: 1 )

Fixed seed for reproducible results. Leave empty for unique.


watermarkbool ( default: 1 )

Add AI watermark to output. Disable for production assets.

To keep track of your credit usage, you can inspect the response headers of each API call. The x-remaining-credits property will indicate the number of remaining credits in your account. Ensure you monitor this value to avoid any disruptions in your API usage.

Wan 2.7 Image Generation — Text-to-Image & Editing AI

What is Wan 2.7?

Wan 2.7 is Alibaba's latest image generation and editing model, released in April 2026. Built on a Flow Matching architecture, it supports text-to-image generation, instruction-based image editing, and multi-reference composition — all through a single unified API. Wan 2.7 is designed for professional workflows where prompt fidelity, text rendering accuracy, and compositional control matter most.

Unlike previous generations, Wan 2.7 incorporates a reasoning step before generation: the model analyzes composition logic, spatial relationships, and semantic intent to produce outputs that closely match complex, multi-element prompts. This makes it especially effective for e-commerce campaigns, marketing visuals, storyboards, and any application requiring precise adherence to detailed descriptions.

Key Features

  • 2K resolution output (up to 4K with Wan 2.7 Pro)
  • Instruction-based image editing — add, move, or transform elements while preserving subject identity
  • Advanced text rendering — accurately renders readable text in 12 languages within images
  • Multi-reference support — use up to 9 reference images to guide composition
  • Color palette control — specify exact color tones for brand-consistent output
  • Flow Matching architecture — faster convergence and cleaner visuals compared to traditional diffusion

Best Use Cases

Wan 2.7 excels in production-grade creative and marketing workflows: generating product visuals with precise color specifications, creating storyboards and architectural concept art, producing e-commerce variants from reference images, rendering typographic designs and text overlays, and batch-generating consistent visual assets for campaigns.

Prompt Tips and Output Quality

Write detailed prompts that specify subject, setting, lighting, and composition. For complex multi-element scenes, describe spatial relationships explicitly — for example, "a red chair in the foreground left of center, with a blurred office background." For image editing tasks, reference the source elements to preserve and clearly describe what should change. Use negative_prompt to exclude unwanted artifacts or visual styles.

Set size to 1K for fast iteration and previews, and 2K for final production output.

FAQs

Does Wan 2.7 support image editing? Yes. Pass a reference image via the image parameter with an editing instruction in prompt to modify specific elements while preserving the rest of the composition.

Can it render text accurately inside generated images? Wan 2.7 supports multilingual text rendering across 12 languages, making it one of the strongest models for images containing signs, labels, or typography.

What resolution does Wan 2.7 support? The standard version outputs up to 2K (~2048px). The Pro variant supports 4K resolution.

How does Wan 2.7 compare to Midjourney or FLUX? Wan 2.7 outperforms both on prompt adherence and text rendering for complex, multi-element scenes. Midjourney has an edge for purely artistic aesthetics; FLUX is faster for simple single-subject prompts.

Can I use multiple reference images? Yes. Wan 2.7 supports up to 9 reference images for guided multi-reference composition.

How do I get reproducible results? Set the seed parameter to a fixed integer. Reusing the same seed with the same prompt will produce the same output.