Skip to content

Images

Generate images from text prompts using AI image generation models.

Endpoint

POST /v1/images/generations

Request Body

Parameter Type Required Description
model string Model ID (e.g. dall-e-3, dall-e-2). Default varies.
prompt string Text description of the desired image
n integer Number of images to generate (1–10). Default: 1
size string Image size: 256x256, 512x512, 1024x1024, 1792x1024, 1024x1792
quality string standard or hd (DALL·E 3 only)
style string vivid or natural (DALL·E 3 only)
response_format string url (default) or b64_json

Example

curl https://ai.moducompia.com/v1/images/generations \
  -H "Authorization: Bearer sk-YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "dall-e-3",
    "prompt": "A futuristic city skyline at sunset, digital art",
    "n": 1,
    "size": "1024x1024",
    "quality": "hd"
  }'
response = client.images.generate(
    model="dall-e-3",
    prompt="A futuristic city skyline at sunset, digital art",
    n=1,
    size="1024x1024",
    quality="hd"
)
print(response.data[0].url)

Response

{
  "created": 1723456789,
  "data": [
    {
      "url": "https://...",
      "revised_prompt": "A breathtaking futuristic city..."
    }
  ]
}

Image URLs are temporary

Generated image URLs expire after approximately 1 hour. Download and store images if you need them long-term.