API Documentation

Use our REST API to generate AI images programmatically. All API requests require authentication via Bearer token.

Base URL

https://www.aiphotogenerator.net/api

Authentication

All API requests must include your API token in the Authorization header:

Authorization: Bearer YOUR_API_TOKEN

You can find your API token in the user dropdown menu at the top right corner of the page.

Generate Images

POST /api/images/generate

Generate AI images based on a text prompt and optional input images.

Request Body

Parameter Type Required Description
model string Required AI model to use. See available models below.
prompt string Required The text description of the image you want to generate (max 1024 characters)
width integer Required Output image width in pixels (512-4096)
height integer Required Output image height in pixels (512-4096)
count integer Optional Number of images to generate (1-10). Default: 1
input array Optional Array of image URLs to use as input/reference images (max 10)
negative_prompt string Optional Things to avoid in the generated image (max 1024 characters)

Example Request

curl -X POST https://www.aiphotogenerator.net/api/images/generate \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "A professional headshot of a business executive in a modern office",
    "width": 1024,
    "height": 1024,
    "model": "flux-1",
    "count": 1
  }'

Example Response

{
  "success": true,
  "images": [
    {
      "id": "abc123xyz",
      "status": 0,
      "width": 1024,
      "height": 1024,
      "created_at": "2024-01-15T10:30:00.000000Z"
    }
  ],
  "message": "1 image(s) queued for generation"
}

Async Processing

Images are generated asynchronously. The response returns immediately with image IDs in "queued" status. Use webhooks or polling to get the final results.

Error Responses

Status Code Description
401 Unauthorized Missing or invalid API token
402 Payment Required Insufficient credits to complete the request
422 Unprocessable Entity Validation error (check the response body for details)
429 Too Many Requests Rate limit exceeded
500 Internal Server Error Server error (please try again later)

Available Models

API ID Name
stable-diffusion-xl Stable Diffusion XL
flux-2 Flux 2 Pro
flux-2-flex Flux 2 Flex
nano-banana-pro Nano Banana Pro (Gemini Pro Image)
nano-banana Nano Banana (Gemini Image)
seedream-4 Seedream 4

Credits

Each image generation costs credits based on the output dimensions and model used. Check your current credit balance in the user menu or the billing page.

Need more credits? Upgrade your plan or purchase additional credits.