DocsAPIImages

Image Generation API

Generate AI images from text prompts

POST/api/generate/image

Generate images using various AI models including DALL-E 3, Stable Diffusion, and Gemini. The API supports different image sizes, styles, and quality settings.

Request Body

ParameterTypeRequiredDescription
promptstringYesText description of the image to generate
modelstringNoModel ID (dall-e-3, stable-diffusion-xl, gemini-image). Default: dall-e-3
sizestringNoImage size: 1024x1024, 1792x1024, 1024x1792. Default: 1024x1024
qualitystringNoQuality: standard or hd. Default: standard
stylestringNoStyle: vivid or natural. Default: vivid

Example Request

curl -X POST https://your-domain.com/api/generate/image \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "A futuristic cityscape at sunset with flying cars",
    "model": "dall-e-3",
    "size": "1792x1024",
    "quality": "hd",
    "style": "vivid"
  }'

Example Response

{
  "success": true,
  "data": {
    "id": "gen_abc123xyz",
    "url": "https://storage.example.com/images/gen_abc123xyz.png",
    "prompt": "A futuristic cityscape at sunset with flying cars",
    "model": "dall-e-3",
    "size": "1792x1024",
    "creditsUsed": 15,
    "createdAt": "2026-02-04T12:00:00Z"
  }
}

Error Codes

CodeDescription
400Bad Request - Invalid parameters
401Unauthorized - Invalid or missing API key
402Payment Required - Insufficient credits
429Too Many Requests - Rate limit exceeded
500Internal Server Error

Available Models

dall-e-315 credits
DALL-E 3
OpenAI's most advanced image model
dall-e-28 credits
DALL-E 2
Fast and cost-effective
gemini-image12 credits
Gemini Image
Google's multimodal image generation