Skip to main content

Text-to-image

With the text-to-image API, you can create brand-new images based on text descriptions. Alibaba Cloud Model Studio provides the Wan, Qwen-Image, and z-image series models.

Online experience: Singapore | Beijing Online experience provides a no-code web-based text-to-image feature. Simply enter a text description on the page to generate images directly:
  • Experience Center: Click the online experience link above (Singapore, Beijing) to enter it, where you can select a model, set the output resolution, enable smart rewriting, and then submit the generation directly.
To integrate text-to-image capabilities into your own application, use the API calling method below.

Model performance

Qwen (Qwen-image)

Complex layout

9cea00ec-c9bf-9f35-909b-0d8c7b03f6a6_qwen_image3_serving_output_0-2026-08-06-20-13-11

Long paragraphs

e03efee1-35b1-9109-a988-e3977add0fac_qwen_image3_serving_output_0

Realistic portrait

2beecb7f-c3c3-9c10-9458-04325512bb8a_qwen_image3_serving_output_0

UI design

image (92)

PPT

image (90)

Illustration design

e38cc145-78f6-92a7-9bdb-141be17dba04_qwen_image3_serving_output_0

Complex layout:
Create a 16:9 wide horizontal e-commerce storefront hero banner infographic for “TodoTi,” a Mexican-inspired colorful lifestyle brand. The design should look like a professional online shop header for desktop and tablet, with clear visual hierarchy, festive marketing energy, and readable English typography.

Background: vibrant Mexican folk color palette of bright yellow, warm red, peacock blue, and emerald green, blended with soft watercolor washes, subtle handmade paper texture, and fine grain. The top and bottom edges are decorated with traditional papel picado cut-paper banners made of repeating diamonds, triangles, and wave shapes in alternating yellow, red, green, and purple. The papel picado should look light and gently fluttering, with cut-out areas revealing a deep starry-night blue background. Below the top papel picado and above the bottom papel picado, add a continuous Aztec geometric border of stepped lines and diamond motifs in white and antique gold.

Four corners: add small 3D decorative Talavera ceramic pots with blue-and-white floral patterns, glossy glaze highlights, and miniature potted cacti with rich green texture and fine spines. These corner elements should balance the composition and add handcrafted detail.

Left third: brand identity zone. Feature a large 3D wordmark “TodoTi.” The letter “T” extends into two green cactus pads with clear vein texture; the letter “o” contains a red-and-yellow sunburst with sixteen thin rays; the curve of the letter “d” is decorated with blue-and-white Talavera ceramic patterns featuring three peonies and winding vines; the dot of the letter “i” is a glossy red cherry tomato with a white highlight. The wordmark has bold black outlines, high-saturation gradient fills, and a soft drop shadow.

Below the wordmark, place the slogan: “TodoTi — Your Colorful Lifestyle Hub.” The slogan is in rounded bold white sans-serif with a subtle red glow, centered and highly legible. Below it, add a smaller handwritten-style subtitle in bright yellow: “Mexican-inspired warmth to brighten every day.”

Behind the wordmark, add a faint semi-circular Aztec sun calendar relief in antique gold and bronze, with fine geometric patterns and a stylized face motif featuring diamond eyes and a rectangular mouth. The relief should glow softly with warm golden light. On the left edge, stack three small circular badges with peacock-blue backgrounds, white text, and stitched dashed borders: “Curated Picks,” “Direct Sourcing,” and “Thoughtful Service.”

Center-left: a cheerful Mexican folk-art lifestyle illustration. A cute Catrina skeleton girl wears a wide straw sombrero with red-and-green woven tassels and a colorful embroidered poncho in warm red and peacock blue. Her poncho is decorated with Aztec geometric patterns and blooming marigolds with radiating petals. Her face has elegant Day of the Dead makeup: black heart-shaped eye details with white dashed outlines, red rose cheek motifs, and a warm friendly smile. She pushes a vintage wooden cart with mosaic-tile wheels in blue, white, yellow, and green.

The cart is filled with clearly visible everyday products with small clean English labels. Include a Talavera ceramic mug labeled “Talavera Ceramic Mug — Heat-resistant, underglaze art, 350ml”; a handwoven sisal basket labeled “Handwoven Basket — Natural sisal, sturdy, 30x20x15cm”; a green cactus-shaped scented candle with a soft flame labeled “Cactus Candle — Plant essential oil, calming, 40-hour burn”; and colorful Mexican throw pillows labeled “Mexican Pillow — Cotton-linen, removable cover, 45x45cm.” The illustration background is a sunny desert oasis with real cacti, soft clouds, warm side-backlight, and a thin golden rim light on the illustrated elements.

