🎯 Specific to qwen-image

qwen-image API Reference

Unified REST endpoint for high-speed model inference, asynchronous background pipelines, and real-time execution status.

qwen-image
Text to Image $0.03 / run

qwen-image

model_id: qwen-image 8 Parameters Defined

An image generation foundation model in the Qwen series that achieves significant advances in complex text rendering.

AUTHENTICATION

Bearer Token Authentication

All requests to the LumozAI API require authentication using your secret API key. Pass your key in the standard Authorization HTTP header as a Bearer token.

cURL Authorization Header Quickstart
curl -X POST https://lumozai.com/api/v4/run \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Accept: application/json" \
  -d "model_id=qwen-image" \
  -d "prompt=A futuristic cityscape illuminated by neon bioluminescence"
PHP cURL Request
<?php
$apiKey = 'YOUR_API_KEY';

$curl = curl_init();
curl_setopt_array($curl, [
    CURLOPT_URL => 'https://lumozai.com/api/v4/run',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST => true,
    CURLOPT_POSTFIELDS => [
        'model_id' => 'qwen-image',
        'prompt' => 'A futuristic cityscape illuminated by neon bioluminescence'
    ],
    CURLOPT_HTTPHEADER => [
        'Accept: application/json',
        'Authorization: Bearer ' . $apiKey
    ]
]);

$response = curl_exec($curl);
curl_close($curl);

$result = json_decode($response, true);
print_r($result);
POST /api/v4/run

Execute qwen-image Inference

Submit a synchronous or asynchronous generation job for qwen-image (qwen-image). Fast-running image models return the generated asset directly; longer inference pipelines return a request_id for asynchronous polling.

Request Parameters for qwen-image

10 total fields
Parameter Type Required Default Description / Allowed Values
model_id string Required qwen-image
Unique model identifier. Must be set to qwen-image.
prompt string Required Café front window display. A chalkb...
negative_prompt string Optional —
aspect_ratio enum Optional —
1:1 16:9 9:16 4:3 3:4
image_size enum Optional —
optimize_for_quality optimize_for_speed
num_inference_steps number Optional 50
Number of denoising steps. Recommended range is 28-50, and lower number of steps produce lower quality outputs, faster.
Range: 0 to 50 (step: 1)
output_format enum Optional —
webp jpg png
guidance number Optional 4
Range: 0 to 4 (step: 1)
seed string Optional —
Random seed. Set for reproducible generation
webhook string (URL) Optional — Optional callback URL to receive an HTTP POST when async generation completes.

Model-Specific Integration Code

Copy-paste production snippets configured with qwen-image and tailored parameter inputs.

cURL POST /api/v4/run (qwen-image)
curl -X POST https://lumozai.com/api/v4/run \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Accept: application/json" \
  -d "model_id=qwen-image" \
  -d "prompt=Café front window display. A chalkboard sign reads “Freshly Brewed Today”. Below it, a small wooden tray holds labeled jars marked “House Blend” and “Caramel Roast”. To the side, a colorful poster announces “Live Jazz Friday Night” with an illustrated saxophone at the center. On the counter, four pastries are neatly arranged: “Chocolate Croissant”, “Blueberry Muffin”, “Cinnamon Roll”, and “Almond Danish”." \
  -d "negative_prompt=sample_value" \
  -d "aspect_ratio=1:1" \
  -d "image_size=optimize_for_quality" \
  -d "num_inference_steps=50" \
  -d "output_format=webp" \
  -d "guidance=4" \
  -d "seed=sample_value"
Python requests.post (qwen-image)
import requests

url = "https://lumozai.com/api/v4/run"
headers = {
    "Authorization": "Bearer YOUR_API_KEY",
    "Accept": "application/json"
}
payload = {
    "model_id": "qwen-image",
    "prompt": "Caf\u00e9 front window display. A chalkboard sign reads \u201cFreshly Brewed Today\u201d. Below it, a small wooden tray holds labeled jars marked \u201cHouse Blend\u201d and \u201cCaramel Roast\u201d. To the side, a colorful poster announces \u201cLive Jazz Friday Night\u201d with an illustrated saxophone at the center. On the counter, four pastries are neatly arranged: \u201cChocolate Croissant\u201d, \u201cBlueberry Muffin\u201d, \u201cCinnamon Roll\u201d, and \u201cAlmond Danish\u201d.",
    "negative_prompt": "sample_value",
    "aspect_ratio": "1:1",
    "image_size": "optimize_for_quality",
    "num_inference_steps": 50,
    "output_format": "webp",
    "guidance": 4,
    "seed": "sample_value"
}

response = requests.post(url, headers=headers, json=payload)
print(response.json())
PHP cURL POST (qwen-image)
<?php
$apiKey = 'YOUR_API_KEY';

