Image Generation
7/28/26About 2 min
Image Generation
The Image Generation API creates images from text descriptions using DALL-E models. Supports both DALL-E 3 and DALL-E 2 with various size and quality options.
Endpoint Info
| Item | Value |
|---|---|
| URL | /v1/images/generations |
| Method | POST |
| Auth | Bearer Token (API Key) |
| Content-Type | application/json |
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | No | Model: dall-e-3 (default) or dall-e-2 |
prompt | string | Yes | Text description of the desired image |
n | integer | No | Number of images to generate. Default 1 (DALL-E 3 only supports 1) |
size | string | No | Image size. DALL-E 3: 1024x1024, 1792x1024, 1024x1792. DALL-E 2: 256x256, 512x512, 1024x1024 |
quality | string | No | Image quality: standard or hd (DALL-E 3 only) |
style | string | No | Style: vivid or natural (DALL-E 3 only) |
response_format | string | No | Response format: url or b64_json. Default url |
cURL Examples
Text-to-Image (DALL-E 3)
curl https://api.quickapi.store/v1/images/generations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"model": "dall-e-3",
"prompt": "A futuristic city at sunset with flying cars and neon lights",
"n": 1,
"size": "1024x1024",
"quality": "hd",
"style": "vivid"
}'URL Format Response
curl https://api.quickapi.store/v1/images/generations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"model": "dall-e-3",
"prompt": "A cute robot reading a book in a cozy library",
"size": "1024x1024",
"response_format": "url"
}'Base64 JSON Format
curl https://api.quickapi.store/v1/images/generations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"model": "dall-e-3",
"prompt": "An oil painting of a mountain landscape",
"size": "1792x1024",
"response_format": "b64_json"
}'DALL-E 2 Multiple Images
curl https://api.quickapi.store/v1/images/generations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"model": "dall-e-2",
"prompt": "A cat wearing a space suit on Mars",
"n": 4,
"size": "512x512",
"response_format": "url"
}'💡 Prompt Quality
Detailed, descriptive prompts produce better results. Include style, lighting, composition, and mood for optimal image generation.
Response Example
URL Format
{
"created": 1700000000,
"data": [
{
"url": "https://api.quickapi.store/images/gen_abc123.png",
"revised_prompt": "A futuristic city at sunset with flying cars and neon lights, in a cyberpunk art style with dramatic lighting"
}
]
}Base64 JSON Format
{
"created": 1700000000,
"data": [
{
"b64_json": "iVBORw0KGgoAAAANSUhEUgAABAAAA...",
"revised_prompt": "An oil painting of a mountain landscape with dramatic clouds and golden hour lighting"
}
]
}Python Example
from openai import OpenAI
client = OpenAI(
base_url="https://api.quickapi.store/v1",
api_key="YOUR_API_KEY"
)
# Generate image with URL response
response = client.images.generate(
model="dall-e-3",
prompt="A futuristic city at sunset with flying cars and neon lights",
size="1024x1024",
quality="hd",
style="vivid"
)
image_url = response.data[0].url
print(f"Image URL: {image_url}")
print(f"Revised prompt: {response.data[0].revised_prompt}")
# Generate image with base64 response
response = client.images.generate(
model="dall-e-3",
prompt="An oil painting of a mountain landscape",
size="1792x1024",
response_format="b64_json"
)
b64_data = response.data[0].b64_json
# Save base64 image to file
import base64
with open("generated_image.png", "wb") as f:
f.write(base64.b64decode(b64_data))
print("Image saved to generated_image.png")
# DALL-E 2 with multiple images
response = client.images.generate(
model="dall-e-2",
prompt="A cat wearing a space suit on Mars",
n=4,
size="512x512"
)
for i, img in enumerate(response.data):
print(f"Image {i+1}: {img.url}")⚠️ URL Expiration
Image URLs returned by the API expire after 1 hour. For persistent storage, either download the image immediately or use b64_json format and save the file yourself.