Center-right: product category navigation in a 2x2 grid of rounded rectangle cards with even spacing, 15px rounded corners, and subtle paper texture. Card 1, red background, title “Home Textiles” in bold white, with a flat icon of a woven wall tapestry with tassels; body text: “Rugs, pillows, tablecloths, curtains. Premium cotton-linen with vivid colors that bring Mexican warmth home.” Card 2, peacock-blue background, title “Kitchen & Dining” in bold white, with a Talavera ceramic plate icon; body text in bright yellow: “Bowls, cups, tableware, storage. Handcrafted ceramic texture makes every meal feel special.” Card 3, bright yellow background, title “Bath & Care” in bold dark brown, with a cactus-shaped soap dish icon; body text in dark brown: “Towels, soap dishes, toothbrush cups, shelves. Water-resistant materials for a fresh, relaxing bath space.” Card 4, emerald-green background, title “Lifestyle Goods” in bold white, with a colorful pinwheel icon; body text in white: “Hangers, hooks, tissue boxes, trash bins. Practical, beautiful details that elevate daily living.”

Right side: promotional zone shaped like a large Mexican mariachi guitar. The guitar body is warm wood with red-and-gold floral vine carvings, the neck extends upward, and the strings are silvery with a metallic shine. Inside the guitar body, place the main promotion. At the top, add a red ribbon banner with white bold text: “TodoTi Grand Opening Fiesta.” Below it, display a large offer: “Spend $199, Save $50,” with “Spend” and “Save” in white medium text and the numbers in oversized yellow-and-red 3D type. Below the offer, add smaller handwritten white text: “New customers: $20 off first order + free shipping.”

At the bottom of the guitar body, place three small circular badges with dark blue backgrounds, white text, and thin gold outlines: “7-Day Easy Returns,” “Fast Shipping,” and “Authentic Quality.” From the guitar neck, let several colorful ribbons flow outward with tilted text: “Now through the end of the month.”

Bottom area: brand story and culture zone against a deep blue night sky with glowing white five-pointed stars and black cactus silhouettes. On the left, place a title block: “About TodoTi” in bold white with a soft yellow glow. To the right, create three equal columns. Column 1 heading in bright yellow with a white underline: “Design Philosophy”; body in light gray-white: “TodoTi brings the color and craft of Mexican folk art into modern home essentials, blending Aztec motifs and Talavera patterns with everyday practicality.” Column 2 heading: “Quality Promise”; body: “We carefully select trusted global suppliers and test every product for safe, durable, and eco-friendly quality.” Column 3 heading: “Lifestyle Philosophy”; body: “Life is better in color. TodoTi helps you celebrate daily moments with warmth, joy, and vibrant Mexican-inspired energy.”

Very bottom: a slim interactive guidance bar above the Aztec border. Use a translucent frosted-white background with a soft blur. Left side: “Get more home inspiration from @TodoTiOfficial” in dark brown, aligned with a small official badge icon. Center: a white rounded search box with a magnifying-glass icon and placeholder text: “Search everyday essentials and start a colorful life” in warm red. Right side: a headset customer-service icon with dark brown text: “Questions? Customer Care: 400-888-TODO | 9:00–22:00.”

Overall style: vibrant, festive, handcrafted, authentic Mexican-inspired e-commerce banner, modern retail marketing layout, balanced composition, clean information hierarchy, high readability, warm lighting, rich details, professional storefront hero image. All on-image text must be in English only, with no Chinese characters, no misspellings, and clean legible typography.
Extra-long paragraphs:
Vertical Western European 19th-century illustrated poetry page, Romantic maritime farewell theme, international English visual tradition, not an East Asian painting. The composition is a vertical art print or vintage book page with aged ivory paper, fine engraved linework, muted blue-gray watercolor washes, and elegant negative space. The main feature is a long English poem rendered clearly in elegant English copperplate-inspired calligraphy, highly legible, English alphabet only, standard left-to-right reading order, top-to-bottom layout, correct punctuation, exact line breaks, natural ink pressure, dark sepia-black lettering, subtle vintage letterpress texture, refined international typography.

Below and around the text, illustrate a cold twilight seashore: gray stones beside the sea, a small boat floating near the shore, distant ships moving toward a haven under low hills, pale evening mist over the water, faint moonlight, soft ripples, a lonely coastal atmosphere, melancholic but restrained. The mood is poetic, timeless, and elegant, like a Victorian English maritime lyric. No Chinese characters, no Chinese painting style, no seals, no stamps, no modern objects, no illegible glyphs, no random letters.

Render exactly the following 12 lines from Alfred, Lord Tennyson's public-domain poem “Break, Break, Break”; do not render the title or author name:

