Introduction
Operations
Platform
Image APIs
Qwen Image API
Budget-friendly general model with ControlNet support, template-safe layouts, and rapid batch generation. · Updated 2025-03-18
Overview
Qwen Image balances quality and cost for high-volume workflows like e-commerce and social graphics. Pair it with ControlNet guides to lock composition while generating multiple variants per call.
Base Generation
curl -X POST "https://api.transendai.net/v1/images/qwen/generation" \
-H "Authorization: Bearer $TRANSEND_API_KEY" \
-H "Content-Type": "application/json" \
-d '{
"prompt": "Lifestyle photo of a running shoe on a boardwalk at sunrise",
"size": "768x1024",
"count": 4
}'
Response snippet:
{
"images": [
{ "id": "img_qwen_01", "url": "https://edge.transendai.net/qwen/img_qwen_01.webp" }
],
"usage": { "input_tokens": 512, "output_images": 4 }
}
ControlNet Integration
Provide auxiliary guides for consistent poses:
curl -X POST "https://api.transendai.net/v1/images/qwen/generation" \
-H "Authorization: Bearer $TRANSEND_API_KEY" \
-F "[email protected]" \
-F "[email protected]" \
-F 'payload={
"prompt": "Trail runner sprinting across a boardwalk at sunrise",
"size": "768x1024",
"count": 3,
"controlnet": ["pose", "edge"]
}'
Control maps must match the output aspect ratio.
Template Engine
Lock critical areas (logos, CTA) using the template API:
{
"template": {
"safe_zones": [
{ "id": "cta", "x": 0.5, "y": 0.85, "width": 0.4, "height": 0.1 }
],
"background": "#F7F8FA"
}
}
Safe zone coordinates use relative values (0–1).
Error Handling
| Code | Meaning | Fix |
|---|---|---|
400 | Control map missing or wrong aspect ratio. | Upload all control maps with matching dimensions. |
413 | Payload too large. | Reduce control map resolution or count. |
429 | RPM exceeded. | Implement retry logic or request higher quotas. |
Optimization Tips
- Use WebP for smaller file sizes without noticeable quality loss.
- Retain
idvalues to reroll or replace specific variants later. - Combine with the pricing API to monitor cost per image batch.