Qwen Image Editing
curl --request POST \
--url https://api.mixroute.ai/v1/images/generationsimport requests
url = "https://api.mixroute.ai/v1/images/generations"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://api.mixroute.ai/v1/images/generations', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.mixroute.ai/v1/images/generations",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.mixroute.ai/v1/images/generations"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.mixroute.ai/v1/images/generations")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mixroute.ai/v1/images/generations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_bodyImage Series
Qwen Image Editing
Qwen Image image editing fields, model constraints, and request examples.
Qwen Image Editing
curl --request POST \
--url https://api.mixroute.ai/v1/images/generationsimport requests
url = "https://api.mixroute.ai/v1/images/generations"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://api.mixroute.ai/v1/images/generations', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.mixroute.ai/v1/images/generations",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.mixroute.ai/v1/images/generations"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.mixroute.ai/v1/images/generations")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mixroute.ai/v1/images/generations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_bodyEdit images using Qwen Image models with the native synchronous Alibaba request structure.
Requested dimensions may be aligned to nearby multiples of 16. Input formats: JPG/JPEG/PNG/BMP/TIFF/WebP/GIF, at most 10 MB per image; only the first GIF frame is processed. Dimensions of 384-3072 px per edge are recommended, not a hard minimum/maximum. Native OSS references must be accessible to the upstream account.
POST https://api.mixroute.ai/v1/images/generations
input and parameters are native Qwen fields. Put the prompt in input.messages[].content[].text, not in an additional top-level prompt. This page documents synchronous requests, not the separate asynchronous image-synthesis API.Models
| Model ID | Capabilities and Limits |
|---|---|
qwen-image-2.0-pro | Generation and editing; up to six outputs; 1300-token prompt limit. |
qwen-image-2.0 | Generation and editing; up to six outputs; 1300-token prompt limit. |
qwen-image-edit-max | Editing; up to six outputs; custom output dimensions. |
qwen-image-edit-plus | Editing; up to six outputs; custom output dimensions. |
qwen-image-edit | Editing; one output; no custom size or prompt_extend setting. |
Request Parameters
| Field | Type | Required | Description |
|---|---|---|---|
model | string | Yes | Complete model ID from the model table. |
input | object | Yes | Native input object. |
input.messages | object[] | Yes | Exactly one message; this interface is single-turn. |
input.messages[].role | string | Yes | Must be user. |
input.messages[].content | object[] | Yes | One text item plus 1-3 image items, in reference order. |
input.messages[].content[].text | string | Yes | Positive prompt. Qwen Image 2.0: at most 1300 tokens; other models: 800 tokens. Excess input is truncated. Do not include multiple text items. |
input.messages[].content[].image | string | Yes | Public HTTP/HTTPS URL, accessible native temporary OSS URL, or Base64 data URI. Supply 1-3 images. Output proportions default to the last source image. |
parameters | object | No | Native output and prompt-processing settings. |
parameters.n | integer | No | Default 1. Qwen Image 2.0 and Edit Max/Plus allow 1-6; qwen-image-edit only allows 1. |
parameters.size | string | No | Output size formatted as width*height. See the model/mode limits below; it is not the OpenAI widthxheight format. |
parameters.negative_prompt | string | No | Content to exclude. Supports Chinese/English; at most 500 characters, with excess text truncated. |
parameters.prompt_extend | boolean | No | Default true; rewrites the positive prompt without changing the negative prompt. Not supported by qwen-image-edit. |
parameters.watermark | boolean | No | Default false; true adds the Qwen-Image watermark in the lower-right corner. |
parameters.seed | integer | No | Range 0-2147483647. Omit for a random seed. Reusing a seed can improve consistency but does not guarantee identical output. |
Size Rules
| Model | Output Size |
|---|---|
| Qwen Image 2.0 / Pro | Total pixels 262144-4194304. Without size, about 1024*1024 total pixels and the last input image aspect ratio. |
| Qwen Image Edit Max / Plus | Each edge 512-2048 px. Without size, about 1024*1024 total pixels and the last input image aspect ratio. |
| Qwen Image Edit | Do not send size. The model chooses dimensions around 1024*1024 total pixels, following the input aspect ratio. |
Examples
Use your MixRoute key in theMIXROUTE_API_KEY environment variable. Requests use Authorization: Bearer .... Replace source-image placeholders with accessible images or local files before editing.
curl --request POST "https://api.mixroute.ai/v1/images/generations" \
--header "Authorization: Bearer $MIXROUTE_API_KEY" \
--header "Content-Type: application/json" \
--data '{
"model": "qwen-image-2.0-pro",
"input": {
"messages": [
{
"role": "user",
"content": [
{
"image": "https://example.com/source.png"
},
{
"text": "Make the mug blue while preserving its shape, lighting, and background."
}
]
}
]
},
"parameters": {
"size": "1024*1024",
"n": 1,
"prompt_extend": true,
"watermark": false
}
}'
Python
import json
import os
import requests
payload = json.loads(r'''
{
"model": "qwen-image-2.0-pro",
"input": {
"messages": [
{
"role": "user",
"content": [
{
"image": "https://example.com/source.png"
},
{
"text": "Make the mug blue while preserving its shape, lighting, and background."
}
]
}
]
},
"parameters": {
"size": "1024*1024",
"n": 1,
"prompt_extend": true,
"watermark": false
}
}
''')
response = requests.post(
"https://api.mixroute.ai/v1/images/generations",
headers={"Authorization": "Bearer " + os.environ["MIXROUTE_API_KEY"]},
json=payload,
timeout=180,
)
response.raise_for_status()
result = response.json()
for choice in result.get("output", {}).get("choices", []):
for part in choice.get("message", {}).get("content", []):
if "image" in part:
print(part["image"])
Response
Read image URLs fromoutput.choices[].message.content[].image. Outputs are PNG; hosted links expire after 24 hours. request_id is for troubleshooting, not a video-task polling ID. This is not the OpenAI data[].b64_json response structure.
Qwen image generation