POSThttps://api.wylon.cn/v1/images/generations
Synchronous generation
Generate an image through the OpenAI Images-compatible endpoint and receive a short-lived image URL in the same response.
Use this endpoint when the caller can remain connected until image generation completes. For background processing, use asynchronous image generation.
Minimal request body
{
"model": "Qwen/Qwen-Image-2512",
"prompt": "A corgi wearing an astronaut helmet, cinematic lighting",
"size": "1664x928",
"n": 1
}Authorization and request format
Authorizationstring · headerrequired
Bearer token. Create an API key in the dashboard and store it in
$WYLON_API_KEY.Content-Typestring · headerrequired
Must be
application/json.Request parameters
modelstringrequired
A model ID provided by wylon, such as
Qwen/Qwen-Image-2512. Check the Model Plaza or list models endpoint for models your account can access.promptstringrequired
Describe the subject, scene, composition, lighting, style, and text to generate.
negative_promptstringoptional
Describe content to exclude. Support, length limits, and behavior depend on the selected model.
sizestringoptional
Requested output dimensions in
widthxheight format. If omitted, the model default is used.ninteger1
Number of images to generate. The supported range depends on the API version and model.
response_formatstringurl
How the result is returned:
url or b64_json. This guide uses url.output_formatstringpng
Requested image file format. V1 currently supports
png only.output_compressionintegeroptional
Requested compression level. It has no effect on PNG output by default.
backgroundstringoptional
OpenAI-compatible background option. It has no effect in V1 by default.
qualitystringoptional
OpenAI-compatible quality option. It has no effect in V1 by default.
stylestringoptional
Requested style preset. Support and accepted values depend on the model.
userstringoptional
A caller-supplied end-user identifier. It is not used for API authentication.
user_idstringoptional
Compatibility field accepted by the API but not currently stored or used.
moderationstringoptional
Requested moderation mode. This field cannot disable or bypass platform safety controls.
streambooleanfalse
Whether to stream partial images. V1 does not support this capability; omit it or pass
false.partial_imagesinteger0
Number of partial images returned during streaming. V1 does not support this capability; omit it or pass
0.Current model limits
The following values apply only to Qwen/Qwen-Image-2512 and should not be used as defaults for other image models.
| Parameter | Supported values | Default | Description |
|---|---|---|---|
size | 1328x1328, 1664x928, 928x1664, 1104x1472, 1584x1056 | 1664x928 | Square, landscape, and portrait formats |
n | 1 | 1 | One image per request |
V1 adds an “AI-generated” watermark and does not support streaming partial images, regardless of the selected model.
Response
Success response
{
"created": 1773036616,
"data": [{ "url": "https://..." }]
}data[0].url is a short-lived signed URL. Download or copy the result promptly.
Error response
{
"error": {
"message": "...",
"type": "invalid_request_error",
"code": "..."
}
}Error handling and production guidance
| Status code | Common cause | Recommended action |
|---|---|---|
400 | Missing field or unsupported model parameter | Correct the request using the current model limits |
401, 403 | Invalid key or missing model permission | Check authentication and account access |
429 | Rate, concurrency, or capacity limit reached | Wait before starting another request |
500, 503 | Internal error or model temporarily unavailable | Confirm the outcome before creating another request |
504 | No result became available before the timeout | Do not retry automatically; confirm actual usage first |
