Skip to main content
Geração e edição de imagens

Texto para imagem

Gere imagens a partir de descrições textuais com a API de texto para imagem. Este service, fornecido pelo Alibaba Cloud Model Studio, conta com as famílias de modelos Wan, Qwen-Image e Z-Image.

Experimente online: Singapore | Beijing A opção Experimente online oferece uma experiência de texto para imagem baseada na web e sem necessidade de código: basta insira uma descrição textual na página para gerar imagens diretamente.
  • Model Experience Center: Clique em um link Experimente online acima (Singapore, Beijing) para abri-lo. Selecione um modelo, defina a resolução de saída, ative a reescrita de prompt e envie para gerar imagens.
Para integrar a funcionalidade de texto para imagem em sua própria aplicação, utilize a API descrita abaixo.

Desempenho dos modelos

Qwen-Image

Layout complexo

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

Parágrafo longo

e03efee1-35b1-9109-a988-e3977add0fac_qwen_image3_serving_output_0

Retrato realista

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

Design de UI

image (92)

PPT

image (90)

Design de ilustração

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.Long paragraph: 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: A lifestyle-style male food portrait with a cinematic, on-location feel. The subject is a young man in his early twenties with clean, fresh features, gentle eyes and brows, and naturally clear skin that retains realistic texture detail. He wears a soft, off-white chunky knit sweater over a plain white T-shirt peeking out at the collar, giving off a warm, refined, and relaxed lifestyle vibe. He sits at a cozy Western restaurant table, leaning slightly forward, cutting into a Beef Wellington on his plate with a silver knife and fork in his right hand while his left hand rests naturally on the edge of the table. He tilts his head slightly toward the camera with a faint, relaxed smile and a warm, life-filled gaze. The wooden tabletop is set with an elegant Western meal, alongside a vintage stemmed glass holding an amber-colored drink and a small, delicately arranged vintage flower vase. Behind him is a clear glass wall printed with a light gold, handwritten French menu that reads "Menu du Jour," the text applied to the glass in a silkscreen-like finish with a subtle ambient reflection. The scene is lit with warm yellow overhead interior lighting that softly bathes his face and the food on the table, giving the food an appetizing sheen, while cool ambient light filtering through the glass from outside creates a cinematic contrast between warm and cool tones. The shot is a close, eye-level composition with a slight off-center angle for a natural, breathing feel rather than a stiff, centered framing. A shallow depth of field softly blurs the glass wall and restaurant setting in the background into warm bokeh, with the foreground flowers and drink edges also softly out of focus. The overall tone is warm and comforting, full of everyday atmosphere and mouthwatering appeal.UI design: A widescreen desktop UI design for an immersive website exploring the sounds of an Asian rainforest. The overall mood is dark and tranquil, inspired by vintage field-recording equipment and analog scientific instruments. The color palette centers on deep emerald green, rich obsidian black, and soft earthy brown, creating a calm and serene atmosphere. The interface features subtle mist and haze effects, with soft, dappled light refraction simulating sunlight filtering through a dense canopy, and the background incorporates natural textures such as fine paper grain and leaf veins. The overall image is highly realistic, in a style comparable to a premium BBC nature documentary, with a cinematic composition and extremely fine rendering detail. A minimal, semi-transparent navigation bar spans the very top of the page. On the far left is the brand mark, formed by an intertwined line-art illustration of a vintage analog microphone and monstera leaves, paired with the brand name "RAINFOREST ARCHIVE" in an elegant, soft cream-colored serif font. On the right side of the navigation bar is a menu with four minimal text links in a matching font and color: "Expeditions," "Species," "Field Notes," and "About." The upper two-thirds of the page is the main visual hero banner. The background is an ultra-high-definition, richly atmospheric photo of an ancient Southeast Asian dipterocarp rainforest, wrapped in soft, drifting mist, with blurred dark-green fern fronds in the foreground creating a natural vignette. Overlaid on the left of the banner is the main headline, in a large, high-contrast, elegant serif font: "Voices of the Canopy." Directly below the headline is a smaller, refined subtitle in light cream: "An auditory journey through the ancient dipterocarp forests of Southeast Asia." The text has a subtle typewriter texture, with slightly irregular character spacing that reinforces the vintage, analog-equipment feel. In the lower-middle of the banner is the core audio interaction component: a precision player modeled after a vintage field-recording reel-to-reel deck, inspired by classic Nagra or Marantz tape recorders. The player body is brushed dark gunmetal-gray metal with subtle natural scratches and wear marks, and features two large knurled metal knobs printed with small, clear sans-serif labels: "GAIN" and "MONITOR." At the center of the device is a classic VU meter with a warm, soft amber backlight, its needle resting near the zero mark. To the right of the meter is a heavy-duty physical toggle switch, flipped up to indicate "PLAY" status. While audio is playing, the VU meter emits slowly expanding concentric ripples, resembling gentle water ripples or faint sound waves, in a translucent misty green tone that blends naturally with the hazy background. Below the banner, the page layout shifts to a clean, documentary-style grid used as the sound library section. At the top of this section is an elegant small heading in wide-spaced, all-caps type: "CURRENT EXPEDITIONS." Below the heading is a tidy two-column grid displaying four soundscape cards, each with a distinct style. Card 1 (top left): background is a moody, misty riverbank thumbnail, with the title "Dawn Chorus in Danum Valley," and below it the caption "Location: Sabah, Borneo" and "Duration: 42:15." A small amber badge on the right of the card reads "Currently Playing." Card 2 (top right): a close-up of wet, broad green leaves, with the title "Monsoon Rain on Broadleaves," caption "Location: Khao Yai, Thailand" and "Duration: 1:15:30," and a thin-outlined button labeled "Listen." Card 3 (bottom left): a hazy silhouette of the forest canopy at dusk, with the title "Nocturnal Gibbon Calls," caption "Location: Khao Sok, Thailand" and "Duration: 58:02," and a thin-outlined button labeled "Listen." Card 4 (bottom right): a macro close-up of tree bark texture, with the title "Hornbill Wingbeats," caption "Location: Taman Negara, Malaysia" and "Duration: 24:40," and a thin-outlined button labeled "Listen." On the far right of the soundscape grid, a vertical panel spans the lower half of the section, styled after a page from a vintage field science notebook. The paper has a soft, aged cream texture, with a faint coffee stain in the bottom-right corner. The panel title uses a typewriter monospace font reading "FIELD NOTES," with elegant, slightly faded ink-toned body text: "Recorded using parabolic microphones and Nagra IV-S tape recorders. Humidity: 94% Temp: 24°C." Next to the text is a finely hand-drawn dark brown ink sketch of a pitcher plant. At the very bottom of the page is a minimal footer spanning the full width, with a thin dark green divider line above it. The footer reads "Copyright 2024 Rainforest Archive" on the left and "Funded by the Wildlife Conservation Society" on the right, both in a soft, understated small serif font.PPT: A professional educational PPT slide with a 16:9 aspect ratio. The background is an extremely subtle blue-gray gradient, overlaid with a very low-opacity sine-wave pattern and a faint dot-grid texture, creating a rigorous academic physics atmosphere with a tech-forward feel. Centered at the top of the slide is the main title area, with the text in large, bold, dark navy sans-serif type: "AC Circuit Analysis: Resistor with Sinusoidal Voltage." Directly below the title is a bright thin orange horizontal line as a visual divider, with small circular end caps at both ends to add a sense of ceremony to the layout. The main body of the slide is split into two columns using a strict grid-alignment system, with the left and right columns in roughly a 1:1.2 width ratio, giving the complex formulas on the right ample display space. At the top of the left column is a rounded-rectangle orange header bar with centered bold white text: "PROBLEM DATA & WAVEFORM." The header bar has a subtle drop shadow at the bottom, giving it a slightly raised, three-dimensional feel. Below the orange header is a light gray-white rounded data card with an extremely thin light blue border, containing four vertically arranged data points. Each point has a minimalist, solid-gray line icon to its left — in order, a resistor symbol, a wave line, a voltage arrow, and a clock symbol. The text for the four points is in clear dark gray type, reading in order: "Resistor (R) = 10 Ω," "Waveform = Sinusoidal," "Peak Voltage (V subscript p) = 311 V," and "Period (T) = 0,02 s," neatly laid out with comfortable line spacing, with key numbers highlighted in a slightly darker color. Below the data card is the chart area, with a dark gray chart title centered at the top: "Voltage vs. Time." The chart itself is a 2D coordinate system with light gray gridlines. To the left of the vertical Y-axis is the dark gray label "Voltage (V)," with tick marks labeled "+311," "0," and "-311" in dark blue text on white background boxes. Below the horizontal X-axis is the dark gray label "Time (s)," with tick marks labeled "0,01" and "0,02." At the center of the coordinate system is a smooth, full, slightly glowing bright red sine-wave curve of moderate line weight, showing perfect periodicity. At the peak of the sine wave, a dark blue vertical double-headed arrow indicates the amplitude, labeled in dark blue text: "V subscript p = 311 V." Above one full period on the X-axis is a dark blue horizontal dimension line with vertical lead lines at both ends, labeled in the center in dark blue text: "T = 0.02 s." The chart area has generous white space overall, keeping the visual focus on the red waveform. At the top of the right column is another rounded-rectangle orange header bar, aligned in height with the left header, with centered bold white text: "SOLUTION STEPS & CALCULATIONS." Below the orange header, four light-blue gradient rounded cards are arranged vertically with even spacing between them and generous internal breathing room. The first card has a dark blue circular numbered badge in the top-left corner with a white "1" inside. The card title is bold dark blue text: "1. Maximum Current (I subscript p)." The body below is laid out in three lines in the visual style of standard mathematical notation — with fraction bars, sub/superscripts, and radicals rendered elegantly — reading in dark gray: "Formula: Ohm's Law, I subscript p = V subscript p over R," followed by the calculation "I subscript p = 311 V over 10 Ω = 31,1 A." In the bottom-right corner of the card is a bright yellow rounded highlight box with bold dark blue text: "I subscript p = 31.1 A." The second card's badge shows "2," titled "2. AC Voltmeter Reading (V subscript rms)." The body includes the note "Voltmeters read RMS value," the formula "V subscript rms = V subscript p over square root of 2," and the calculation "V subscript rms = 311 V over 1.414 ≈ 220 V," with the bottom-right highlight box showing "V subscript rms ≈ 220 V." The third card's badge shows "3," titled "3. Actual Power Dissipated (P subscript avg)." The body includes "Using RMS values," the formula "P subscript avg = (V subscript rms) squared over R," the calculation "P subscript avg = (220 V) squared over 10 Ω = 48400 over 10 W = 4840 W," with the bottom-right highlight box showing "P subscript avg = 4,84 kW." The fourth card's badge shows "4," titled "4. Joule Heat in Half Cycle (Q subscript half)." The body includes "Energy = Power × Time," the time calculation "Time = T over 2 = 0,01 s," the main calculation "Q subscript half = P subscript avg × (0,01 s) = 4840 W × 0,01 s = 48,4 J," with the bottom-right highlight box showing "Q subscript half = 48,4 J." All four cards' highlight boxes are aligned uniformly in the bottom-right corner, creating a tidy visual alignment and reading flow. At the very bottom of the slide is an extremely thin light gray horizontal divider, below which is centered small light gray sans-serif text: "Experimental Physics - AC Circuits Analysis Module." The footer area remains minimal, with the rest of the background kept as clean graphics and white space. The slide's overall color system is built around dark navy, bright orange, light blue-gray, and pure white, with the red waveform and yellow highlight boxes as visual accents that break the monotony and add vibrancy and professionalism. All text has sharp edges and extremely high contrast, ensuring clear readability on projectors or screens. Lighting and shadow are handled with restraint, adding depth only through subtle drop shadows beneath the cards and slight highlights on the header bars, resulting in an overall highly polished, clearly structured, and information-rich professional physics teaching slide.Illustration design: A hand-drawn watercolor illustration on soft, off-white watercolor paper. The paper surface shows the characteristics of traditional botanical art, including clearly visible pigment granulation and the soft color bleeding produced by wet-on-wet technique. In the upper-center area of the composition is a cluster of violets and pansies. The petals blend gradients of light purple, deep purple, and lavender, with golden-yellow flower centers. Beside the flowers are small, emerald-green leaves rendered with translucent watercolor washes and finely detailed veins. Soft directional lighting illuminates the scene, highlighting the texture of the watercolor paper and the subtle variations in the pigment. Directly below the floral motif, horizontally centered in the lower half of the paper, is the word "Виолета." The lettering is written in an arched calligraphic script using metallic gold ink. The letterforms are rendered with fluid, continuous strokes and a subtle embossed, three-dimensional quality, giving off a soft metallic sheen under the light.