Break, break, break,
On thy cold gray stones, O Sea!
And I would that my tongue could utter
The thoughts that arise in me.
O well for the fisherman's boy,
That he shouts with his sister at play!
O well for the sailor lad,
That he sings in his boat on the bay!
And the stately ships go on
To their haven under the hill;
But O for the touch of a vanish'd hand,
And the sound of a voice that is still.

High resolution, masterful long-form English text rendering, poetic, elegant, museum-quality Western illustrated book page.
Realistic portrait:
帮我生成一张生活化美食男生人像写真,呈现实拍电影质感。画面主体是一位24岁左右的年轻男生,五官清爽干净,眉眼温和,皮肤自然清透,保留真实的肤质细节。他穿着质地柔软的米白色粗棒针织毛衣,内搭纯白T恤微微露出领口,展现出温暖、精致且松弛的生活气息。人物坐在温馨的西餐厅餐桌前,身体微微前倾,右手握着银质刀叉正在轻轻切开盘中的惠灵顿牛排,左手自然轻扶着桌面边缘。他微微侧头看向镜头,嘴角带着若有似无的松弛浅笑,眼神温柔且带有生活感。木质桌面上摆满了精致的西餐餐食,旁边有装着琥珀色饮品的复古高脚杯和一小瓶淡雅的复古插花。人物身后是通透的玻璃墙面,上面印有浅金色的法文手写体菜单“Menu du Jour”,文字以丝印工艺自然贴合在玻璃表面,并带有轻微的环境反光。环境采用暖黄色室内顶光,光线柔和地洒在人物面部和桌面食物上,食物表面泛着诱人的高光,背景玻璃透出室外微弱的冷色环境光,形成电影感十足的冷暖光影对比。采用近距离平视取景,机位略带侧前方的呼吸感,避免死板居中,小景深让背景的玻璃墙面和餐厅环境轻微虚化,形成温暖的散景光斑,前景的插花和饮品边缘也带有自然的虚化过渡,整体色调温暖治愈,充满浓郁的生活氛围与美食诱惑。
UI design:
这张图片是一款沉浸式亚洲雨林声音探索体验网站的宽屏电脑端界面设计,整体氛围暗沉静谧,设计灵感源自老式野外录音设备与模拟科学仪器。整体配色以深邃祖母绿、浓郁黑曜石黑与柔和大地棕为主,营造出安宁沉静的氛围。界面搭载细微水汽与薄雾特效,柔和斑驳的光影折射效果模拟阳光穿透茂密树冠的景象,背景融入纸张细纹、叶脉等自然肌理。整体画面写实度极高,风格对标英国广播公司高端自然纪实纪录片,构图富有电影质感,渲染细节极致精细。
页面最顶端横贯一整条极简半透明导航栏。最左侧为品牌标识,由精致线条绘制的老式模拟麦克风与龟背竹叶交织而成,搭配柔和米奶油色优雅衬线字体文字“RAINFOREST ARCHIVE”。导航栏右侧是导航菜单,包含四个极简文字链接,字体与颜色和品牌名保持一致:“Expeditions”、“Species”、“Field Notes”、“About”。
页面上三分之二区域为主视觉横幅板块。背景是一张画质超清、氛围感浓郁的古老亚洲龙脑香科雨林实景图,林间萦绕着轻柔绵延的薄雾;前景虚化的深绿色蕨类枝叶形成自然暗角。横幅板块左侧叠加主标题,采用大号高对比度精致衬线字体,文字为“Voices of the
Canopy”。标题正下方是字号更小、质感雅致的副标题,浅米奶油色,内容为“An auditory journey through the ancient
dipterocarp forests of Southeast Asia.”。文字带有轻微打字机质感,字符排布存在细微自然错落,强化复古模拟设备的复古氛围。
横幅板块中下位置是核心音频交互组件:一台复刻老式野外模拟录音机的精密播放器,原型为经典纳格拉或马兰茨磁带机。播放器机身采用拉丝深枪灰色金属材质,带有细微自然划痕与使用磨损痕迹;配有两个大型滚花金属旋钮,旋钮上印有小巧清晰的无衬线刻印文字“GAIN”与“MONITOR”。设备中央是经典音量表,内置温润柔和的琥珀色背光,表内指针轻靠零刻度位置。音量表右侧设有重型实体拨动开关,拨至上方代表“PLAY”播放状态。音频播放时,音量表向外缓缓扩散出同心波纹特效,形似轻柔水纹或细微声波,采用半透明雾绿色调,与薄雾背景自然融合。
横幅板块下方,页面布局切换为简约纪实风网格,用作声音素材库区域。板块顶部配有精致小型标题,全大写字母加宽字距排版,文字为“CURRENT EXPEDITIONS”。标题下方采用规整双栏网格,陈列四张风格各异的声景卡片。
左上第一张卡片:背景是氛围感暗沉的薄雾河岸缩略图,标题文字“Dawn Chorus in Danum Valley”,下方标注信息“Location: Sabah, Borneo”、“Duration: 42:15”,卡片右侧配有一枚小巧琥珀色标识,标注“Currently Playing”。
右上第二张卡片:画面为湿润宽大绿叶特写,标题文字“Monsoon Rain on Broadleaves”,标注信息“Location: Khao Yai, Thailand”、“Duration: 1:15:30”,附带细线条边框按钮,文字“Listen”。
左下第三张卡片:画面是黄昏时分森林树冠朦胧剪影,标题文字“Nocturnal Gibbon Calls”,标注信息“Location: Khao Sok, Thailand”、“Duration: 58:02”,附带细线条边框按钮,文字“Listen”。
右下第四张卡片:画面为树皮纹理微距特写,标题文字“Hornbill Wingbeats”,标注信息“Location: Taman Negara, Malaysia”、“Duration: 24:40”,附带细线条边框按钮,文字“Listen”。
声景网格最右侧,纵向贯穿该下半区域的竖版面板,设计复刻老式野外科学记录本内页。纸张带有柔和复古米黄肌理,页面右下角留有淡咖啡渍痕迹。面板标题采用打字机等宽字体,文字“FIELD NOTES”;正文墨水色调雅致、微微褪色,内容为:
“Recorded using
parabolic microphones
and Nagra IV-S
tape recorders.
Humidity: 94%
Temp: 24°C”
文字旁配有深棕乌墨手绘精致猪笼草植物速写。
页面最底端是极简页脚,整页宽度贯通,上方设有一条细深绿色分隔线。页脚左侧文字“Copyright 2024 Rainforest Archive”,右侧文字“Funded by the Wildlife Conservation Society”,两处文字均采用柔和低调的精致小号衬线字体。
PPT creation:
这是一张宽高比为 16:9 的专业教育类 PPT 幻灯片,整体背景采用极淡的蓝灰色柔和渐变,叠加有极低透明度的正弦波暗纹与微弱的网格点阵纹理,营造出严谨的物理学术氛围与科技感。画面顶部居中位置是主标题区域,文字为巨大的深藏青色无衬线粗体“AC Circuit Anaysis: Resistor with Sinusoidal Voltage”,标题下方紧贴一条明亮的橙色细横线作为视觉分割,横线两端带有微小的圆形端点装饰,增强版式的仪式感。画面主体分为左右两列,采用严谨的栅格对齐系统,左右两列宽度比例约为 1:1.2,确保右侧复杂的公式计算拥有充足的展示空间。左侧列顶部是一个圆角矩形橙色标题栏,内部居中显示白色加粗文字“PROBLEM DATA & WAVEFORM”,标题栏底部带有轻微的投影,使其具有浮起的立体质感。橙色标题栏下方是一个浅灰白色的圆角数据卡片,卡片边缘有极细的浅蓝色边框,内部垂直排列四个数据要点,每个要点左侧配有纯灰色的极简线性图标,依次为电阻符号、波浪线、电压箭头和时钟符号。四个要点的文字采用深灰色清晰字体,依次为“Resistor (R) = 10 Ω”、“Waveform = Sinusoidal”、“Peak Voltage (V subscript p) = 311 V”、“Period (T) = 0.02 s”,文字排版整齐,行距舒适,关键数字使用稍深的颜色进行视觉强调。数据卡片下方是图表区域,顶部居中显示深灰色图表标题“Voltage vs. Time”。图表主体是一个带有浅灰色网格线的二维坐标系,垂直 Y 轴左侧标有深灰色文字“Voltage (V)”,刻度线旁分别标有白色背景框包裹的深蓝色文字“+311”、“0”和“-311”。水平 X 轴下方标有深灰色文字“Time (s)”,刻度线旁标有“0.01”和“0.02”。坐标系中央绘制了一条平滑、饱满且带有轻微发光效果的鲜红色正弦波曲线,曲线线条粗细适中,展现出完美的周期性。在正弦波的波峰处,有一条深蓝色的垂直双向箭头指示振幅,箭头旁标有深蓝色文字“V subscript p = 311 V”。在 X 轴的一个完整周期上方,有一条深蓝色的水平尺寸标注线,两端带有垂直引出线,中间标有深蓝色文字“T = 0.02 s”。图表区域整体留白充足,视觉焦点集中在红色波形上。右侧列顶部同样是一个圆角矩形橙色标题栏,与左侧标题栏高度对齐,内部居中显示白色加粗文字“SOLUTION STEPS & CALCULATIONS”。橙色标题栏下方垂直排列四个浅蓝色渐变的圆角卡片,卡片之间保持均匀的垂直间距,内部留有充足的呼吸空间。第一个卡片左上角有一个深蓝色的圆形编号徽章,内部显示白色数字“1”。卡片标题为深蓝色加粗文字“1. Maximum Current (I subscript p)”。下方正文分为三行,采用标准数学公式的视觉样式排版,呈现为分数线、上下标和根号的优雅形态,文字内容为深灰色“Formula: Ohm’s Law, I subscript p = V subscript p over R”,接着是计算过程“I subscript p = 311 V over 10 Ω = 31.1 A”。卡片右下角有一个亮黄色底色的圆角高亮框,内部显示加粗的深蓝色文字“I subscript p = 31.1 A”。第二个卡片左上角编号徽章显示“2”,标题为“2. AC Voltmeter Reading (V subscript rms)”。正文包含说明“Voltmeters read RMS value.”,公式“V subscript rms = V subscript p over square root of 2”,以及计算“V subscript rms = 311 V over 1.414 ≈ 220 V”,右下角高亮框显示“V subscript rms ≈ 220 V”。第三个卡片编号徽章显示“3”,标题为“3. Actual Power Dissipated (P subscript avg)”。正文包含“Using RMS values.”,公式“P subscript avg = (V subscript rms) squared over R”,计算过程“P subscript avg = (220 V) squared over 10 Ω = 48400 over 10 W = 4840 W”,右下角高亮框显示“P subscript avg = 4.84 kW”。第四个卡片编号徽章显示“4”,标题为“4. Joule Heat in Half Cycle (Q subscript half)”。正文包含“Energy = Power × Time”,时间计算“Time = T over 2 = 0.01 s”,主计算“Q subscript half = P subscript avg × (0.01 s) = 4840 W × 0.01 s = 48.4 J”,右下角高亮框显示“Q subscript half = 48.4 J”。四个卡片的高亮框统一位于右下角,形成整齐的视觉对齐与阅读动线。画面最底部是一条极细的浅灰色横向分隔线,分隔线下方居中显示浅灰色小号无衬线字体“Experimental Physics - AC Circuits Analysis Module”。页脚区域保持极简,其余背景保持纯图形与留白。整张幻灯片色彩系统以深藏青、亮橙色、浅蓝灰和纯白为主,红色波形与黄色高亮框作为视觉点缀,打破了单调,提升了画面的活力与专业度。所有文字边缘锐利,对比度极高,确保在投影或屏幕上清晰可读。光影处理克制,仅通过卡片底部的微弱投影和标题栏的轻微高光来增强层次感,整体呈现出高度成熟、结构清晰、信息饱满的专业物理教学课件质感。
Illustration design:
这幅画作以柔和的米白色水彩纸为底,呈现一幅手绘水彩插图。纸张表面展现出传统植物艺术的特征,包括清晰可见的颜料颗粒和湿画法带来的柔和色彩晕染。画面上方中央区域绘有一簇簇紫罗兰和三色堇。花瓣由淡紫色、深紫色和淡紫色渐变交织而成,花心呈金黄色。花朵旁点缀着一片翠绿色的小叶,以半透明的水彩晕染和精细的叶脉刻画而成。柔和的定向光线照亮画面,突显了水彩纸的质感和颜料的微妙变化。在花卉图案正下方,纸张下半部分水平居中的位置,是“Виолета”字样。该字样以弧形书法体书写,并使用了金属金色墨水。字母造型采用流畅、连续的笔画,并略带浮雕立体感,在光线照射下呈现出柔和的金属光泽。

