Wan-T2I

Copy success!
Try AIAdd to Compare

Overview

Newly upgraded Wan 2.2 Text-to-Image offers faster generation speed. Fully upgraded creativity, stability, and photorealism, stronger instruction following, and native support for multiple styles. Supports up to 2 MP generation and smart prompt rewriting.

Input

Text

Output

Image

Features

Prefix Completion

Enable Partial Mode when calling the Qwen API to make the model continue strictly from your provided prefix text.View docs

Function Calling

Use function calling to connect large language models with external tools and systems.View docs

Cache

Context Cache stores shared prefixes for long-context requests to reduce repeated computation, improve latency, and lower cost.View docs

Structured Outputs

Structured Outputs help ensure the model returns a JSON string in the expected format.View docs

Batches

Asynchronously process requests in batches to reduce costs.View docs

Web Search

Enable web search so the model can answer with real-time retrieved data.View docs

Fine-tuning

Train models on sample data to better adapt them to specific tasks.View docs

Pricing

  • Image Generation
    $0.025Per image

Rate Limits

  • Concurrency
    2concurrent
  • Async Queue Limit
    500tasks
  • RPMRequests Per Minute
    120

API Reference

Call API
Copy success!
123456789101112131415161718192021222324252627
from http import HTTPStatus
from urllib.parse import urlparse, unquote
from pathlib import PurePosixPath
import requests
from dashscope import ImageSynthesis
import os
import dashscope

dashscope.base_http_api_url = 'https://maas.qwencloudapi.com/api/v1'
prompt = "A flower shop with delicate windows, a beautiful wooden door, and flowers on display"

print('----sync call, please wait a moment----')
rsp = ImageSynthesis.call(api_key=os.getenv("DASHSCOPE_API_KEY"),
                          model="wan2.2-t2i-flash",
                          prompt=prompt,
                          n=1,
                          size='1280*1280')
print('response: %s' % rsp)
if rsp.status_code == HTTPStatus.OK:
    # Save the image in the current directory
    for result in rsp.output.results:
        file_name = PurePosixPath(unquote(urlparse(result.url).path)).parts[-1]
        with open('./%s' % file_name, 'wb+') as f:
            f.write(requests.get(result.url).content)
else:
    print('sync_call Failed, status_code: %s, code: %s, message: %s' %
          (rsp.status_code, rsp.code, rsp.message))