Skip to content

Generate Images (Qwen Native Format)

Besides the OpenAI-compatible format, YouQi AI also supports Alibaba Cloud Bailian's Qwen-Image native request structure. The endpoint path is the same; the gateway routes based on the model field in the request body. The request body shape (input.messages) differs from the OpenAI format. See also Edit images.

Endpoint

POST /v1/images/generations

Request parameters

ParameterTypeRequiredDescription
modelstringYesModel identifier, e.g. qwen-image
input.messagesarrayYesMessage list; content is an array with a text item
parameters.sizestringNoImage size, e.g. 1328*1328
parameters.negative_promptstringNoNegative prompt
parameters.prompt_extendbooleanNoWhether to auto-expand the prompt
parameters.watermarkbooleanNoWhether to add a watermark

Request example

bash
curl https://ai.youqi.tech/v1/images/generations \
  -H "Authorization: Bearer sk-YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "qwen-image",
    "input": {
      "messages": [
        { "role": "user", "content": [{ "text": "A white fox running under a starry sky, photorealistic" }] }
      ]
    },
    "parameters": { "size": "1328*1328", "watermark": false }
  }'

Response example

json
{
  "created": 1715367049,
  "data": [{ "url": "https://.../generated-image.png" }]
}

TIP

The Qwen native format shares the same endpoint path as the OpenAI-compatible format; the gateway distinguishes formats by request body shape — do not mix the two body styles.