Wan

Portrait photography

p1023523-转换自-png

Realistic photography

p1023409-转换自-png

Painting styles

p1023526-转换自-png

Text generation

p1023535-转换自-png

Poster design

p1023546-转换自-png

Image set generation

p1023532-转换自-png

Portrait photography: hyper-realistic Scandinavian woman portrait, flowing platinum blonde hair and piercing blue eyes with prominent freckles, sharp intellectual gaze, Nordic cold-toned directional lighting creating icy atmosphere, minimalist modern styling with clean lines, shallow depth-of-field blurred cold-gradient background, authentic Nordic facial features and porcelain skin texture.Realistic photography: fish-eye perspective forest scene with dramatic perspective distortion, ultra-detailed red fox staring into lens with piercing amber eyes, hyper-realistic fur texture showing individual guard hairs and undercoat layers, radially warped trees forming circular background patterns, watercolor painting style with translucent washes and organic pigment bleeding, soft pastel palette of moss green and earth ochre tones, painterly lighting with atmospheric glow through canopy gapsPainting genre: Vintage oil painting style pastoral song, a farmer herding sheep across a meadow full of wildflowers, a windmill in the distance turning under blue sky and white clouds, smoke curling from the chimney of a wooden house, bright and soft colors, full of tranquility and comfort.​Text generation: A page from a botanical atlas, hand-drawn watercolor style, depicting a "dandelion" with labels annotating the names of its various parts.Poster design: Cinematic poster scene: Extreme macro close-up of eye in wooden crack. Minimalist monochrome, watercolor-CGI fusion, low saturation. Slow push-in with tremor for surreal intensity. Vast negative space, hidden title. Optimized for immersive video generation.Image set generation: The life memories of an elderly man, four portraits in different frames, depicting his childhood (black-and-white photo), youth (military uniform photo), middle age (business suit at work), and later years (photo with his wife).

