Images Generations
POST https://wrouter.ai/v1/images/generationsTwo request shapes are accepted, routed by model:
- OpenAI shape —
dall-e-3,gpt-image-1,flux-pro, … - Bailian / Qwen shape —
qwen-imageand Alibaba models; this is the shape natively documented by the underlying gateway
Shape A: OpenAI
The industry-standard Images protocol format.
| Parameter | Type | Required | Notes |
|---|---|---|---|
model | string | ✓ | e.g. dall-e-3, gpt-image-1, flux-pro |
prompt | string | ✓ | Text description |
n | integer | Default 1 | |
size | string | 1024x1024, 1792x1024, 1024x1792 … | |
quality | string | "standard" | "hd" | |
style | string | "vivid" | "natural" (DALL·E 3) | |
response_format | string | "url" (default) or "b64_json" | |
user | string | End-user identifier |
bash
curl https://wrouter.ai/v1/images/generations \
-H "Authorization: Bearer $WROUTER_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "dall-e-3",
"prompt": "Futuristic data center, blue-purple lighting",
"size": "1024x1024",
"quality": "hd"
}'python
from openai import OpenAI
client = OpenAI(api_key="sk-...", base_url="https://wrouter.ai/v1")
img = client.images.generate(
model="gpt-image-1",
prompt="A cyberpunk shiba inu wearing sunglasses",
size="1024x1024",
)
print(img.data[0].url)Shape B: Bailian / Qwen
Alibaba's qwen-image family uses an input / parameters envelope:
| Parameter | Type | Required | Notes |
|---|---|---|---|
model | string | ✓ | e.g. qwen-image, qwen-image-plus |
input | object | ✓ | Core inputs, including prompt |
parameters | object | size, n, negative_prompt, … |
bash
curl https://wrouter.ai/v1/images/generations \
-H "Authorization: Bearer $WROUTER_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "qwen-image",
"input": {"prompt": "A shiba inu wearing sunglasses, cyberpunk"},
"parameters": {"size": "1024*1024", "n": 1}
}'Response
json
{
"created": 1718000000,
"data": [
{"url": "https://cdn.wrouter.ai/.../image.png", "revised_prompt": "..."}
]
}Notes
- URLs are valid for 24 hours — download for long-term use.
- Some models reject
n>1; call multiple times instead. - Policy violations return 400 +
content_policy_violation. - Qwen
sizeusesWIDTH*HEIGHT(star), OpenAI usesWIDTHxHEIGHT(lowercase x). Not interchangeable.