How to Build an AI Quiz Maker with AI Pass SDK
Build an AI Quiz Maker with AI Pass SDK
Build an interactive quiz generator where users paste text or type a topic and get multiple-choice quizzes. Earn 50% commission on every quiz generated.
Prerequisites
- AI Pass account (sign up)
- Client ID from Developer Dashboard → OAuth2 Clients
Step 1: SDK Setup
<!DOCTYPE html>
<html>
<head>
<title>AI Quiz Maker</title>
<link href="https://aipass.one/aipass-ui.css" rel="stylesheet">
</head>
<body>
<script src="https://aipass.one/aipass-sdk.js"></script>
<script>
AiPass.initialize({
clientId: 'YOUR_CLIENT_ID',
requireLogin: true,
darkMode: true
});
</script>
</body>
</html>
Step 2: Quiz Generation
async function makeQuiz() {
const input = document.getElementById('textInput').value;
const count = document.getElementById('questionCount').value || 5;
const result = await AiPass.generateCompletion({
model: 'gpt-5-mini',
temperature: 1,
max_tokens: 16000,
messages: [
{
role: 'system',
content: `Generate a ${count}-question multiple-choice quiz. Return JSON array: [{"question":"...","options":["A","B","C","D"],"correct":0,"explanation":"..."}]. Index 0-3 for correct answer. Return ONLY valid JSON.`
},
{
role: 'user',
content: `Create a quiz from this content:\n\n${input}`
}
]
});
const quiz = JSON.parse(result.choices[0].message.content);
renderQuiz(quiz);
}
Always include temperature: 1 and max_tokens: 16000 for GPT-5 models.
Step 3: Interactive Quiz UI
function renderQuiz(questions) {
let html = '<div class="quiz">';
questions.forEach((q, i) => {
html += `<div class="question"><h3>Q${i+1}: ${q.question}</h3>`;
q.options.forEach((opt, j) => {
html += `<label><input type="radio" name="q${i}" value="${j}"> ${opt}</label><br>`;
});
html += '</div>';
});
html += '<button onclick="scoreQuiz()">Check Answers</button></div>';
document.getElementById('quizArea').innerHTML = html;
window._quizData = questions;
}
function scoreQuiz() {
let score = 0;
window._quizData.forEach((q, i) => {
const selected = document.querySelector(`input[name="q${i}"]:checked`);
if (selected && parseInt(selected.value) === q.correct) score++;
});
alert(`Score: ${score}/${window._quizData.length}`);
}
Step 4: Deploy
Option A: Self-host anywhere. The SDK handles auth and billing.
Option B: Publish on AI Pass catalog with built-in embed via </> button.
Revenue
50% commission on every API call. Quiz tools have great retention — teachers use them weekly.