Model selection

  • qwen-image-3.0-pro: Flagship quality, supports intelligent prompt rewriting, excels at text rendering, and can precisely generate Chinese and English text that fits physical materials.
  • qwen-image-2.1-pro: Best balance of speed, quality, and cost. Image-to-image supports passing in up to 10 reference images, and it can automatically decide whether to output a normal image or an image with a transparent channel based on the prompt.
  • qwen-image-2.1-turbo: Ultimate cost-effectiveness, the best overall value in the Qwen-Image series. Image-to-image supports passing in up to 10 reference images, and it can automatically decide whether to output a normal image or an image with a transparent channel based on the prompt.

QuickStart

Prerequisites

Before calling, please obtain and configure an API Key, and then set the API Key as an environment variable. If you call through the DashScope SDK, you also need to install the SDK.

Sample Code

The following examples use the synchronous call method. The Qwen-Image series also supports asynchronous calls. For how to call Wan series models, see the corresponding API reference documentation.
  • Python
  • Java
  • curl
  • dashscope CLI
import os
import base64
import mimetypes
import dashscope

# This configuration is for the Singapore region. Replace {WorkspaceId} with your actual workspace ID. The region value varies by region.
# If the environment variable is not configured, replace the following line with your Model Studio API key: api_key="sk-xxx"
# API keys differ by region. Get an API key: https://www.alibabacloud.com/help/model-studio/get-api-key
client = dashscope.Client(
    api_key=os.getenv("DASHSCOPE_API_KEY"),
    workspace="{WorkspaceId}",
    region="ap-southeast-1",
)

