Skip to main content

LoRA Generation API

LoRA (Low-Rank Adaptation) models enable AI-generated predictions for your products. This process trains a custom AI model specifically for your product, allowing it to be intelligently placed in any environment.

What is LoRA?

LoRA is a machine learning technique that creates a specialized model for your product:

  • Custom Training: The AI learns your product's specific appearance, lighting, and angles
  • Context Awareness: Understands how your product should look in different environments
  • Realistic Integration: Generates images where your product naturally fits the scene
  • Brand Consistency: Maintains your product's visual identity across all generations
Prerequisites

LoRA generation is only available for products created from templates with "loraScene": "available". Check the template details before creating your product.

Generate LoRA

Create a LoRA model for an existing product to enable AI predictions.

Endpoint

POST /product/{product_id}/generate-lora

Parameters

ParameterTypeRequiredDescription
product_idstringID of the product to generate LoRA for

Request Example

curl -X POST https://app.veez.ai/api/product/b01a9ff690428a78640fb0f738283a77/generate-lora \
-H "Authorization: Bearer $YOUR_API_TOKEN"

Response Examples

LoRA Generation Started

{
"result": "LoRA creation in progress"
}

Already in Progress

{
"result": "LoRA creation already in progress"
}

Already Complete

{
"result": "LoRA already created"
}

LoRA Generation Process

Timeline

  • Training Time: 10-30 minutes depending on complexity
  • Status Updates: Check product status via Get Product endpoint
  • Completion: lora_enabled field becomes 1 when ready

What Happens During Generation

  1. Data Preparation: Your product textures are processed and optimized
  2. 3D Rendering: Multiple angles and lighting conditions are generated
  3. Model Training: AI learns your product's visual characteristics
  4. Validation: The model is tested for quality and accuracy
  5. Deployment: LoRA becomes available for predictions

Monitoring Progress

Check the LoRA status by retrieving your product:

curl -H "Authorization: Bearer $TOKEN" \
https://app.veez.ai/api/product/b01a9ff690428a78640fb0f738283a77

Look for the lora_enabled field:

  • 0 = LoRA not ready or in progress
  • 1 = LoRA ready for predictions

LoRA Requirements

Template Compatibility

# Check if template supports LoRA
curl -H "Authorization: Bearer $TOKEN" \
https://app.veez.ai/api/template/279

# Response should include:
# "loraScene": "available"

Product Quality

For best LoRA results:

  • High-resolution textures (1024x1024 minimum)
  • Clear, detailed designs without blur or artifacts
  • Good contrast between elements
  • Consistent lighting across texture files

Error Responses

400 LoRA Not Supported

{
"error": "Bad Request",
"message": "LoRA generation not available for this template"
}

404 Product Not Found

{
"error": "Not Found",
"message": "Product with ID xyz does not exist"
}

429 Rate Limited

{
"error": "Too Many Requests",
"message": "LoRA generation limit exceeded. Please wait before starting another."
}

Best Practices

Before Starting LoRA

  • Verify template compatibility first
  • Ensure high-quality textures are uploaded
  • Test product packshots look correct
  • Plan for processing time (10-30 minutes)

Managing Multiple Products

#!/bin/bash
# Generate LoRA for multiple products
TOKEN="your_token_here"

products=("product_id_1" "product_id_2" "product_id_3")

for product_id in "${products[@]}"; do
echo "Starting LoRA for $product_id"
curl -X POST https://app.veez.ai/api/product/$product_id/generate-lora \
-H "Authorization: Bearer $TOKEN"

# Wait between requests to avoid rate limits
sleep 30
done

Quality Optimization

  • Use consistent lighting across all texture images
  • Avoid heavily compressed JPEGs that introduce artifacts
  • Test with simple prompts first before complex scenes
  • Keep product designs clear and uncluttered

Workflow Example

Complete workflow from product creation to LoRA generation:

TOKEN="your_token_here"

# 1. Create product from LoRA-compatible template
product_response=$(curl -X POST https://app.veez.ai/api/product/ \
-H "Authorization: Bearer $TOKEN" \
-F "template_id=279" \
-F "name=Coffee Package" \
-F "texture[0]=@coffee-design.jpg" \
-F "texture[0][key]=TEX01")

# 2. Extract product ID from response
product_id=$(echo $product_response | jq -r '.id')

# 3. Start LoRA generation
curl -X POST https://app.veez.ai/api/product/$product_id/generate-lora \
-H "Authorization: Bearer $TOKEN"

# 4. Monitor progress (check every few minutes)
while true; do
status=$(curl -s -H "Authorization: Bearer $TOKEN" \
https://app.veez.ai/api/product/$product_id | jq -r '.lora_enabled')

if [ "$status" = "1" ]; then
echo "LoRA ready for $product_id!"
break
else
echo "LoRA still processing..."
sleep 60
fi
done

Next Steps

Once your LoRA is generated (lora_enabled: 1):

  1. Create Predictions - Generate AI images with your product
  2. View Examples - See advanced use cases
  3. Test different prompts to explore your product's capabilities
Performance

LoRA models perform best with clear, descriptive prompts. Start with simple environments before trying complex scenes.