AI
Pass

How to Build an AI Horoscope Generator with AI Pass SDK

How to Build an AI Horoscope Generator with AI Pass SDK

Create a personalized horoscope generator. Users pay directly for readings — you earn 50% commission.

What You'll Build

A horoscope generator that:

  • Lets users select their zodiac sign
  • Generates personalized daily readings
  • Covers love, career, health, and more
  • Includes lucky numbers and colors

Step 1: Create Account & OAuth2 Client

  1. Sign up
  2. Get OAuth2 Client ID from Developer Dashboard
  3. Use YOUR_CLIENT_ID placeholder in code

Step 2: Build the App

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>AI Horoscope Generator</title>
    <link href="https://aipass.one/aipass-ui.css" rel="stylesheet">
    <style>
        body { font-family: sans-serif; max-width: 800px; margin: 0 auto; padding: 20px; }
        select, button { padding: 12px; margin: 5px; font-size: 16px; }
        .result { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; padding: 30px; border-radius: 15px; margin-top: 20px; }
        .result h2 { margin-top: 0; }
        .section { background: rgba(255,255,255,0.1); padding: 15px; border-radius: 10px; margin: 10px 0; }
    </style>
</head>
<body>
    <h1>AI Horoscope Generator</h1>
    <p>Discover what the stars have in store for you today</p>
    <select id="sign">
        <option value="">Select your sign...</option>
        <option value="Aries">Aries (Mar 21 - Apr 19)</option>
        <option value="Taurus">Taurus (Apr 20 - May 20)</option>
        <option value="Gemini">Gemini (May 21 - Jun 20)</option>
        <option value="Cancer">Cancer (Jun 21 - Jul 22)</option>
        <option value="Leo">Leo (Jul 23 - Aug 22)</option>
        <option value="Virgo">Virgo (Aug 23 - Sep 22)</option>
        <option value="Libra">Libra (Sep 23 - Oct 22)</option>
        <option value="Scorpio">Scorpio (Oct 23 - Nov 21)</option>
        <option value="Sagittarius">Sagittarius (Nov 22 - Dec 21)</option>
        <option value="Capricorn">Capricorn (Dec 22 - Jan 19)</option>
        <option value="Aquarius">Aquarius (Jan 20 - Feb 18)</option>
        <option value="Pisces">Pisces (Feb 19 - Mar 20)</option>
    </select>
    <button onclick="generate()">Get Horoscope</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 generate() {
            const sign = document.getElementById('sign').value;
            const result = document.getElementById('result');
            
            if (!sign) { alert('Please select your sign'); return; }
            result.innerHTML = '<p>Reading the stars...</p>';
            
            try {
                const response = await AiPass.generateCompletion({
                    model: 'gpt-5-mini',
                    temperature: 1,
                    max_tokens: 16000,
                    messages: [{
                        role: 'system',
                        content: 'You are an astrologer. Create a personalized daily horoscope with sections for Daily Forecast, Love & Relationships, Career & Work, Health & Wellness, Lucky Numbers (3 numbers), and Color of the Day. Be inspiring and mystical but practical.'
                    }, {
                        role: 'user',
                        content: `Create today's horoscope for ${sign}. Include all sections with specific, personalized advice.`
                    }]
                });
                
                const text = response.choices[0].message.content;
                
                // Format the horoscope
                const sections = text.split(/\\n(?=[A-Z])/).filter(s => s.trim());
                const formatted = sections.map(s => {
                    const title = s.split(':')[0];
                    const content = s.substring(title.length).replace(/^:/, '').trim();
                    return `<div class="section"><strong>${title}:</strong><br>${content.replace(/\\n/g, '<br>')}</div>`;
                }).join('');
                
                result.innerHTML = `
                    <div class="result">
                        <h2>Today's Horoscope for ${sign}</h2>
                        ${formatted}
                    </div>
                `;
            } catch (e) {
                result.innerHTML = `<p style="color:red">Error: ${e.message}</p>`;
            }
        }
    </script>
</body>
</html>

Step 3: Deploy & Earn

Host anywhere or publish on AI Pass. Earn 50% commission on every reading.

Get Your Client ID and start building!