Qwen Image 2.1 API documentation
Integrate Qwen Image 2.1 with your VezAPI key. The operations below share the same authentication and account balance.
https://api.vezapi.comSend Authorization: Bearer YOUR_VEZAPI_KEY. Use a unique Idempotency-Key for each submission; reuse it only when checking the same request.
Qwen 2.1 - Image to Image
/api/v1/jobs/createTaskModel IDs: qwen2-1/image-to-image
| Parameter | Type | Description & constraints |
|---|---|---|
modelrequired | string | The model name used for generation. This endpoint must use `qwen2-1/image-to-image`. Values: Default: |
callBackUrloptional | string | Callback URL for task completion notifications. Optional parameter. If provided, the system will send a POST request to this URL when the task completes, whether it succeeds or fails. If omitted, no callback notification will be sent. To verify callbacks, see [Webhook Verification Guide](/common-api/webhook-verification). |
inputrequired | object | Input parameters for the image-to-image generation task. |
input.image_urlsrequired | array | Reference images, given as an array of 1 to 10 http(s) URLs. Required. The order of the array is the order the prompt refers to ("the first image", "the second image"). JPEG, PNG and WebP are supported, up to 30MB and 25MP each, and every URL must be directly retrievable with a GET. If an image URL cannot be fetched, the task fails with failCode 400. With more than 10 entries the request is rejected. The more references you supply the less detail each individual one keeps, so stay within 4 when fidelity matters. When combining several people or objects into a single picture, a landscape ratio such as `3:2` or `16:9` usually gives better results.
|
input.promptrequired | string | The prompt describing the result you want. Required. Any language is supported, up to 5000 characters; if it is longer, the request is rejected. When `mask_url` is supplied, use it to describe what should be generated inside the white area of the mask.
|
input.mask_urloptional | string | Inpainting mask that switches the request into local-edit mode. A black and white image where **white marks the area to change and black is kept unchanged**, with a few pixels of feathering along the boundary. It must be used with exactly one entry in `image_urls`, otherwise the request is rejected. The mask should have the same aspect ratio as that reference image; a mask of a different size is scaled to it. In local-edit mode the output ratio follows the reference image, so `aspect_ratio` and `enhance_prompt` are ignored. It cannot be combined with `background: transparent`; such a request is rejected. |
input.aspect_ratiooptional | string | Output aspect ratio. Defaults to `auto`, which takes the aspect ratio of the first reference image and snaps it to the nearest supported ratio. The actual pixel size also depends on `resolution`. Ignored in local-edit mode. Values: Default: |
input.resolutionoptional | string | Output resolution tier. `1K` is the faster option; `2K` produces four times the pixels and takes considerably longer, up to about 3 minutes with reference images. Only `1K` and `2K` are accepted — with any other value, including `4K`, the request is rejected. Values: Default: |
input.backgroundoptional | string | Background type. transparent outputs a PNG or WebP with a real alpha channel and cannot be used with JPEG. When using transparent, describe only the subject — prompts that mention a background, scene, surface, etc. may produce a non-transparent result. Values: Default: |
input.output_formatoptional | string | Output image format. `png` (default) and `webp` both carry an alpha channel and can be used with `background: transparent`. `jpeg` has no alpha channel and cannot be combined with a transparent background. Values: Default: |
input.enhance_promptoptional | boolean | Rewrites the prompt into a fuller scene description before generating, which noticeably improves quality. Enabled by default (also when the parameter is omitted); pass false to turn it off. Default: |
input.seedoptional | integer | The random seed. Omit it to generate with a random seed. Passing the same seed together with the same prompt and parameters reproduces the same image within the same service version. |
input.nsfw_checkeroptional | boolean | Defaults to false. When false, no additional content filtering is applied and results are returned directly by the model. |
Request example
curl -X POST 'https://api.vezapi.com/api/v1/jobs/createTask' \
-H 'Authorization: Bearer YOUR_VEZAPI_KEY' \
-H 'Idempotency-Key: your-unique-request-id' \
-H 'Content-Type: application/json' \
-d '{
"model": "qwen2-1/image-to-image",
"input": {
"image_urls": [
"https://example.com/input.png",
"https://example.com/input.png"
],
"prompt": "Replace the backpack in the first image with the colour scheme from the second image, and leave everything else unchanged",
"aspect_ratio": "auto",
"resolution": "1K"
}
}'Responses and errors
HTTP 200
Request successful
| Parameter | Type | Description & constraints |
|---|---|---|
codeoptional | integer | Status code of the request. The HTTP status is 200 even when the request fails, so always check this field: 200 means success; any other value means the request failed and msg describes the reason. Common values: 401 invalid or missing API key; 402 insufficient credits; 429 rate limit exceeded; 422 or 500 the request could not be processed (read msg and check your parameters before retrying). Values: |
datarequired | object | |
data.taskIdrequired | string | Task ID, can be used with Get Task Details endpoint to query task status |
msgoptional | string | Response message, error description when failed |
Qwen 2.1 - Text to Image
/api/v1/jobs/createTaskModel IDs: qwen2-1/text-to-image
| Parameter | Type | Description & constraints |
|---|---|---|
modelrequired | string | The model name used for generation. This endpoint must use `qwen2-1/text-to-image`. Values: Default: |
callBackUrloptional | string | Callback URL for task completion notifications. Optional parameter. If provided, the system will send a POST request to this URL when the task completes, whether it succeeds or fails. If omitted, no callback notification will be sent. To verify callbacks, see [Webhook Verification Guide](/common-api/webhook-verification). |
inputrequired | object | Input parameters for the text-to-image generation task. |
input.promptrequired | string | The prompt that describes the image content, style and composition you want to generate. Required. Any language is supported, up to 5000 characters; if it is longer, the request is rejected.
|
input.aspect_ratiooptional | string | The output aspect ratio. Default `1:1`. The actual pixel size also depends on `resolution`. Values: Default: |
input.resolutionoptional | string | The output resolution tier. `1K` is the faster option; `2K` produces four times the pixels and takes longer. Only `1K` and `2K` are accepted — with any other value, including `4K`, the request is rejected. Values: Default: |
input.backgroundoptional | string | Background type. transparent outputs a PNG or WebP with a real alpha channel and cannot be used with JPEG. When using transparent, describe only the subject — prompts that mention a background, scene, surface, etc. may produce a non-transparent result. Values: Default: |
input.output_formatoptional | string | The output image format. `png` (default) and `webp` both carry an alpha channel and can be used with `background: transparent`. `jpeg` has no alpha channel and cannot be combined with a transparent background. Values: Default: |
input.enhance_promptoptional | boolean | Rewrites the prompt into a fuller scene description before generating, which noticeably improves quality. Enabled by default (also when the parameter is omitted); pass false to turn it off. Default: |
input.seedoptional | integer | The random seed. Omit it to generate with a random seed. Passing the same seed together with the same prompt and parameters reproduces the same image within the same service version. |
input.nsfw_checkeroptional | boolean | Defaults to false. When false, no additional content filtering is applied and results are returned directly by the model. |
Request example
curl -X POST 'https://api.vezapi.com/api/v1/jobs/createTask' \
-H 'Authorization: Bearer YOUR_VEZAPI_KEY' \
-H 'Idempotency-Key: your-unique-request-id' \
-H 'Content-Type: application/json' \
-d '{
"model": "qwen2-1/text-to-image",
"input": {
"prompt": "A corgi wearing a yellow rain hat sitting on stone steps after the rain, shallow depth of field",
"aspect_ratio": "1:1",
"resolution": "1K"
}
}'Responses and errors
HTTP 200
Request successful
| Parameter | Type | Description & constraints |
|---|---|---|
codeoptional | integer | Status code of the request. The HTTP status is 200 even when the request fails, so always check this field: 200 means success; any other value means the request failed and msg describes the reason. Common values: 401 invalid or missing API key; 402 insufficient credits; 429 rate limit exceeded; 422 or 500 the request could not be processed (read msg and check your parameters before retrying). Values: |
msgoptional | string | Response message, error description upon failure |
datarequired | object | |
data.taskIdrequired | string | The task ID can be used with the "Get Task Details" endpoint to query the task status. |
Task status and callbacks
For asynchronous tasks, keep the returned taskId. Query GET /api/v1/jobs/recordInfo?taskId=... or provide callBackUrl when creating the task. Only the account that created a task can access it or derive new resources from it.
A timeout can mean the submission was accepted. Inspect the existing request in your dashboard; do not create another task automatically. Callback delivery is retried and may arrive more than once. Deduplicate with X-VezAPI-Event-Id.
Files, logs and billing
Generated media normally follows a 14-day provider lifetime; uploaded files expire after 24 hours. Save the files you need before expiration. VezAPI streams registered files without keeping a permanent media library. Request logs are retained for two calendar months.
Credits are reserved before submission. Final deductions match actual discounted consumption one for one. Unknown usage pauses new paid requests. If available funds cannot cover final usage while protecting other reservations, settlement stays pending until funded; model usage cannot make the wallet negative. Time-based inputs require server-side metadata reads; a failed read prevents submission.