Endpoint
Request Body
Text description of the desired image(s). The more detailed and specific, the better the results.Example:
"A serene mountain landscape at sunset with snow-capped peaks reflecting in a crystal clear lake"The image generation model to use. Can be:
- Model name:
dall-e-3 - Provider/model:
openai/dall-e-3
- OpenAI:
dall-e-2,dall-e-3 - Stability AI:
stable-diffusion-xl-1024-v1-0 - And more…
Number of images to generate.
- For
dall-e-3: Must be 1 (default) - For
dall-e-2: Can be 1-10
Quality of the generated image. Options:
"standard": Standard quality (faster, lower cost)"hd": High definition quality (slower, higher cost)
dall-e-3.
Default: "standard"Format of the generated image data. Options:
"url": Returns a URL to download the image (expires after 1 hour)"b64_json": Returns base64-encoded JSON
"url"Size of the generated image. Options depend on the model:DALL-E 3:
"1024x1024"(default)"1792x1024"(landscape)"1024x1792"(portrait)
"256x256""512x512""1024x1024"(default)
"1536x1024"Style of the generated image (DALL-E 3 only). Options:
"vivid": Hyper-real and dramatic images"natural": More natural, less hyper-real images
"vivid"Unique identifier for the end-user, useful for monitoring and abuse detection.
Content moderation level. Options:
"auto"(default): Automatic moderation"low": Minimal moderation
"auto"Response
Unix timestamp of when the images were created.
Array of generated image objects.Each image contains:
url(string, optional): URL to download the image (whenresponse_formatis"url")b64_json(string, optional): Base64-encoded image data (whenresponse_formatis"b64_json")revised_prompt(string, optional): The revised prompt used to generate the image (DALL-E 3 may revise prompts for safety/quality)
Examples
Basic Image Generation
High Quality Landscape
Natural Style Portrait
Multiple Images (DALL-E 2)
Base64 Response Format
Using Different Providers
Best Practices
Writing Effective Prompts
Be specific and descriptive:Handling Revised Prompts
DALL-E 3 may revise prompts for safety and quality. Always check therevised_prompt field:
Image URL Expiration
Image URLs expire after 1 hour. Download and store images immediately:Using Base64 for Immediate Use
For direct embedding in HTML/JSON, useb64_json format:
Content Moderation
All generated images are subject to content moderation policies. Prompts that violate content policies will be rejected with an error. Rejected prompts typically include:- Violence or graphic content
- Sexual or explicit content
- Hateful or discriminatory content
- Illegal activities
- Copyrighted characters or trademarked content
Pricing
Image generation costs vary by:- Model used
- Image size
- Quality setting
- Number of images
- DALL-E 3 Standard (1024x1024): $0.040 per image
- DALL-E 3 HD (1024x1024): $0.080 per image
- DALL-E 2 (1024x1024): $0.020 per image
Error Handling
Common errors:See Also
API Overview
Learn about the Gateway API
Chat Completions
Generate conversational responses