Skip to main content

Qwen Image

Generate or edit images with OpenAI Images or the Bailian native API. Both return image URLs synchronously; no task polling is required.

Models​

Model IDMaximum reference images
qwen-image-3.0-pro3
qwen-image-3.03
qwen-image-2.1-pro10
qwen-image-2.1-turbo10
qwen-image-2.0-pro3
qwen-image-2.03

Endpoints​

Use https://api.uniall.ai with Authorization: Bearer $UNIAI_API_KEY. Replace the key and reference URLs in the examples with your own values.

FormatMethodPath
OpenAI generationPOST/v1/images/generations
OpenAI editing (JSON or multipart)POST/v1/images/edits
Bailian native generation and editingPOST/api/v1/services/aigc/multimodal-generation/generation

Parameters​

For OpenAI JSON, put these fields at the top level. For the native API, keep model at the top level, put the prompt and images in input.messages, and generation options in parameters.

ParameterTypeRequiredDescription
modelstringYesOne of the six IDs above.
promptstringYesGeneration or editing instruction. Native: one text item in input.messages[0].content.
imagestring or arrayConditionalOrdered reference URLs or image data URLs. Native: one image content item per reference.
nintegerNoOutput count, 1–6; default 1.
sizestringNoWIDTHxHEIGHT, WIDTH*HEIGHT, or auto. See limits below.
seedintegerNo0–2147483647.
negative_promptstringNo3.0 and 2.0 families only.
prompt_extendbooleanNoEnable prompt expansion.
prompt_extend_modestringNodirect or agent; 3.0 and 2.1 only. agent is text-to-image only.
enable_thinkingbooleanNo3.0 and 2.1 families only.
watermarkbooleanNoAdd a watermark.
response_formatstringNoOpenAI only: url.

OpenAI also accepts num_images as an alias for n, and image_url, image_urls, or images for references. Use one reference field; n and num_images must match if both are present. Generation options may be supplied in extra_body; duplicated top-level values must match.

OpenAI Images​

Generate​

curl "https://api.uniall.ai/v1/images/generations" \
-H "Authorization: Bearer $UNIAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "qwen-image-3.0",
"prompt": "A blue ceramic cup on a wooden table",
"n": 1,
"size": "1024x1024",
"seed": 0,
"prompt_extend": false,
"enable_thinking": false,
"watermark": false
}'

Edit with a reference URL​

curl "https://api.uniall.ai/v1/images/edits" \
-H "Authorization: Bearer $UNIAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "qwen-image-2.1-pro",
"prompt": "Turn the cup blue and keep the rest unchanged",
"image": ["https://images.example.com/reference.png"],
"n": 1,
"size": "1024x1024"
}'

The same JSON body can be sent to /v1/images/generations: including image selects editing. Reference-array order is preserved.

Edit with a local file​

curl "https://api.uniall.ai/v1/images/edits" \
-H "Authorization: Bearer $UNIAI_API_KEY" \
-F "model=qwen-image-2.1-pro" \
-F "prompt=Turn the cup blue and keep the rest unchanged" \
-F "image[]=@reference.png" \
-F "n=1" \
-F "size=1024x1024" \
-F "seed=0" \
-F "enable_thinking=false"

Repeat -F "image[]=@another.png" for more references. Form options use integer strings and true / false; let cURL set the multipart Content-Type.

Response​

Generation and editing return the same shape. Read image URLs from data[].url.

{
"created": 1792627200,
"data": [
{
"url": "https://images.example.com/result.png"
}
]
}

Bailian native API​

Use exactly one user message containing one text item. Add image items for editing; omit them for text-to-image.

Generate​

curl "https://api.uniall.ai/api/v1/services/aigc/multimodal-generation/generation" \
-H "Authorization: Bearer $UNIAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "qwen-image-3.0",
"input": {
"messages": [{
"role": "user",
"content": [{"text": "A blue ceramic cup on a wooden table"}]
}]
},
"parameters": {
"n": 1,
"size": "1024*1024",
"seed": 0,
"prompt_extend": false,
"enable_thinking": false,
"watermark": false
}
}'

Edit​

curl "https://api.uniall.ai/api/v1/services/aigc/multimodal-generation/generation" \
-H "Authorization: Bearer $UNIAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "qwen-image-2.1-pro",
"input": {
"messages": [{
"role": "user",
"content": [
{"image": "https://images.example.com/reference.png"},
{"text": "Turn the cup blue and keep the rest unchanged"}
]
}]
},
"parameters": {"n": 1, "size": "1024*1024"}
}'

Response​

Read image URLs from output.choices[].message.content[].image.

{
"output": {
"choices": [
{
"finish_reason": "stop",
"message": {
"role": "assistant",
"content": [
{
"image": "https://images.example.com/result.png"
}
]
}
}
]
},
"request_id": "req_example"
}

Limits​

  • Output area: 262,144–4,194,304 pixels (512²–2048²); aspect ratio: 1:8–8:1. This is an area limit, not a 2048-pixel limit on each edge. Standard 4K sizes such as 3840x2160 exceed it.
  • References: up to 10 MB each; per-model counts are listed above.
  • Results are PNG images. For transparent output on 2.1 models, request a transparent background in the prompt.
  • Streaming, mask editing and Base64 output are unsupported. Omit quality, output_format and operation.

Requests can take tens of seconds. After a timeout, check request records before resubmitting. Save returned images before their URLs expire.

Request errors​

For HTTP 400, check required fields, model-specific options, reference counts and size limits. For HTTP 401, check the Bearer key. /v1/images/edits requires at least one reference image.