SoxAIDocs
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

ParameterTypeRequiredDescription
modelstringYesImage model ID, e.g. dall-e-3, dall-e-2
promptstringYesText description of the desired image. Max 4,000 characters for DALL-E 3
nintegerNoNumber of images to generate. Default: 1. DALL-E 3 only supports n=1
sizestringNoImage dimensions. See model table below
qualitystringNostandard (default) or hd (DALL-E 3 only)
stylestringNovivid (default) or natural (DALL-E 3 only)
response_formatstringNourl (default) or b64_json
userstringNoEnd-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

ModelSupported Sizes
dall-e-31024x1024, 1792x1024, 1024x1792
dall-e-2256x256, 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.