AI Magicx
API Endpoints

Image Generation API

Image Generation API

Generate high-quality images and professional logos using various AI models.

Image Generation Endpoint

Code
POST /api/v1/ai-image/generate

Request Body

FieldTypeRequiredDescription
promptstringYesText description of the desired image (1-4000 chars)
modelstringYesThe AI model to use
sizestringNoImage dimensions (default: "square")
nintegerNoNumber of images to generate (1-4, default: 1)
negative_promptstringNoWhat to avoid in the image
stylestringNoArtistic style preset
qualitystringNoImage quality ("standard" or "hd")
seedintegerNoSeed for reproducible generation
guidance_scalenumberNoPrompt adherence (1-20)
num_inference_stepsintegerNoDenoising steps (10-150)

Available Models

Premium Models

  • dall-e-3 - OpenAI's DALL-E 3
  • gpt-image-1 - GPT Image model
  • fal-ai/flux-pro/v1.1-ultra - Flux Pro Ultra
  • fal-ai/flux-pro/v1.1 - Flux Pro

Standard Models

  • fal-ai/flux/schnell - Fast Flux model
  • fal-ai/flux/dev - Flux Development
  • fal-ai/stable-diffusion-v3-medium - SD3 Medium
  • fal-ai/stable-diffusion-v35-large/turbo - SD3.5 Turbo
  • fal-ai/stable-diffusion-v35-large - SD3.5 Large
  • fal-ai/sana/sprint - Sana Sprint

Size Options

  • square - 1024x1024
  • square_hd - 1024x1024 HD
  • square_small - 512x512
  • landscape_4_3 - 1024x768
  • landscape_16_9 - 1024x576
  • portrait_4_3 - 768x1024
  • portrait_16_9 - 576x1024

Style Options

  • photorealistic, anime, digital_art
  • oil_painting, watercolor, sketch
  • cartoon, abstract, 3d_render
  • pixel_art, minimalist, surreal
  • vintage, retro, neon
  • fantasy, sci-fi, steampunk
  • cyberpunk, gothic

Example Request

Code(bash)
curl -X POST https://beta.aimagicx.com/api/v1/ai-image/generate \ -H "Authorization: Bearer mgx-sk-your-api-key" \ -H "Content-Type: application/json" \ -d '{ "prompt": "A serene mountain landscape at sunset with golden lighting", "model": "fal-ai/flux/schnell", "size": "landscape_16_9", "style": "photorealistic", "quality": "hd" }'

Response Format

Code(json)
{ "id": "mgx_img_abc123", "model": "fal-ai/flux/schnell", "object": "image.generation", "created": 1720540800, "data": [ { "url": "https://storage.aimagicx.com/generated/image-123.png", "revised_prompt": "A serene mountain landscape at sunset..." } ], "usage": { "prompt_tokens": 15, "total_tokens": 15, "credits_consumed": 3 } }

Logo Generation Endpoint

Code
POST /api/v1/ai-image/logo

Request Body

FieldTypeRequiredDescription
promptstringYesLogo description (1-2000 chars)
modelstringYesThe AI model to use
stylestringYesLogo style
industrystringYesIndustry category
sizestringNoLogo dimensions
nintegerNoNumber of variations (1-4)
color_schemestringNoPreferred colors
typographystringNoFont style preference
moodstringNoLogo mood/feeling
complexityintegerNoDesign complexity (1-5)
refine_promptbooleanNoAI prompt refinement

Logo Styles

  • minimal - Clean and simple
  • modern - Contemporary design
  • vintage - Classic/retro look
  • playful - Fun and casual
  • corporate - Professional business
  • tech - Technology-focused
  • organic - Natural/flowing
  • geometric - Shape-based
  • hand-drawn - Artistic/sketched
  • abstract - Non-representational

Industries

  • technology, healthcare, finance
  • education, retail, food
  • travel, entertainment, sports
  • real-estate, automotive, fashion
  • beauty, fitness, consulting
  • legal, construction, agriculture
  • energy, nonprofit

Typography Options

  • sans-serif - Clean, modern
  • serif - Traditional, elegant
  • script - Flowing, decorative
  • display - Bold, attention-grabbing
  • monospace - Technical, uniform

Mood Options

  • professional - Serious, business-like
  • friendly - Approachable, warm
  • bold - Strong, confident
  • elegant - Sophisticated, refined
  • playful - Fun, energetic

Logo Example

Code(json)
{ "prompt": "Clean, minimalist logo for 'CloudSync' cloud storage startup", "model": "fal-ai/flux/dev", "style": "minimal", "industry": "technology", "mood": "professional", "color_scheme": "Blue gradient with white accents", "typography": "sans-serif", "complexity": 2 }

Credit Usage

Credit consumption varies by model and options:

Image Generation

  • 1 credit per image

Logo Generation

  • 1 credit per logo

Multiple images (n > 1) multiply the credit cost.

Advanced Features

Negative Prompts

Use negative prompts to exclude unwanted elements:

Code(json)
{ "prompt": "Professional headshot of a business executive", "negative_prompt": "cartoon, anime, unrealistic, low quality, blurry", "model": "fal-ai/stable-diffusion-v3-medium" }

Reproducible Generation

Use seeds for consistent results:

Code(json)
{ "prompt": "Abstract geometric pattern", "model": "fal-ai/flux/schnell", "seed": 12345, "guidance_scale": 7.5 }

Fine-tuning Parameters

For Stable Diffusion and Flux models:

Code(json)
{ "prompt": "Detailed fantasy landscape", "model": "fal-ai/stable-diffusion-v35-large", "guidance_scale": 8.0, "num_inference_steps": 50 }

Best Practices

  1. Prompt Engineering

    • Be specific and descriptive
    • Include style, mood, and lighting
    • Mention important details first
  2. Model Selection

    • Flux Schnell: Fast, good quality
    • DALL-E 3: Best for creative/artistic
    • Stable Diffusion: Great control options
  3. Optimization

    • Start with lower quality for testing
    • Use appropriate sizes
    • Generate single images first
  4. Logo Design

    • Always specify industry and style
    • Include brand personality
    • Consider multiple variations

Error Handling

Model Not Available

Code(json)
{ "success": false, "error": { "code": "MODEL_NOT_ALLOWED", "message": "Model not available for your plan" } }

Invalid Parameters

Code(json)
{ "success": false, "error": { "code": "INVALID_REQUEST", "message": "Invalid size option. Valid options: square, landscape_16_9..." } }

Image Storage

Generated images are:

  • Stored temporarily (30 days)
  • Accessible via secure URLs
  • Can be downloaded immediately
  • Not associated with your account after generation

Rate Limits

Image generation has specific rate limits:

  • Requests per minute vary by plan
  • Concurrent generation limits apply
  • Premium models may have lower limits

Next Steps

Last modified on