Build an AI Passport Photo App with AI Pass SDK
Build an AI Passport Photo App with AI Pass SDK
Passport photos are a pain point for millions of people. Here's how to build an AI-powered passport photo maker and earn money from it.
What You'll Build
A web app where users upload a selfie, select their country, and get a compliant passport photo. The AI handles background removal, proper sizing, and formatting. You earn 50% commission on every API call.
Step 1: Create an AI Pass Account
Sign up at aipass.one and verify your email.
Step 2: Create an OAuth2 Client
-
Open the Developer Dashboard
-
Go to OAuth2 Clients
-
Create a new client
-
Copy your Client ID (looks like
client_XXXX— NOT your app slug)
Step 3: Add the SDK
Step 4: Initialize
AiPass.initialize({
clientId: 'client_YOUR_CLIENT_ID',
requireLogin: true
});
requireLogin: true handles authentication automatically — users see a login screen if they're not signed in.
Step 5: Build the Photo Editor
For passport photos, you need image editing (not generation). Use editImage() with the Gemini model:
async function createPassportPhoto(imageFile, country) {
const requirements = getRequirements(country);
const result = await AiPass.editImage({
model: 'gemini/gemini-3-pro-image-preview',
image: imageFile,
prompt: `Transform this selfie into a compliant ${country} passport photo. Requirements: ${requirements}. White background, proper head size ratio, centered face, neutral expression, even lighting.`
});
const photoUrl = result.data[0].url;
document.getElementById('result').src = photoUrl;
}
function getRequirements(country) {
const reqs = {
'US': '2x2 inches, white background, head 1-1.375 inches',
'UK': '35x45mm, light grey background, head 29-34mm',
'EU': '35x45mm, white or light background',
'Canada': '50x70mm, white background'
};
return reqs[country] || '35x45mm, white background';
}
Step 6: Complete Example
AI Passport Photo Maker
# AI Passport Photo
United States
United Kingdom
EU / Schengen
Canada
Create Passport Photo
AiPass.initialize({
clientId: 'client_YOUR_CLIENT_ID',
requireLogin: true
});
async function generate() {
const file = document.getElementById('photo').files[0];
const country = document.getElementById('country').value;
const reqs = {
'US': '2x2 inches, white background',
'UK': '35x45mm, light grey background',
'EU': '35x45mm, white background',
'Canada': '50x70mm, white background'
};
const r = await AiPass.editImage({
model: 'gemini/gemini-3-pro-image-preview',
image: file,
prompt: `Make this a compliant ${country} passport photo. ${reqs[country]}. White background, centered face, proper lighting.`
});
document.getElementById('result').src = r.data[0].url;
}
Deploy Your App
Option A: Self-Host — Host the HTML file on your own server, GitHub Pages, Netlify, Vercel, or anywhere you want. The SDK handles all AI Pass authentication and billing. Your app, your domain, your rules.
Option B: Publish on AI Pass — Submit to the AI Pass catalog at aipass.one/apps. Get a dedicated page, discoverability, and use the embed feature (</> button) to iframe it into any website.