n) or concurrent calls, start at 600 seconds to avoid the client disconnecting early.Authorizations
DashScope API key. Get your API key from QwenCloud console.
Body
application/jsonModel name.
Positive prompt describing the desired image content, style, and composition. Chinese and English supported, up to ~4500 tokens. Cannot be empty.
URL or Base64 encoded data of the input image. Omit for T2I; provide for I2I (1-3 images). Pass a string for one image, or an array of strings for multiple (array order defines image order). Do not pass null or an empty array, or a 400 is returned. Formats: JPG/JPEG/PNG/BMP/TIFF/WEBP/GIF; width and height 384-2048 px recommended; size up to 10MB.
Supported input formats:
- Public URL: HTTP and HTTPS protocols are supported.
- Base64 encoding: Format is
data:{MIME_type};base64,{base64_data}.
Number of output images. A string (e.g. "1") returns 400; must be an integer.
Output resolution as widthxheight (letter x separator). auto lets the model recommend. Pixel area 512x512 to 2048x2048, aspect ratio 1:8 to 8:1. Note this differs from the DashScope * separator; adjust when migrating.
Negative prompt describing content you do not want in the image.
Random seed. Random when omitted; a fixed seed makes results relatively stable.
Whether to enable intelligent prompt rewriting (recommended). Rewrites the positive prompt per prompt_extend_mode.
Prompt rewriting mode. direct: direct prompt enhancement (DPE), supports both T2I and I2I; agent: agentic prompt enhancement (APE), T2I only; passing it for I2I returns 400.
Whether to enable thinking mode. Improves image quality with stronger reasoning but increases latency. Effective only when prompt_extend=true; I2I Agent is not yet supported.
Whether to add a watermark.
Response
Unix timestamp (seconds) when the response was created.
List of generated results. Contains multiple elements when n > 1.
Resource usage for this call, returned only on success. This is image input/output metering, not token usage.
Error info, returned only on failure. OpenAI-compatible mode does not return request_id in the body; the request id is returned via the x-request-id HTTP header. With the OpenAI Python SDK, read response._request_id on success or APIStatusError.request_id on failure.