DEV Community

Om Prakash
Om Prakash

Posted on • Originally published at pixelapi.dev

I Built a Virtual Try-On API for Indian E-commerce Sellers (10x Cheaper Than FASHN.ai)

The Problem That's Costing Indian Sellers Millions

I run a small GPU cluster in Pune. A few months ago, a friend who sells kurtas on Meesho told me something that stuck with me:

"Bhai, every product photo costs me ₹500–₹2000 for a model shoot. I have 300 SKUs. Do the math."

That's ₹1,50,000 minimum — just for photos. And if he wants to show the same kurta in 5 colors? Multiply that by 5.

This is the reality for millions of small sellers on Meesho, Myntra, Flipkart, and Amazon India. Professional model shoots are expensive, slow, and completely out of reach for small catalog businesses.

Virtual try-on technology exists — but the APIs offering it are priced for US/EU markets. FASHN.ai charges $0.075 per image. For an Indian seller doing 10,000 images/month, that's $750 (₹62,500) — per month.

So I built PixelAPI: a virtual try-on API priced at ₹3 per image ($0.035). Here's exactly how.


The Tech: OOTDiffusion on RTX 4060 Ti

I chose OOTDiffusion (Apache 2.0 — commercial use OK) as the backbone model. It's a latent diffusion model that does outfit transfer: give it a person image + garment image → outputs a photorealistic try-on image.

Hardware: RTX 4060 Ti 16GB

  • Inference: ~8-12 seconds per image
  • VRAM peak: ~10-11GB with FP16
  • Throughput: ~5-6 images/minute
# Setup OOTDiffusion
git clone https://github.com/levihsu/OOTDiffusion
cd OOTDiffusion
pip install -r requirements.txt
python scripts/download_checkpoints.py
Enter fullscreen mode Exit fullscreen mode

The API

# Simple cURL call
curl -X POST https://api.pixelapi.dev/v1/virtual-tryon \
  -H "X-API-Key: YOUR_API_KEY" \
  -F "person_image=@model.jpg" \
  -F "garment_image=@kurta.jpg" \
  -F "garment_type=upper" \
  --output result.jpg
Enter fullscreen mode Exit fullscreen mode
# Python SDK
import requests

with open('model.jpg', 'rb') as person, open('kurta.jpg', 'rb') as garment:
    r = requests.post(
        'https://api.pixelapi.dev/v1/virtual-tryon',
        headers={'{'X-API-Key': 'YOUR_KEY'}},
        files={
            'person_image': person,
            'garment_image': garment,
        },
        data={'{'garment_type': 'upper'}}
    )
print(r.json()['image_url'])
Enter fullscreen mode Exit fullscreen mode

Pricing vs Competitors

Service Price/Image 10K imgs/month
PixelAPI ₹3 ($0.035) ₹30,000
FASHN.ai $0.075 (₹6.25) $750 (₹62,500)
Replicate ~$0.05-0.10 ~$500-1000
Segmind ~$0.04-0.08 ~$400-800
Model shoot ₹500-2000/outfit ₹50,00,000+

PixelAPI is 10x cheaper than FASHN.ai and 100-500x cheaper than model shoots.


Key Engineering Challenges

VRAM OOM crashes: Fixed with FP16, attention slicing, and torch.cuda.empty_cache() after each job.

Queue bursty load: Used Redis Streams with consumer groups. Multiple worker processes drain the queue independently.

Auto garment detection: Added a CLIP-based classifier to auto-detect upper/lower/dress — sellers kept getting this wrong.


Try It Free

First 50 API calls are free. No credit card needed.

👉 https://pixelapi.dev

Built in Pune, India 🇮🇳 — priced for Indian sellers.


📖 Full Tutorial Available

We've published a complete step-by-step tutorial covering curl, Python, and Node.js:
👉 Virtual Try-On API Tutorial

The tutorial covers image requirements, error handling, batch processing, and more.

Top comments (0)