Wanxiang

Fotografia de retrato

p1023523

Fotografia fotorrealista

p1023409

Estilos artísticos

p1023526

Renderização de texto

p1023535

Design de pôster

p1023546

Geração de conjunto de imagens

p1023532

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.Photorealistic 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 gapsArtistic styles: Vintage oil painting style pastoral scene, 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 rendering: A page from a plant identification guide. Hand-drawn watercolor style. Depicts a dandelion with labeled 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: A lifetime of memories for an elderly man. Four portraits in different frames: childhood (black-and-white photo), youth (military uniform photo), middle age (work photo in a business suit), and old age (photo with spouse).

Seleção de modelos

  • qwen-image-3.0-pro: Modelo principal da família Qwen Image 3.0. Oferece suporte à reescrita inteligente de prompts e destaca-se na renderização de texto que se integra naturalmente a materiais físicos, tanto em chinês quanto em inglês.
  • wan2.7-image-pro: Disponibiliza o maior conjunto de recursos, incluindo geração de múltiplas imagens, resoluções de até 4096x4096 e controle aprimorado sobre traços faciais, cores e renderização de textos longos.
  • z-image-turbo: Proporciona geração de imagens rápida e econômica, com excelente desempenho em retratos altamente realistas e imagens de products.

Opções de uso