$curl = curl_init();
curl_setopt_array($curl, [
    CURLOPT_URL => 'https://lumozai.com/api/v4/run',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST => true,
    CURLOPT_POSTFIELDS => [
        'model_id' => 'qwen-image',
        'prompt' => 'Café front window display. A chalkboard sign reads “Freshly Brewed Today”. Below it, a small wooden tray holds labeled jars marked “House Blend” and “Caramel Roast”. To the side, a colorful poster announces “Live Jazz Friday Night” with an illustrated saxophone at the center. On the counter, four pastries are neatly arranged: “Chocolate Croissant”, “Blueberry Muffin”, “Cinnamon Roll”, and “Almond Danish”.',
        'negative_prompt' => 'sample_value',
        'aspect_ratio' => '1:1',
        'image_size' => 'optimize_for_quality',
        'num_inference_steps' => 50,
        'output_format' => 'webp',
        'guidance' => 4,
        'seed' => 'sample_value'
    ],
    CURLOPT_HTTPHEADER => [
        'Accept: application/json',
        'Authorization: Bearer ' . $apiKey
    ]
]);

$response = curl_exec($curl);
curl_close($curl);

$result = json_decode($response, true);
print_r($result);
JavaScript fetch async/await (qwen-image)
const response = await fetch('https://lumozai.com/api/v4/run', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json',
    'Accept': 'application/json'
  },
  body: JSON.stringify({
    "model_id": "qwen-image",
    "prompt": "Caf\u00e9 front window display. A chalkboard sign reads \u201cFreshly Brewed Today\u201d. Below it, a small wooden tray holds labeled jars marked \u201cHouse Blend\u201d and \u201cCaramel Roast\u201d. To the side, a colorful poster announces \u201cLive Jazz Friday Night\u201d with an illustrated saxophone at the center. On the counter, four pastries are neatly arranged: \u201cChocolate Croissant\u201d, \u201cBlueberry Muffin\u201d, \u201cCinnamon Roll\u201d, and \u201cAlmond Danish\u201d.",
    "negative_prompt": "sample_value",
    "aspect_ratio": "1:1",
    "image_size": "optimize_for_quality",
    "num_inference_steps": 50,
    "output_format": "webp",
    "guidance": 4,
    "seed": "sample_value"
  })
});

const data = await response.json();
console.log(data);

Response Structure (200 OK)

JSON Output
{
  "success": true,
  "data": {
    "request_id": 982348712938172,
    "output": "https://lumozai.com/storage/outputs/result_qwen-image_9823.png",
    "output_type": "image"
  }
}
POST /api/v4/check

Poll Asynchronous Task Status

Poll the current execution state of an asynchronous job using the returned request_id.

Request Parameters

Parameter Type Required Description
request_id integer Required The unique job ID returned when calling /api/v4/run.
JSON Completed Status (200 OK)
{
  "success": true,
  "data": {
    "request_id": 982348712938172,
    "status": "completed",
    "output": "https://lumozai.com/storage/outputs/video_8172.mp4",
    "output_type": "video"
  }
}
JSON In-Progress Status (200 OK)
{
  "success": true,
  "data": {
    "request_id": 982348712938172,
    "status": "processing",
    "progress": 68
  }
}
ERROR HANDLING

Standard Error Codes

The API uses conventional HTTP response codes to indicate success or failure. In general, 2xx indicates success, 4xx indicates client input issues, and 5xx indicates server errors.

Status Error Code Description
401 authentication_failed Missing or invalid Authorization Bearer header.
403 permission_denied Insufficient credits or account tier permissions.
404 model_not_found The specified model_id does not exist or is deprecated.
422 validation_error Missing required parameters or invalid parameter types.
429 rate_limit_exceeded Request rate quota exceeded for your tier.
500 internal_server_error Downstream GPU compute error or worker timeout.
JSON Validation Error Example
{
  "success": false,
  "error": {
    "code": "validation_error",
    "message": "The model_id field is required.",
    "details": {
      "model_id": ["The model_id field is required."]
    }
  }
}
RATE LIMITS

Quota & Throughput Limits

Rate limits are enforced per API key to guarantee fair access and consistent low latency across GPU workers. Every API response includes informative headers:

Header Description
X-RateLimit-Limit Maximum number of requests permitted per rolling hour.
X-RateLimit-Remaining Number of remaining requests in the active window.
X-RateLimit-Reset Unix epoch timestamp when the current window refreshes.
Handling 429 Status Codes: When rate-limited, wait for the number of seconds until X-RateLimit-Reset or implement an exponential backoff retry mechanism. Need custom enterprise rate limits? Contact our team.