Build an AI Story Generator with AI Pass SDK
Build an AI Story Generator with AI Pass SDK
Want to add story generation to your website? AI Pass SDK lets you generate creative text with a few lines of JavaScript — no backend, no API keys for your users.
Your users pay for their own usage, and you earn 50% commission on every API call.
What You'll Build
A story generator where users describe their idea and get a complete narrative. Users sign in, use the tool, pay as they go. You earn commission.
Prerequisites
- Create an AI Pass account at aipass.one
- Verify your email (required for commission payouts)
- Create an OAuth2 Client from Developer Dashboard → OAuth2 Clients
- Copy your Client ID — looks like
client_XXXX(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 generateStory(prompt) {
const r = await AiPass.generateCompletion({
model: 'gpt-5-mini',
messages: [
{
role: 'system',
content: 'You are a creative story writer. Write an engaging, well-structured narrative based on the user\'s prompt. Include vivid descriptions, dialogue, and a satisfying arc. Match the requested genre and tone.'
},
{ role: 'user', content: prompt }
]
});
return r.choices[0].message.content;
}
</script>
Key Points
clientIdcomes from Developer Dashboard → OAuth2 Clients (NOT the app slug)requireLogin: trueshows the auth screen automaticallygenerateCompletion()returnsr.choices[0].message.content- Users get $1 free credit on signup, then pay as they go
Deploy Your App
Option A: Self-Host — Host anywhere. SDK handles auth and billing.
Option B: Publish on AI Pass — Get a shareable page with a </> embed button for iframe embedding.
Revenue Model
- 50% commission on every API call — tracked via your OAuth2 Client ID
- Valid verified email required for payouts
Try the Live App
Related: Story Generator Guide | Story Generator API Skill