API Documentation
API Overview
Introduction
Aluo AI API provides powerful image processing capabilities including intelligent background removal, AI image generation and editing. Perfect for e-commerce product photography, marketing material design, content creation and more. All APIs are REST-based and support JSON data exchange.
Base URL
Base URL for all API requests: https://aluo.ai/api
Authentication
API supports two authentication methods:
1. API Key Authentication (Recommended): Include Authorization: Bearer YOUR_API_KEY in request headers
- API Key starts with "sk-"
- Get from "API Keys" page in Aluo AI console
2. Session Authentication: For logged-in web applications
- Pass session info via Cookie
- Requires user logged into Aluo AI platform
Credit System
All business APIs consume credits. Different user types have different credit costs:
- Free users: Standard credit pricing
- Subscribed users (Creator + Pro): Enjoy credit discounts
API Key Management
Getting API Keys
Create and manage your API keys in the Aluo AI console.
Steps:
- Login to Aluo AI platform: https://aluo.ai
- Go to the console page
- Click "API Keys" in the left menu
- Click "Create New Key" button
- Set name and permissions for the key
- Copy the generated key (starts with sk-)
Important Tips
- Keep your API keys secure, don't hardcode in source code
- Use environment variables to store API keys
- Disable or delete unused keys anytime in console
Key Security
Best practices for protecting your API key security.
Steps:
- Store API keys in environment variables, not in code
- Rotate API keys regularly
- Monitor API key usage
- Disable immediately in console if leaked
Intelligent Background Removal
POST /api/remove-bg
Use advanced BRIA AI model to intelligently remove photo backgrounds, supporting hair-level detail preservation. Returns JSON format including processed image URL and detailed information. Perfect for product image processing, portrait cutouts and more.
💳 Credit Cost
Request Parameters
Upload image files using multipart/form-data format.
Steps:
- file (required): Image file, supports PNG, JPG, WebP formats
- Maximum file size: 10MB
- Recommended resolution: Up to 4096x4096 pixels
Response Format
Returns JSON format with processed image URL, file info and dimension data:
• url: CDN URL of processed image (PNG format, transparent background)
• originalFileName: Original filename
• processedFileName: Processed filename
• width/height: Image dimensions
• fileSize: File size (bytes)
• contentType: Content type (image/png)
Use Cases
• E-commerce products: Quickly remove product photo backgrounds, create white background images
• Portrait processing: Hair-level precision removal of portrait backgrounds for easy composition
• Material creation: Remove backgrounds from design materials for better reusability
• ID photo processing: Quickly create standard ID photo backgrounds
AI Intelligent Image Editing
POST /api/photo-editor/generate
Based on reference images and text prompts, use the latest Fal AI Nano-Banana model for intelligent image editing. Supports multiple reference images (up to 5), achieving style conversion, content adjustment, quality enhancement and more. This is an async task that returns taskId after creation, requiring polling of the status endpoint for results.
💳 Credit Cost
Request Methods
Supports two request methods:
1. JSON Method (Recommended)
Content-Type: application/json
For already uploaded images, directly pass image URL array
2. FormData Method
Content-Type: multipart/form-data
For direct local file upload, supports file0, file1, file2... multi-file upload
Request Parameters (JSON Method)
Steps:
- prompt (required): Natural language description of editing instructions
- imageUrls (required): Reference image URL array, 1-5 images
- aspectRatio (optional): Output aspect ratio (16:9, 1:1, 9:16, 4:3, 3:4, etc.)
- outputFormat (optional): Output format, default png (jpeg, png, webp)
- numImages (optional): Number of images to generate, default 1
Request Parameters (FormData Method)
Steps:
- prompt (required): Editing instruction text
- file0, file1, file2... (required): Image files, 1-5 files
- aspectRatio (optional): Output aspect ratio
- outputFormat (optional): Output format, default png
- numImages (optional): Number of images to generate, default 1
Response Format
Returns JSON with taskId and input information:
• taskId: Task ID for querying results
• provider: AI provider (fal)
• prompt: Used prompt
• inputImages: Input image URL array
• aspectRatio: Aspect ratio setting
• outputFormat: Output format
GET /api/photo-editor/status?taskId=xxx
Query AI image editing task status and results.
Query Parameters:
• taskId (required): Task ID obtained from generate endpoint
Response Format:
• status: Task status (SUCCESS/PENDING/FAILED)
• images: Array of edited images (including url, width, height, etc.)
• description: Image description (if available)
Use Cases
• Product optimization: Improve product photo effects based on multiple reference images
• Style conversion: Convert ordinary photos to specific artistic styles
• Content enhancement: Improve image quality, add or modify visual elements
• Creative design: Multi-image fusion for creative visual transformation
AI Photo Generation
POST /api/photo-generate/generate
Use the latest Fal AI Nano-Banana model to generate high-quality product images based on text descriptions. Approximately 3x faster than before, supporting multiple sizes, formats and batch generation. This is an async task that returns taskId after creation, requiring polling of the status endpoint for results.
💳 Credit Cost
Request Parameters
Steps:
- prompt (required): Natural language text describing the product
- size (optional): Image aspect ratio, default 1:1 (supports: 1:1, 3:2, 2:3, 16:9, 9:16, 4:3, 3:4, 4:5, 5:4, 21:9)
- outputFormat (optional): Output format, default png (jpeg, png, webp)
- nVariants (optional): Number of variants to generate, default 1 (supports 1, 2, 4)
Response Format
Returns JSON with taskId and generation config:
• taskId: Task ID for querying results
• provider: AI provider (fal)
• prompt: Used prompt
• size: Aspect ratio setting
• outputFormat: Output format
• nVariants: Number of variants
GET /api/photo-generate/status?taskId=xxx
Query AI product image generation task status and results.
Query Parameters:
• taskId (required): Task ID obtained from generate endpoint
Response Format:
• status: Task status (SUCCESS/PENDING/FAILED)
• images: Array of generated images (including url, width, height, content_type, etc.)
• timings: Performance metrics (inference time, etc.)
Use Cases
• E-commerce products: Quickly generate professional product images for new products
• Marketing materials: Batch create product promotion and advertising materials
• Concept design: Visualize product ideas and design proposals
• A/B testing: Generate multiple variants for effect comparison
• Sample display: Preview product effects before physical production
AI Background Generation
POST /api/ai-generate-background
Instantly generate professional background images based on text descriptions, suitable for product photography, scene design and more. Supports various styles and environmental settings, can quickly create appropriate background environments for products or content. This is a synchronous API that returns results immediately.
💳 Credit Cost
Request Parameters
prompt (required): Background description text, supports Chinese and English
Can describe style, color, material, lighting and other elements
Supports scene descriptions like "studio", "natural environment", "indoor scene", etc.
Use Cases
• Product photography: Generate professional shooting backgrounds for products
• E-commerce design: Create environmental atmosphere for product display
• Content creation: Make suitable backgrounds for articles and posters
• Brand visual: Unify brand visual background style
Response Format
Synchronously returns generation results, including background image URL.