AI
Pass

Build an AI Photo Restoration Tool with AI Pass SDK

Build an AI Photo Restoration Tool with AI Pass SDK

Want to add photo restoration to your website? With AI Pass SDK, you can edit images with a few lines of JavaScript — no backend, no API key management, no billing headaches.

Your users pay for their own usage, and you earn 50% commission on every API call they make.

What You'll Build

A photo restoration tool where users upload damaged photos and get restored versions. Users sign in, use the tool, and pay as they go. You earn commission automatically.

Prerequisites

  1. Create an AI Pass account at aipass.one
  2. Verify your email (required for commission payouts)
  3. Create an OAuth2 Client from Developer Dashboard → OAuth2 Clients
  4. Copy your Client ID — it looks like client_XXXX (this is NOT your app slug!)

Core Code

<script src="https://aipass.one/aipass-sdk.js"></script>
<script>
AiPass.initialize({
  clientId: 'YOUR_CLIENT_ID', // from Developer Dashboard → OAuth2 Clients
  requireLogin: true,
  darkMode: true
});

async function restorePhoto(prompt, imageFile) {
  const reader = new FileReader();
  reader.readAsDataURL(imageFile);
  
  return new Promise((resolve) => {
    reader.onload = async () => {
      const base64 = reader.result;
      const r = await AiPass.editImage({
        model: 'gemini/gemini-3-pro-image-preview',
        prompt: prompt,
        image: base64
      });
      resolve(r.data[0].url);
    };
  });
}
</script>

Key Points

  • clientId comes from Developer Dashboard → OAuth2 Clients (NOT the app slug)
  • requireLogin: true shows the auth screen automatically — no custom login UI needed
  • editImage() returns r.data[0].url — the URL of the restored image
  • Users get $1 free credit on signup, then pay as they go

Deploy Your App

Option A: Self-Host — Put the HTML on your own server, GitHub Pages, Netlify, Vercel — anywhere. The SDK handles all auth and billing.

Option B: Publish on AI Pass — Upload to the AI Pass catalog and get a shareable page with a built-in </> embed button for iframe embedding.

Revenue Model

  • AI Pass charges a commission on each API call
  • You get 50% of that commission — automatically tracked via your OAuth2 Client ID
  • The more users your tool gets, the more you earn
  • Need a valid verified email for payouts

Try the Live App

See this in action: AI Photo Restoration

Related: Photo Restoration Guide | Photo Restoration API Skill