典名词元DMTOKENSHome
API DocumentationThird-Party Tools Tutorial
AI Model APIImageQwen

Asynchronous Image Generation Call

POST/api/v1/image/generation

Header Parameters

Authorization?string

Use Bearer Token authentication. Format: Authorization: Bearer sk-xxxxxx

X-DashScope-Async?string

Configuration parameters for asynchronous processing. HTTP requests only support asynchronous mode and must be set to enable. Currently, only the qwen-image-plus and qwen-image models support asynchronous API calls.

Request Body

application/json

model*string

Model name, fixed value: qwen-image-plus

Value in"qwen-image-plus"
input*object

Basic input information, such as prompts.

prompt*string

Positive prompt, used to describe the desired elements and visual characteristics to be included in the generated image. Supports both Chinese and English, with a maximum length of 800 characters. Each Chinese character, letter, number, or symbol counts as one character, and any excess will be automatically truncated. Example value: A sitting orange cat with a cheerful expression, lively and cute, realistic and accurate.

negative_prompt*string

Negative prompt, used to describe unwanted content in the image and restrict the visual output. Supports both Chinese and English, with a maximum length of 500 characters; any excess will be automatically truncated. Example values: low resolution, low quality, deformed limbs, deformed fingers, oversaturated image, waxy appearance, lack of facial details, overly smooth, AI-generated look. Messy composition. Blurred and distorted text.

parameters?object

Image processing parameters.

size?string

qwen-image fixed resolution: 1664x928; qwen-image-max and qwen-image-plus series models: default resolution is 1664928. Available resolutions and their corresponding image aspect ratios are: 1664928 (default): 16:9; 14721104: 4:3; 13281328: 1:1; 11041472: 3:4; 9281664: 9:16.

n?integer

The number of output images, with a default value of 1. For the qwen-image-max and qwen-image-plus series models, this parameter is fixed at 1, and setting it to any other value will result in an error.

prompt_extend?boolean

Whether to enable the intelligent Prompt rewriting feature. When enabled, the model will optimize and refine the positive prompts. This feature does not modify negative prompts. true: Default value, enables intelligent rewriting. Enable this option if you want more diverse image content and allow the model to add details. false: Disables intelligent rewriting. Disable this option if you prefer greater control over image details.

watermark?boolean

Whether to add a "Qwen-Image" watermark to the bottom-right corner of the image. The default value is false.

seed?integer

Random seed, value range [0, 2147483647]. Using the same seed parameter value keeps the generated content relatively stable. If not provided, the algorithm will automatically use a random seed. Note: The model generation process is probabilistic; even with the same seed, identical results cannot be guaranteed across generations.

Response Body

application/json

Success

TypeScript Definitions

Use the response body type in TypeScript.

code*integer

Status Code

data*object

Data Object

urls*array<string>

Result Set

[]?string
usage*object

Consumption Information

images*integer

Number of Images

seconds*integer

Video Seconds

input_tokens*integer

Input Tokens

total_tokens*integer

Total Tokens

output_tokens*integer

Output Token Count

expired*string

Validity Period

task_id*string

Task ID

task_status*string

Task Status

message*string

Status Information

request_id*string

Request ID

curl -X POST "https://api.ygw.ai/api/v1/image/generation" \  -H "Content-Type: application/json" \  -d '{    "model": "qwen-image-plus",    "input": {      "prompt": "string",      "negative_prompt": "string"    }  }'
{
  "code": 0,
  "data": {
    "urls": [
      "string"
    ],
    "usage": {
      "images": 0,
      "seconds": 0,
      "input_tokens": 0,
      "total_tokens": 0,
      "output_tokens": 0
    },
    "expired": "string",
    "task_id": "string",
    "task_status": "string"
  },
  "message": "string",
  "request_id": "string"
}