AT
Auto Toon Docs

Product Enhancement

Generate AI-enhanced product images with customizable styles, lighting, and compositions. This is the core product enhancement endpoint.

Endpoint

POST/api/enhance-product
Authentication required. Include your API key in the x-api-key header with every request.

Request Parameters

ParameterTypeRequiredDescription
imageUrlstringRequiredURL of product image (max 2000 chars)
productNamestringRequiredProduct name (1-200 chars)
modelstringOptionalgemini (default, 3cr), gemini-flash (2cr), or seedream (1cr)
typestringOptionalvignette (default), elements, poster, 3x3, or food
skipSecondImagebooleanOptionalOnly generate hero image (saves credits)
skipHeroImagebooleanOptionalOnly generate second image (saves credits)
promptCustomizationsobjectOptional{background, lighting, composition} strings
elementsConfigobjectOptionalFor elements type: {keyElements: string[], enhancers: string[]}
posterConfigobjectOptionalFor poster type: {headline, primaryColor, tagline?, topLabel?, text?, colorScheme?, textColor?, aspectRatio?}
seedreamConfigobjectOptionalFor seedream model: {aspect_ratio: string}

Response

Success (200)
json
{
  "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.

bash
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.

json
{
  "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.

json
{
  "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.

json
{
  "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.

json
{
  "imageUrl": "https://example.com/burger.jpg",
  "productName": "Gourmet Burger",
  "type": "food"
}

Credit Costs

ModelHero OnlyHero + Second3x3 Grid
Gemini Pro3 cr6 cr9 cr
Nano Banana 22 cr4 cr6 cr
SeeDream1 cr2 cr3 cr
Tip: Use 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).

bash
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"
  }'
Response (200)
json
{
  "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).

bash
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"
      ]
    }
  }'
Response (200)
json
{
  "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).

bash
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"
    }
  }'
Response (200)
json
{
  "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

StatusDescription
400Missing required fields (imageUrl, productName)
401Invalid or missing API key
402Insufficient credits (includes balance, required, needsTopUp)
429Rate limit exceeded
500Generation failed

Insufficient Credits (402)

Response
json
{
  "error": "Insufficient credits",
  "code": "INSUFFICIENT_CREDITS",
  "balance": 1,
  "required": 6,
  "needsTopUp": true
}

Missing Fields (400)

Response
json
{
  "error": "imageUrl and productName are required"
}

Invalid API Key (401)

Response
json
{
  "error": "Invalid API key"
}

Dialog Title

Dialog Title

Dialog Title

Dialog Title