Product Enhancement
Generate AI-enhanced product images with customizable styles, lighting, and compositions. This is the core product enhancement endpoint.
Endpoint
/api/enhance-productx-api-key header with every request.Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
imageUrl | string | Required | URL of product image (max 2000 chars) |
productName | string | Required | Product name (1-200 chars) |
model | string | Optional | gemini (default, 3cr), gemini-flash (2cr), or seedream (1cr) |
type | string | Optional | vignette (default), elements, poster, 3x3, or food |
skipSecondImage | boolean | Optional | Only generate hero image (saves credits) |
skipHeroImage | boolean | Optional | Only generate second image (saves credits) |
promptCustomizations | object | Optional | {background, lighting, composition} strings |
elementsConfig | object | Optional | For elements type: {keyElements: string[], enhancers: string[]} |
posterConfig | object | Optional | For poster type: {headline, primaryColor, tagline?, topLabel?, text?, colorScheme?, textColor?, aspectRatio?} |
seedreamConfig | object | Optional | For seedream model: {aspect_ratio: string} |
Response
{
"text": "Product description with benefits...",
"heroImageUrl": "https://...",
"vignetteImageUrl": "https://...",
"labels": ["Benefit 1", "Benefit 2", "Benefit 3"],
"creditsRemaining": 8,
"success": true
}Image Types
1. Vignette (default)
Generates a hero image plus a second image with benefit labels overlaid in an elegant vignette layout.
curl -X POST https://www.auto-toon.com/api/enhance-product \
-H "Content-Type: application/json" \
-H "x-api-key: toon_xxxx_your_api_key" \
-d '{
"imageUrl": "https://example.com/serum.jpg",
"productName": "Luxury Skincare Serum"
}'2. Elements
Generates a hero image plus a second image featuring decorative elements and visual enhancers around the product.
{
"imageUrl": "https://example.com/drink.jpg",
"productName": "Energy Drink",
"type": "elements",
"elementsConfig": {
"keyElements": ["Product clearly visible", "Dynamic splash effects"],
"enhancers": ["Vibrant colors", "Motion blur", "Sparkle effects"]
}
}3. Poster
Generates a hero image plus a promotional poster with custom branding, headline, colors, and tagline.
{
"imageUrl": "https://example.com/serum.jpg",
"productName": "Luxury Serum",
"type": "poster",
"posterConfig": {
"headline": "PREMIUM SERUM",
"tagline": "Transform your skin with nature",
"primaryColor": "rose gold",
"colorScheme": "monochromatic",
"aspectRatio": "4:5"
}
}4. 3x3 Grid
Generates a 3x3 grid of 9 different product angles and compositions. Costs 9 credits with Gemini Pro.
{
"imageUrl": "https://example.com/shoe.jpg",
"productName": "Running Shoe Pro",
"type": "3x3"
}5. Food
Specialized food photography enhancement. Optimized prompts for appetizing presentation, plating, and garnish styling.
{
"imageUrl": "https://example.com/burger.jpg",
"productName": "Gourmet Burger",
"type": "food"
}Credit Costs
| Model | Hero Only | Hero + Second | 3x3 Grid |
|---|---|---|---|
| Gemini Pro | 3 cr | 6 cr | 9 cr |
| Nano Banana 2 | 2 cr | 4 cr | 6 cr |
| SeeDream | 1 cr | 2 cr | 3 cr |
skipSecondImage or skipHeroImage to halve the credit cost when you only need one image.Full Examples
Example 1: Simple Vignette (default)
Minimal request using defaults. Generates hero + vignette images (6 credits with Gemini Pro).
curl -X POST https://www.auto-toon.com/api/enhance-product \
-H "Content-Type: application/json" \
-H "x-api-key: toon_xxxx_your_api_key" \
-d '{
"imageUrl": "https://images.unsplash.com/photo-1620916566398-39f1143ab7be?w=800",
"productName": "Luxury Skincare Serum"
}'{
"text": "**Luxury Skincare Serum** - $45\n\nPremium anti-aging formula...\n\n- Reduces fine lines\n- Deep hydration\n- Natural ingredients",
"heroImageUrl": "https://supabase.co/.../hero_1234.png",
"vignetteImageUrl": "https://supabase.co/.../vignette_1234.png",
"labels": ["Reduces fine lines", "Deep hydration", "Natural ingredients", "Anti-aging", "Vitamin E"],
"creditsRemaining": 8,
"success": true
}Example 2: Elements with Config
Elements type with custom key elements and visual enhancers (6 credits with Gemini Pro).
curl -X POST https://www.auto-toon.com/api/enhance-product \
-H "Content-Type: application/json" \
-H "x-api-key: toon_xxxx_your_api_key" \
-d '{
"imageUrl": "https://images.unsplash.com/photo-1622483767028-3f66f32aef97?w=800",
"productName": "Energy Drink",
"type": "elements",
"elementsConfig": {
"keyElements": [
"Product clearly visible",
"Dynamic splash effects",
"Fresh ingredients"
],
"enhancers": [
"Vibrant colors",
"Motion blur",
"Sparkle effects"
]
}
}'{
"text": "**Energy Drink** - $3.99\n\nBoost your energy naturally...\n\n- Natural caffeine\n- Zero sugar\n- Vitamin B complex",
"heroImageUrl": "https://supabase.co/.../hero_9012.png",
"vignetteImageUrl": "https://supabase.co/.../elements_9012.png",
"labels": ["Natural caffeine", "Zero sugar", "Vitamin B complex", "Refreshing", "Energy boost"],
"creditsRemaining": 6,
"success": true
}Example 3: Poster with Full Customization
Poster type with full branding customization plus prompt tweaks (6 credits with Gemini Pro).
curl -X POST https://www.auto-toon.com/api/enhance-product \
-H "Content-Type: application/json" \
-H "x-api-key: toon_xxxx_your_api_key" \
-d '{
"imageUrl": "https://images.unsplash.com/photo-1620916566398-39f1143ab7be?w=800",
"productName": "Luxury Serum",
"type": "poster",
"posterConfig": {
"headline": "PREMIUM SERUM",
"tagline": "Transform your skin with nature",
"primaryColor": "rose gold",
"topLabel": "NEW ARRIVAL",
"text": "Limited Edition",
"colorScheme": "monochromatic",
"textColor": "#FFFFFF",
"aspectRatio": "4:5"
},
"promptCustomizations": {
"background": "vast empty gradient canvas in champagne gold tones",
"lighting": "soft, subtle studio lighting with controlled highlights",
"composition": "single product centered with balanced negative space"
}
}'{
"text": "**Luxury Serum** - $89\n\nPremium botanical serum...\n\n- Organic ingredients\n- Clinically tested\n- Visible results",
"heroImageUrl": "https://supabase.co/.../hero_3456.png",
"vignetteImageUrl": "https://supabase.co/.../poster_3456.png",
"labels": ["Organic ingredients", "Clinically tested", "Visible results", "Luxury formula", "Anti-aging"],
"creditsRemaining": 4,
"success": true
}Error Responses
| Status | Description |
|---|---|
400 | Missing required fields (imageUrl, productName) |
401 | Invalid or missing API key |
402 | Insufficient credits (includes balance, required, needsTopUp) |
429 | Rate limit exceeded |
500 | Generation failed |
Insufficient Credits (402)
{
"error": "Insufficient credits",
"code": "INSUFFICIENT_CREDITS",
"balance": 1,
"required": 6,
"needsTopUp": true
}Missing Fields (400)
{
"error": "imageUrl and productName are required"
}Invalid API Key (401)
{
"error": "Invalid API key"
}