response = client.multimodal.chat.create(
    model="qwen-image-3.0-pro",
    messages=[{
        "role": "user",
        "content": [
            {"text": "画面是一张竖幅户外人像摄影,整体从上到下呈现温暖的午后街景氛围。顶部左侧到上方大面积被深绿色藤蔓和橙色小花覆盖,花叶从建筑檐口自然垂落,受阳光照射的叶片呈黄绿色高光,阴影处则偏深绿,形成浓密而柔和的背景层次。左上至中上区域是一块深蓝色横向招牌,招牌表面较暗、略带磨砂质感,上面以白色哥特体大字写着 Il Messaggero,文字位于画面左侧偏上,部分被前景花叶轻微遮挡,字体高对比、带装饰性尖角和粗细变化。招牌下方是报刊亭或书报摊的玻璃展示窗,黑色金属框架将橱窗分隔成多个矩形区域,内部陈列着许多报纸、杂志和书刊封面,但大多因景深虚化和光线反射而难以辨读,形成浅色纸张与深色边框交错的背景纹理。画面右上方是强烈的逆光区域,阳光从街道尽头照入,背景建筑被虚化成米灰色块面,边缘柔和,呈现明显的浅景深效果。画面中部偏右是一名年轻成年女性的半身至膝上人像,她回头面向镜头微笑,身体略向右转,肩背朝向观者,姿态自然放松。她有长而浓密的黑色波浪卷发,发丝被逆光勾勒出金色轮廓光,发梢在右侧向外散开,显得轻盈蓬松。她肤色白皙,脸型柔和偏鹅蛋形,眉形细致,眼睛明亮,眼妆清透,睫毛明显,面部带有自然高光,唇部为柔和珊瑚红色,笑容露齿,表情亲切明朗。她佩戴小巧耳饰,身穿黑色细肩带露背连衣裙,面料颜色深黑、轮廓简洁,细肩带从肩部向背部延伸,背部线条清晰。画面下部偏左到中部,她双手抱着一束玫瑰花,花束体积较大,主要由橙色、杏色、粉色和浅桃色玫瑰组成,花瓣层层卷曲,边缘被阳光照亮,绿色叶片和长花茎从花束下方垂出,花束与黑色裙装形成鲜明色彩对比。右侧背景是一条被阳光照亮的城市街道,地面呈暖灰与金黄色调,远处建筑、街边设施和一个模糊的红色圆形交通标志位于右下远景,均因焦外虚化而只保留色块和轮廓。整张照片采用暖色胶片感处理,带有细腻颗粒、柔和对比和明显逆光边缘光,人物位于视觉焦点,背景报刊亭、花藤、街道和阳光共同营造出浪漫、明亮、都市漫步式的氛围。"}
        ]
    }],
    parameters={"prompt_extend": True},
)

