How to Build an AI Social Post Writer with AI Pass SDK
Build an AI Social Post Writer with AI Pass SDK
Build a social media content tool that generates platform-optimized posts. Earn 50% commission on every post your users generate.
Prerequisites
- AI Pass account (sign up)
- Client ID from Developer Dashboard → OAuth2 Clients
Step 1: SDK Setup
<!DOCTYPE html>
<html>
<head>
<title>AI Social Post Writer</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: Generate Posts
async function generatePost() {
const idea = document.getElementById('idea').value;
const platform = document.getElementById('platform').value;
const tone = document.getElementById('tone').value;
const platformRules = {
instagram: 'Instagram post with emojis, hashtags, and a CTA. Max 2200 chars.',
twitter: 'X/Twitter post. Max 280 characters. Punchy and engaging.',
linkedin: 'LinkedIn post. Professional tone, thought leadership. Include line breaks for readability.',
tiktok: 'TikTok caption. Short, trendy, Gen-Z friendly. Include relevant hashtags.',
facebook: 'Facebook post. Conversational, shareable, community-oriented.'
};
const result = await AiPass.generateCompletion({
model: 'gpt-5-mini',
temperature: 1,
max_tokens: 16000,
messages: [
{
role: 'system',
content: `You are a social media expert. Write a ${platformRules[platform]} Tone: ${tone}. Return ONLY the post text, ready to copy-paste.`
},
{
role: 'user',
content: `Write a social media post about: ${idea}`
}
]
});
document.getElementById('output').textContent = result.choices[0].message.content;
}
Always include temperature: 1 and max_tokens: 16000 for GPT-5 models.
Step 3: Multi-Platform Generation
async function generateAll() {
const idea = document.getElementById('idea').value;
const platforms = ['instagram', 'twitter', 'linkedin', 'tiktok'];
for (const platform of platforms) {
await generatePost(idea, platform);
// Display each result in its own card
}
}
Step 4: Deploy
Option A: Self-host on any platform. SDK handles auth and billing.
Option B: Publish on AI Pass catalog with embed support via </> button.
Revenue
50% commission on every API call. Social media tools get daily usage — great for recurring revenue.