O recurso de texto para imagem oferece duas opções de utilização. Escolha a mais adequada ao seu cenário:

Opção de uso

Codificação necessária

Ponto de entrada

Mais indicado para

Experiência online via web

Não

Model Experience Center (consulte os links Experimente online no início deste tópico)

Testar modelos, validar prompts e gerar poucas imagens

Chamada de API

Sim

Consulte Início rápido abaixo

Integrar texto para imagem em sua própria aplicação ou service em escala

Início rápido

Pré-requisitos

Antes de começar, obtenha uma chave de API e depois defina a chave de API como variável de ambiente. Caso utilize o DashScope SDK, também é necessário instale o SDK.

Código de exemplo

Métodos de chamada:
  • Qwen - synchronous call
  • Wan - asynchronous call
  • Python
  • Java
  • curl
import os
import dashscope
from dashscope import MultiModalConversation

dashscope.base_http_api_url = 'https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1'

response = MultiModalConversation.call(
    api_key=os.getenv("DASHSCOPE_API_KEY"),
    model="qwen-image-3.0-pro",
    messages=[{
        "role": "user",
        "content": [
            {"text": "A vertical outdoor portrait photograph with a warm afternoon street atmosphere. Deep green vines and small orange flowers cascade from building eaves across the upper area. A dark blue sign reads 'Il Messaggero' in white Gothic lettering, partially obscured by foliage. Below, a newsstand displays newspapers behind black metal-framed glass, blurred by shallow depth of field. Strong backlight streams from the street's end. Center-right, a young woman in a black spaghetti-strap backless dress looks back at the camera with a warm smile. Her long, thick wavy black hair is outlined by golden rim light. She has fair skin, bright eyes, soft coral-red lips, and holds a large bouquet of orange, apricot, pink and peach roses contrasting with her black dress. The sunlit city street stretches into the blurred background. Warm film-like tones with fine grain, soft contrast and pronounced backlit edge glow create a romantic, bright, urban strolling atmosphere."}
        ]
    }],
    prompt_extend=True
)