# SDK 2.0: Read generated results from message.content_parts; image parts have the form {"image": URL, "type": "image"}
message = response.choices[0].message
for part in (message.content_parts or []):
    if "image" in part:
        print(f"Generated image URL: {part['image']}")

Key capabilities

1. Instruction following (prompts)

Parameters: messages.content.text or input.prompt (required), negative_prompt (optional).
  • text \ prompt (positive prompt): Describes the content, subject, scene, style, lighting, and composition you want to see in the image. The core control parameter for text-to-image.
  • negative_prompt (negative prompt): Describes the content you do not want to appear in the image, such as "blurry" or "extra fingers". Only used to help optimize generation quality.
  • Text rendering (text in the image): The model can generate Chinese and English text in the image, but long text (such as complete ancient poems, long paragraphs, or multi-line text) is difficult to reproduce word for word, and errors such as wrong characters, missing characters, or substitution of visually similar characters may occur. If you require accuracy of the in-image text, it is recommended to keep the in-image text as short as possible, retain only key titles or phrases, or edit the key text in the generated image afterward.
Writing tips: A structured prompt usually delivers better results. For writing techniques, see the text-to-image prompt guide.
The wan2.7-image-pro, wan2.7-image, and qwen-image-2.1 series do not support the negative_prompt parameter. For elements you do not want to appear, describe them in the positive prompt (do not include xxx).

2. Enable intelligent prompt rewriting

Parameters: parameters.prompt_extend (bool, defaults to true). This feature automatically expands and optimizes short prompts to improve image quality. Enabling this feature adds 3-5 seconds, which is the time spent using a large model to rewrite the text. Practical recommendations:
  • Recommended to enable: When the input prompt is brief or broad, this feature can significantly improve image quality.
  • Recommended to disable: If you need to control image details, have already provided a detailed description, or are sensitive to response latency. Explicitly set the prompt_extend parameter to false.
wan2.7-image-pro and wan2.7-image do not support the prompt_extend parameter. You can enable thinking_mode to improve image quality.
Parameter: parameters.prompt_extend_mode (string, optional, default direct). Only supported by the qwen-image-3.0 series and qwen-image-2.1 series; specifies the rewrite mode applied after prompt_extend is enabled:
  • direct: Direct Prompt Enhancement (DPE), suitable for most scenarios. Supported by both text-to-image (T2I) and image-to-image/image editing (I2I).
  • agent: Agent Prompt Enhancement (APE), which provides more refined rewriting results and supports only text-to-image (T2I). Passing agent in an image-to-image/image editing (I2I) scenario returns a 400 error.

3. Set the output image resolution

Parameter: parameters.size (string), in the format "width*height".
  • qwen-image-3.0 series and qwen-image-2.1 series: 512*512 to 2048*2048, aspect ratio 1:8 to 8:1. If not specified, the model automatically recommends a value.
  • qwen-image-2.0 series: 512*512 to 2048*2048, default 2048*2048.
  • wan2.7-image-pro: supports the 1K/2K/4K shorthands or custom values from 768*768 to 4096*4096, default 2K. Aspect ratio 1:8 to 8:1.
  • wan2.7-image: supports the 1K/2K shorthands or custom values from 768*768 to 2048*2048, default 2K. Aspect ratio 1:8 to 8:1.
  • For earlier Wan models, see the corresponding API reference.
For wan2.7-image-pro, 4K and the custom 40964096 resolution are supported only in text-to-image scenarios (no image input and no group image generation); other scenarios support only 2K and the 20482048 resolution.
Recommended resolutions:

Aspect Ratio

4K (wan2.7-image-pro)

2K (wan2.7-image, qwen-image-3.0 series, qwen-image-2.1 series, qwen-image-2.0 series)

1K (Wan t2i)

1:1

4096*4096

2048*2048

1280*1280

16:9

4096*2304

2688*1536

1696*960

9:16

2304*4096

1536*2688

960*1696

4:3

4096*3072

2368*1728

1472*1104

3:4

3072*4096

1728*2368

1104*1472

4. Group image generation

