API Documentation

Integrate AIPhoto's AI image generation into your own apps and workflows with our simple REST API.

Version 1.0 Base URL: https://imagegpt.ru/api

Authentication

All API requests must include your API key in the Authorization header.

Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
X-Requested-With: XMLHttpRequest

API keys are issued with the Pro plan. Join the waitlist →

POST /api/generate

Generate a new AI image from a text prompt. Returns a URL to the generated image.

Request Body

Parameter Type Required Description
prompt string Yes Text description of the image to generate. Max 400 characters.
model string No AI model: flux-pro (default), dall-e-3, stable-diffusion-xl-1024-v1-0, flux-schnell
style string No Style preset: Photorealistic (default), Cinematic, Illustration, Anime, etc.
ratio string No Aspect ratio: 1:1 (default), 16:9, 9:16

Example Request

curl -X POST https://aiphoto.io/api/generate \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "A serene mountain lake at golden hour, photorealistic",
    "model": "flux-pro",
    "style": "Photorealistic",
    "ratio": "16:9"
  }'

Success Response (200)

{
  "success": true,
  "url": "https://cdn.openrouter.ai/generated/abc123.png",
  "model": "flux-pro",
  "ratio": "16:9",
  "usage": 2,
  "remaining": 3
}

POST /api/enhance

Enhance or upscale an uploaded photo using AI. Accepts multipart form data with the image file.

curl -X POST https://aiphoto.io/api/enhance \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -F "image=@photo.jpg" \
  -F "strength=7"

Success Response (200)

{
  "success": true,
  "url": "https://cdn.openrouter.ai/enhanced/xyz789.png",
  "original_size": "512x512",
  "enhanced_size": "2048x2048"
}

GET /api/status

Check API status and your current rate limit usage.

curl https://aiphoto.io/api/status \
  -H "Authorization: Bearer YOUR_API_KEY"

# Response:
{
  "status": "ok",
  "version": "1.0",
  "usage_today": 2,
  "limit_today": 5,
  "remaining": 3,
  "reset_at": "2026-05-10T00:00:00Z"
}

Error Codes

Code Status Meaning
rate_limited 429 Daily generation limit reached. Resets at midnight UTC.
invalid_prompt 400 Prompt is missing, empty, or exceeds 400 characters.
invalid_model 400 Specified model is not supported.
content_filtered 422 Prompt was rejected by the content safety filter.
generation_failed 500 AI model returned an error. Retry with same or different model.
unauthorized 401 Missing or invalid API key.
server_error 500 Unexpected server error. Contact support if it persists.

Rate Limiting

All endpoints are rate-limited. Limits vary by plan:

Free (Browser)
5 generations / day / IP
Pro (API Key)
1,000 req / day / key — Coming Soon

Rate limit headers are included in every response: X-RateLimit-Remaining, X-RateLimit-Reset.