print(response)
if response.status_code == 200:
    url = response.output.choices[0].message.content[0]["image"]
    print(f"Generated image URL: {url}")
else:
    print(f"Error: {response.code} - {response.message}")

Principais capacidades

1. Seguimento de prompt

Parâmetros: messages.content.text ou input.prompt (obrigatório) e negative_prompt (opcional).
  • prompt: Descreve o conteúdo desejado para a imagem, incluindo sujeito, cena, estilo, iluminação e composição. Trata-se do parâmetro central para controlar a geração de texto para imagem.
  • negative prompt: Especifica o que deve ser excluído da imagem, como "desfocado" ou "dedos extras". Esse parâmetro ajuda a refinar a qualidade do resultado.
Para obter melhores resultados, utilize um prompt estruturado. Para mais informações, consulte Text-to-image prompt guide.
Os modelos wan2.7-image-pro e wan2.7-image não oferecem suporte ao parâmetro negative_prompt. Para excluir elementos indesejados, descreva essa exclusão no próprio prompt (por exemplo, "não incluir xxx").

2. Ative reescrita de prompt

Parâmetro: parameters.prompt_extend (Booleano, padrão definido como true). Esse recurso expande e otimiza automaticamente prompts curtos para melhorar a qualidade da imagem. Ativá-lo adiciona de 3 a 5 segundos ao tempo de geração, pois um modelo grande é utilizado para reescrever o prompt. Recomendações:
  • Ative este recurso para prompts breves ou genéricos a fim de melhorar significativamente a qualidade da imagem.
  • Desative-o caso precise de controle preciso sobre detalhes da imagem, já tenha fornecido um prompt abrangente ou se a latência de resposta for uma preocupação. Para desativar, defina o parâmetro prompt_extend como false.