Parameter: parameters.enable_sequential (bool, default false). Only supported by wan2.7-image-pro and wan2.7-image. When set to true, group image mode is enabled, and the model generates multiple images with narrative coherence at once based on the prompt and the reference image content.
  • Number of generated images: controlled by the n parameter. When group image mode is enabled, the value range is 1~12 (default 12), and the actual number is decided by the model and does not exceed n.
  • Note: When group image mode is enabled, the thinking_mode and color_palette parameters are unavailable.

5. Thinking mode

Parameter: parameters.thinking_mode (bool, default true). Only supported by wan2.7-image-pro and wan2.7-image. When enabled, the model applies enhanced reasoning to improve image quality, at the cost of longer generation time.
Available only when group image mode is disabled (enable_sequential=false).

6. Custom color theme

Parameter: parameters.color_palette (array). Only supported by wan2.7-image-pro and wan2.7-image. By passing an array of objects containing colors (hex) and proportions (ratio), you can customize the color scheme of the generated images. It must contain 3 to 10 colors, and 8 is recommended. The sum of all ratio values must equal 100.00%.
Available only when group image mode is disabled (enable_sequential=false).
"color_palette": [
    {
        "hex": "#C2D1E6",
        "ratio": "23.51%"
    },
    {
        "hex": "#CDD8E9",
        "ratio": "20.13%"
    },
    {
        "hex": "#B5C8DB",
        "ratio": "15.88%"
    },
    {
        "hex": "#C0B5B4",
        "ratio": "13.27%"
    },
    {
        "hex": "#DAE0EC",
        "ratio": "10.11%"
    },
    {
        "hex": "#636574",
        "ratio": "8.93%"
    },
    {
        "hex": "#CACAD2",
        "ratio": "5.55%"
    },
    {
        "hex": "#CBD4E4",
        "ratio": "2.62%"
    }
]

7. Other general parameters

Parameter: parameters.n (integer, optional, default 1). The number of output images. The qwen-image-3.0 series and qwen-image-2.1 series support 1~6 images; wan2.7-image-pro and wan2.7-image support 1~4 images when sequential image mode is disabled; when sequential image mode is enabled, it indicates the maximum number of images to generate (value range 1~12, default 12). For details, see "Sequential image generation" above.
n directly affects the fee: Fee = Unit price × the number of successfully generated images.
Parameter: parameters.seed (integer, optional, value range [0, 2147483647]). The random seed; if not specified, the service selects one at random. Using the same seed keeps the generated results relatively stable. For specific support, refer to the API reference of each model. Parameter: parameters.watermark (bool, optional, default false). Whether to add a watermark; the watermark is located in the lower-right corner of the image, with the text "AI Generated".

Going live

  • Fault tolerance strategy
    • Handling throttling: When the API returns the Throttling error code or HTTP 429, throttling has been triggered. For throttling handling, see Rate limiting.
    • Asynchronous task polling: When polling for asynchronous task results, use a sensible polling strategy (for example, once every 3 seconds for the first 30 seconds, then with longer intervals) to avoid triggering throttling with overly frequent requests. Set a final timeout for the task (for example, 2 minutes) and mark it as failed after the timeout.
  • Risk mitigation
    • Persisting results: The image URL returned by the API is valid for 24 hours. Production systems must download the image immediately after obtaining the URL and store it in your own persistent storage service (such as Alibaba Cloud Object Storage Service (OSS)).
    • Content safety review: All prompt and negative_prompt inputs go through content safety review. If the input is non-compliant, the request is blocked and the DataInspectionFailed error is returned.
    • Copyright and compliance risks of generated content: Ensure your prompt content complies with applicable laws and regulations. Generating content that includes brand trademarks, celebrity likenesses, or copyrighted IP characters may carry infringement risks; assess and bear the responsibility yourself.

API documentation

Error codes

If a model call fails and returns an error message, see Error codes to troubleshoot the issue.

FAQ

Q: How long does an image URL remain valid? How can I permanently save the images? A: Image URLs are valid for 24 hours. After you obtain the URL, you must immediately download the image programmatically and save it to your own persistent storage, such as a local server or Alibaba Cloud Object Storage Service (OSS). Q: What should I do if an API call returns the DataInspectionFailed error? A: This error indicates that the input text triggered content safety moderation. Check and modify the text in the prompt or negative_prompt, remove any potentially non-compliant content, and try again. Q: Should the prompt_extend parameter be enabled or disabled? A: Keep it enabled (the default) when the input prompt is relatively brief or you want the model to be more creative. Explicitly set it to false when the prompt is already highly detailed and professional, or when you have strict requirements on API response latency. Note: wan2.7-image-pro and wan2.7-image do not support the prompt_extend parameter; you can enable thinking_mode to improve image quality. Q: How do I clear the conversation content in the Experience Center? A: Click Clear conversation in the upper-right corner of the console.