How to Build an AI Fashion Try-On App with AI Pass SDK
How to Build an AI Fashion Try-On App with AI Pass SDK
Virtual try-on is one of the hottest AI use cases in e-commerce. In this tutorial, you'll build an AI Fashion Try-On app that lets users upload a photo and see themselves in any outfit. You earn 50% commission on every API call.
What You'll Build
A web app where users:
- Upload their photo
- Describe an outfit
- Get a realistic visualization of themselves wearing it
Step 1: Create Your AI Pass Account
- Go to aipass.one and sign up
- Verify your email (required for payouts)
- Open the Developer Dashboard
Step 2: Create an OAuth2 Client
- In the Developer Dashboard, go to OAuth2 Clients
- Click Create Client
- Copy your Client ID (looks like
client_XXXX...)
Step 3: Build the App
This app uses AiPass.editImage() with Gemini's image editing model to blend outfits onto photos.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>AI Fashion Try-On</title>
<link href="https://aipass.one/aipass-ui.css" rel="stylesheet">
<style>
body { font-family: sans-serif; max-width: 600px; margin: 40px auto; padding: 20px; }
input[type=file], textarea, button { display: block; width: 100%; margin: 10px 0; padding: 10px; font-size: 15px; }
textarea { height: 80px; }
#result { margin-top: 20px; text-align: center; }
#result img { max-width: 100%; border-radius: 12px; }
</style>
</head>
<body>
<h1>👗 AI Fashion Try-On</h1>
<p>Upload your photo and describe the outfit you want to try.</p>
<input type="file" id="photo" accept="image/*">
<textarea id="outfit" placeholder="Describe the outfit: e.g. elegant black evening dress with gold accessories"></textarea>
<button onclick="tryOn()">Try It On</button>
<div id="result"></div>
<script src="https://aipass.one/aipass-sdk.js"></script>
<script>
AiPass.initialize({
clientId: 'YOUR_CLIENT_ID',
requireLogin: true,
darkMode: true
});
async function tryOn() {
const fileInput = document.getElementById('photo');
const outfit = document.getElementById('outfit').value;
const resultDiv = document.getElementById('result');
if (!fileInput.files[0] || !outfit) {
resultDiv.innerHTML = '<p>Please upload a photo and describe the outfit.</p>';
return;
}
resultDiv.innerHTML = '<p>Generating try-on... this may take 10-20 seconds.</p>';
try {
const r = await AiPass.editImage({
image: fileInput.files[0],
prompt: `Put this person in the following outfit: ${outfit}. Keep the person face and body shape the same. Make it look realistic and natural.`,
model: 'gemini/gemini-3-pro-image-preview'
});
resultDiv.innerHTML = `<img src="${r.data[0].url}" alt="Try-on result">`;
} catch (e) {
resultDiv.innerHTML = '<p>Error: ' + e.message + '</p>';
}
}
</script>
</body>
</html>
Step 4: Deploy
Option A: Self-host anywhere — your server, GitHub Pages, Netlify, Vercel. SDK handles auth and billing.
Option B: Publish on AI Pass — get a dedicated page with the </> embed button.
Key Details
AiPass.editImage()handles the image editing — routes through Gemini's image modelgemini/gemini-3-pro-image-previewis the recommended model for image editingrequireLogin: true— shows auth screen automatically- Response:
r.data[0].urlgives you the result image URL - Users get $1 free credit on signup, then pay as you go
- You earn 50% commission on every API call