Os modelos wan2.7-image-pro e wan2.7-image não suportam o parâmetro prompt_extend. Para melhorar a qualidade da imagem nesses modelos, ative o thinking_mode em vez disso. Os modelos qwen-image-3.0-pro e qwen-image-3.0 aceitam o parâmetro prompt_extend (ativado por padrão).
Parâmetro: parameters.prompt_extend_mode (string, opcional, padrão definido como direct). Suportado apenas pelos modelos qwen-image-3.0-pro e qwen-image-3.0. Especifica o método de reescrita usado quando prompt_extend está ativado:
  • direct: Aprimoramento Direto de Prompt (DPE), adequado para a maioria dos cenários. Suportado tanto para texto para imagem (T2I) quanto para imagem para imagem/edição (I2I).
  • agent: Aprimoramento de Prompt por Agente (APE), oferece uma reescrita mais refinada. Suportado apenas para texto para imagem (T2I). Passar agent para imagem para imagem/edição (I2I) retorna um erro 400.

3. Defina a resolução da imagem de saída

Parâmetro: parameters.size (string), no formato "largura*altura".

Modelo

Formato de tamanho

Faixa de pixels

Padrão

Proporção

wan2.7-image-pro

Abreviado

1K (10241024), 2K (20482048), 4K (4096*4096)

2K (2048*2048)

1:8 – 8:1

Personalizado "largura*altura"

768768 – 40964096

wan2.7-image

Abreviado

1K (10241024), 2K (20482048)

2K (2048*2048)

1:8 – 8:1

Personalizado "largura*altura"

768768 – 20482048

wan2.6-image (modo de saída intercalada de texto e imagem)

Personalizado "largura*altura"

768768 – 12801280

Corresponde à proporção de entrada (≤1280*1280)

1:4 – 4:1

wan2.6-t2i, wan2.5-t2i-preview

Personalizado "largura*altura"

12801280 – 14401440

1280*1280

1:4 – 4:1

wan2.2 e modelos t2i anteriores

Personalizado "largura*altura"

[512, 1440], e total de pixels ≤1440*1440

1024*1024

-

qwen-image-3.0-pro, qwen-image-3.0

Personalizado "largura*altura"

512512 – 20482048

Recomendado automaticamente pelo modelo

1:8 – 8:1

Série qwen-image-2.0

Personalizado "largura*altura"

512512 – 20482048

2048*2048

-

Série qwen-image-max / qwen-image-plus

Apenas tamanhos predefinidos fixos

Veja os tamanhos predefinidos abaixo

1664*928 (16:9)

-

O modelo wan2.7-image-pro suporta resolução 4K e resoluções personalizadas de até 40964096, mas apenas para tarefas de texto para imagem (onde nenhuma imagem é inserida e a geração de conjunto de imagens está desativada). Todos os outros cenários são limitados à resolução 2K (20482048).
As séries qwen-image-max e qwen-image-plus suportam apenas as cinco resoluções fixas a seguir:
  • 1664*928 (padrão): 16:9
  • 1472*1104: 4:3
  • 1328*1328: 1:1
  • 1104*1472: 3:4
  • 928*1664: 9:16
Resoluções recomendadas:

Proporção

4K (wan2.7-image-pro)

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

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. Geração de conjunto de imagens

Parâmetro: parameters.enable_sequential (Booleano, padrão definido como false). Suportado apenas pelos modelos wan2.7-image-pro e wan2.7-image. Defina como true para ative o modo de geração de conjunto de imagens. Nesse modo, o modelo utiliza o prompt e quaisquer imagens de referência para gerar múltiplas imagens coerentes entre si, formando uma narrativa a partir de uma única solicitação.
  • Quantidade de imagens: Controlada pelo parâmetro n. Quando este modo está ativado, o valor pode variar de 1 a 12, com padrão de 12. O modelo determina a quantidade real de imagens geradas, que não excederá n.
  • Observação: Com a geração de conjunto de imagens ativada, os parâmetros thinking_mode e color_palette ficam indisponíveis.

