Skip to main content

DALL-E

POST /v1/images/generations
Use the DALL-E 3 model to generate images, compatible with the OpenAI Images API format.

Generate Image

Request Parameters

ParameterTypeRequiredDescription
modelstringYesdall-e-3 or dall-e-2
promptstringYesImage description prompt
nintegerNoNumber of images, DALL-E 3 only supports 1
sizestringNoImage size
qualitystringNoQuality: standard (default), hd
stylestringNoStyle: vivid (default), natural
response_formatstringNoResponse format: url (default), b64_json

Size Options

ModelSupported Sizes
dall-e-31024x1024, 1792x1024, 1024x1792
dall-e-2256x256, 512x512, 1024x1024

Request Examples

curl -X POST https://crazyrouter.com/v1/images/generations \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "model": "dall-e-3",
    "prompt": "A traditional Chinese ink wash painting of mountains and waterfalls shrouded in mist",
    "n": 1,
    "size": "1792x1024",
    "quality": "hd",
    "style": "natural"
  }'

Response Example

{
  "created": 1709123456,
  "data": [
    {
      "url": "https://oaidalleapiprodscus.blob.core.windows.net/...",
      "revised_prompt": "A traditional Chinese ink wash painting depicting a mountainous landscape with a waterfall cascading down rocky cliffs, surrounded by misty clouds..."
    }
  ]
}

Edit Image

POST /v1/images/edits
Use DALL-E 2 for localized image editing.
Python
from openai import OpenAI

client = OpenAI(
    api_key="YOUR_API_KEY",
    base_url="https://crazyrouter.com/v1"
)

response = client.images.edit(
    model="dall-e-2",
    image=open("image.png", "rb"),
    mask=open("mask.png", "rb"),
    prompt="Add a kitten in the blank area",
    n=1,
    size="1024x1024"
)

print(response.data[0].url)
DALL-E 3 automatically optimizes your prompt (revised_prompt), generating a more detailed description to improve image quality.
DALL-E 3 can only generate 1 image per request (n=1). For multiple images, send multiple requests.