Skip to content

Images Generations

POST https://wrouter.ai/v1/images/generations

Two request shapes are accepted, routed by model:

  • OpenAI shapedall-e-3, gpt-image-1, flux-pro, …
  • Bailian / Qwen shapeqwen-image and Alibaba models; this is the shape natively documented by the underlying gateway

Shape A: OpenAI

The industry-standard Images protocol format.

ParameterTypeRequiredNotes
modelstringe.g. dall-e-3, gpt-image-1, flux-pro
promptstringText description
nintegerDefault 1
sizestring1024x1024, 1792x1024, 1024x1792
qualitystring"standard" | "hd"
stylestring"vivid" | "natural" (DALL·E 3)
response_formatstring"url" (default) or "b64_json"
userstringEnd-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:

ParameterTypeRequiredNotes
modelstringe.g. qwen-image, qwen-image-plus
inputobjectCore inputs, including prompt
parametersobjectsize, 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 size uses WIDTH*HEIGHT (star), OpenAI uses WIDTHxHEIGHT (lowercase x). Not interchangeable.