Qwen Image
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
Qwen Image image generation fields, model constraints, and request examples.
Qwen Image
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_bodyGenerate images with Qwen Image using the native synchronous Alibaba request structure.
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-max | Text-to-image only; one output; five fixed size choices. |
qwen-image-plus | Text-to-image only; one output; five fixed size choices. |
qwen-image | Text-to-image only; one output; five fixed size choices. |
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 | Exactly one text item for text-to-image generation. |
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. |
parameters | object | No | Native output and prompt-processing settings. |
parameters.n | integer | No | Default 1. Qwen Image 2.0 allows 1-6; qwen-image, Plus, and Max only allow 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. |
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, default 2048*2048. Examples: 2688*1536, 1536*2688, 2368*1728, 1728*2368. This is a total-pixel limit, not a 2048 px per-edge limit. |
| Qwen Image / Plus / Max | 1664*928 (default), 1472*1104, 1328*1328, 1104*1472, 928*1664 |
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": [
{
"text": "A clean product photograph of a red ceramic mug on a white 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": [
{
"text": "A clean product photograph of a red ceramic mug on a white 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 editing