5. Modo de raciocínio

Parâmetro: parameters.thinking_mode (Booleano, padrão definido como true). Suportado apenas pelos modelos wan2.7-image-pro e wan2.7-image. Quando ativado, o modelo aprimora suas capacidades de raciocínio para melhorar a qualidade da imagem. Isso aumenta o tempo de geração.
Disponível apenas quando a geração de conjunto de imagens está desativada ( enable_sequential=false ).

6. Paleta de cores personalizada

Parâmetro: parameters.color_palette (array). Suportado apenas pelos modelos wan2.7-image-pro e wan2.7-image. Defina o esquema de cores da imagem fornecendo um array de objetos, onde cada objeto especifica uma cor hexadecimal e sua proporção. É necessário fornecer de 3 a 10 cores (recomenda-se 8), e a soma de todas as proporções deve ser igual a 100,00%.
Disponível apenas quando a geração de conjunto de imagens está desativada ( 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%"
    }
]

Implantação em produção

  • Tolerância a falhas
    • Tratamento de limitação de taxa: Quando a API retornar o código de erro Throttling ou o status HTTP 429, significa que a limitação de taxa foi acionada. Para lidar com essa situação, consulte Rate Limiting.
    • Consulta periódica para tarefas assíncronas: Ao consultar o resultado de uma tarefa assíncrona, implemente uma estratégia de polling adequada para evitar o acionamento da limitação de taxa. Por exemplo, faça consultas a cada 3 segundos nos primeiros 30 segundos e depois aumente o intervalo. Defina um tempo limite final para a tarefa (por exemplo, 2 minutos). Se a tarefa expirar, marque-a como falha.
  • Prevenção de riscos
    • Persistência de resultados: As URLs das imagens da API têm validade de 24 horas. Seu sistema de produção deve baixe a imagem imediatamente após receber a URL e transferi-la para seu próprio service de armazenamento persistente, como o Object Storage Service (OSS) do Alibaba Cloud.
    • Moderação de conteúdo: Todas as entradas de prompt e negative_prompt passam por moderação de conteúdo. Se a entrada não estiver em conformidade, a solicitação será bloqueada e um erro DataInspectionFailed será retornado.
    • Riscos de direitos autorais e conformidade do conteúdo gerado: Garanta que seus prompts estejam em conformidade com todas as leis e regulamentos aplicáveis. Gerar conteúdo que inclua marcas registradas, semelhanças de celebridades ou propriedade intelectual (IP) protegida por direitos autorais pode representar riscos de violação. Você é responsável por avaliar e assumir todos os riscos associados.

Referência da API

Faturamento e limitação de taxa

  • Para cotas gratuitas e preços, consulte model pricing.
  • Para limites de taxa, consulte Image generation.
  • A cobrança ocorre apenas por imagens geradas com sucesso. Solicitações com falha e erros de processamento não geram cobranças nem consomem a free quota for new users.

Códigos de erro

Se a chamada do modelo falhar e retornar uma mensagem de erro, consulte Error codes para resolução.

FAQ

P: Qual é a validade das URLs das imagens? Como salve imagens permanentemente? R: As URLs das imagens expiram após 24 horas. Você deve baixe a imagem programaticamente de forma imediata e salve-a em um armazenamento persistente, como um servidor local ou o Object Storage Service do Alibaba Cloud. P: Minha chamada de API retorna um erro DataInspectionFailed. Como resolvo isso? R: Esse erro indica que sua entrada acionou a moderação de conteúdo. Revise seu prompt ou negative_prompt, remova qualquer conteúdo não conforme e tente a solicitação novamente. P: Quando devo ative ou desativar o parâmetro prompt_extend? R: Mantenha-o ativado (o padrão) para prompts concisos ou para obter resultados mais criativos. Defina-o explicitamente como false quando seu prompt já for detalhado e especializado, ou quando você for sensível à latência da API. Observação: Os modelos wan2.7-image-pro e wan2.7-image não suportam o parâmetro prompt_extend. Para melhorar a qualidade da imagem, ative o thinking_mode em vez disso.
Plano de Tokens
Playground de Modelos
Inferência do Modelo
Avaliação
Compressão de Modelos
Estatísticas e Monitoramento
Suporte