Build an AI YouTube SEO Optimizer with AI Pass SDK — Complete Tutorial
Build an AI YouTube SEO Optimizer with AI Pass SDK — Complete Tutorial
Content creators need tools, and SEO tools have high repeat usage. Build this once, and creators come back every time they upload.
What You'll Build
Users enter their video topic and get back optimized titles, a full description, and tags — ready to copy into YouTube Studio.
Step 1: Get Your Client ID
- Sign up at aipass.one and verify your email
- Go to Developer Dashboard → OAuth2 Clients
- Create a client → copy Client ID
Step 2: The App
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>YouTube SEO Optimizer</title>
<link href="https://aipass.one/aipass-ui.css" rel="stylesheet">
<style>
body { font-family: sans-serif; background: #0f0f0f; color: #f0f0f0; max-width: 800px; margin: 0 auto; padding: 40px 20px; }
h1 { font-size: 1.8rem; margin-bottom: 8px; }
.subtitle { color: #888; margin-bottom: 28px; }
.form-group { margin-bottom: 16px; }
label { display: block; margin-bottom: 6px; color: #aaa; font-size: 0.9rem; }
textarea, input, select { width: 100%; padding: 12px; background: #1a1a1a; border: 1px solid #333; border-radius: 8px; color: #f0f0f0; font-size: 0.95rem; box-sizing: border-box; }
textarea { min-height: 80px; resize: vertical; }
.btn { width: 100%; padding: 15px; background: #ff0000; border: none; border-radius: 10px; color: white; font-size: 1.05rem; font-weight: 600; cursor: pointer; margin-top: 4px; }
.btn:disabled { background: #333; cursor: not-allowed; }
.results { display: none; margin-top: 28px; }
.card { background: #1a1a1a; border: 1px solid #2a2a2a; border-radius: 10px; padding: 20px; margin-bottom: 14px; }
.card-title { color: #ff0000; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 10px; }
.card-content { white-space: pre-wrap; line-height: 1.6; color: #e0e0e0; }
.copy-btn { margin-top: 10px; padding: 7px 14px; background: #2a2a2a; border: 1px solid #444; border-radius: 6px; color: #ccc; cursor: pointer; font-size: 0.85rem; }
.loading { display: none; text-align: center; padding: 30px; color: #888; }
</style>
</head>
<body>
<h1>🎬 YouTube SEO Optimizer</h1>
<p class="subtitle">AI-powered titles, descriptions & tags that get views</p>
<div class="form-group">
<label>Video Topic *</label>
<textarea id="topic" placeholder="Describe your video... e.g. 'Tutorial on sourdough bread for beginners, covering starter, fermentation, and baking'"></textarea>
</div>
<div class="form-group">
<label>Target Keyword (optional)</label>
<input type="text" id="keyword" placeholder="e.g. sourdough bread recipe">
</div>
<div class="form-group">
<label>Channel Niche</label>
<select id="niche">
<option>General</option><option>Cooking & Food</option><option>Tech & Software</option>
<option>Finance & Business</option><option>Fitness & Health</option><option>Education</option>
<option>Gaming</option><option>Travel & Lifestyle</option><option>DIY & Crafts</option>
</select>
</div>
<button class="btn" id="btn" onclick="optimize()">🚀 Optimize for YouTube</button>
<div class="loading" id="loading">Crafting your SEO package...</div>
<div class="results" id="results">
<div class="card">
<div class="card-title">📌 Optimized Titles (5 options)</div>
<div class="card-content" id="titlesOut"></div>
<button class="copy-btn" onclick="copy('titlesOut')">📋 Copy</button>
</div>
<div class="card">
<div class="card-title">📝 SEO Description</div>
<div class="card-content" id="descOut"></div>
<button class="copy-btn" onclick="copy('descOut')">📋 Copy</button>
</div>
<div class="card">
<div class="card-title">🏷️ Tags</div>
<div class="card-content" id="tagsOut"></div>
<button class="copy-btn" onclick="copy('tagsOut')">📋 Copy</button>
</div>
</div>
<script src="https://aipass.one/aipass-sdk.js"></script>
<script>
AiPass.initialize({
clientId: 'YOUR_CLIENT_ID',
requireLogin: true,
darkMode: true
});
async function optimize() {
const topic = document.getElementById('topic').value.trim();
if (!topic) return alert('Please describe your video topic.');
const keyword = document.getElementById('keyword').value.trim();
const niche = document.getElementById('niche').value;
document.getElementById('btn').disabled = true;
document.getElementById('loading').style.display = 'block';
document.getElementById('results').style.display = 'none';
const prompt = `YouTube SEO expert. Create full SEO package.
VIDEO TOPIC: ${topic}
${keyword ? 'TARGET KEYWORD: ' + keyword : ''}
NICHE: ${niche}
Format EXACTLY:
TITLES:
1. [title with keyword]
2. [emotional hook angle]
3. [how-to format]
4. [curiosity/question]
5. [power word + keyword]
DESCRIPTION:
[300-500 word description. First 2 sentences: compelling + keyword-rich. Natural keyword placement throughout. Timestamp placeholders. Hashtags at end.]
TAGS:
[25-30 comma-separated: exact-match, broad, long-tail, related terms]`;
try {
const r = await AiPass.generateCompletion({
model: 'gpt-5-mini',
temperature: 1,
max_tokens: 16000,
messages: [
{ role: 'system', content: 'Expert YouTube SEO specialist.' },
{ role: 'user', content: prompt }
]
});
const text = r.choices[0].message.content;
const t = text.match(/TITLES:([\s\S]*?)(?=DESCRIPTION:|$)/i);
const d = text.match(/DESCRIPTION:([\s\S]*?)(?=TAGS:|$)/i);
const g = text.match(/TAGS:([\s\S]*?)$/i);
document.getElementById('titlesOut').textContent = t?.[1]?.trim() || text;
document.getElementById('descOut').textContent = d?.[1]?.trim() || '';
document.getElementById('tagsOut').textContent = g?.[1]?.trim() || '';
document.getElementById('results').style.display = 'block';
} catch(e) { console.error(e); alert('Error — please try again.'); }
finally { document.getElementById('loading').style.display = 'none'; document.getElementById('btn').disabled = false; }
}
function copy(id) {
navigator.clipboard.writeText(document.getElementById(id).textContent)
.then(() => alert('Copied!'));
}
</script>
</body>
</html>
The Core Pattern
// Always include temperature:1 and max_tokens:16000 for GPT-5 models
const r = await AiPass.generateCompletion({
model: 'gpt-5-mini',
temperature: 1, // Required — GPT-5 rejects SDK default of 0.7
max_tokens: 16000, // Required — prevents empty responses
messages: [...]
});
const text = r.choices[0].message.content;
Deploy Anywhere
# Netlify
netlify deploy --dir . --prod
# Vercel
vercel --prod
# GitHub Pages — push to repo, enable in Settings
Earn Commission
Every optimization earns you 50% commission via your Client ID. Content creators are repeat users — they upload weekly. Build once, earn passively.
Live demo: aipass.one/apps/youtube-seo Developer Dashboard: aipass.one/panel/developer.html