API Reference
Images
POST /v1/images/generations — generate images from text prompts
Images
POST /v1/images/generations
Generate images from a text description using supported image generation models.
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | Yes | Image model ID, e.g. dall-e-3, dall-e-2 |
prompt | string | Yes | Text description of the desired image. Max 4,000 characters for DALL-E 3 |
n | integer | No | Number of images to generate. Default: 1. DALL-E 3 only supports n=1 |
size | string | No | Image dimensions. See model table below |
quality | string | No | standard (default) or hd (DALL-E 3 only) |
style | string | No | vivid (default) or natural (DALL-E 3 only) |
response_format | string | No | url (default) or b64_json |
user | string | No | End-user identifier |
Example Request
curl https://api.soxai.io/v1/images/generations \
-H "Authorization: Bearer $SOXAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "dall-e-3",
"prompt": "A photorealistic image of a polar bear using a laptop in a coffee shop, warm lighting",
"n": 1,
"size": "1024x1024",
"quality": "hd"
}'Example Response
{
"created": 1743350400,
"data": [
{
"url": "https://oaidalleapiprodscus.blob.core.windows.net/...",
"revised_prompt": "A photorealistic image of a large polar bear..."
}
]
}The revised_prompt field (DALL-E 3 only) shows how the model interpreted and enhanced your prompt.
Supported Sizes
| Model | Supported Sizes |
|---|---|
dall-e-3 | 1024x1024, 1792x1024, 1024x1792 |
dall-e-2 | 256x256, 512x512, 1024x1024 |
Base64 Response
To receive the image as base64-encoded data instead of a URL:
{
"model": "dall-e-3",
"prompt": "A mountain landscape",
"response_format": "b64_json"
}import base64
response = client.images.generate(
model="dall-e-3",
prompt="A mountain landscape",
response_format="b64_json",
)
image_data = base64.b64decode(response.data[0].b64_json)
with open("image.png", "wb") as f:
f.write(image_data)Content Policy
Image generation requests are subject to the upstream provider's content policy. Requests that violate the policy will return a 400 error with a content policy violation message.