Features
Postiz’s AI integration enables:- Post Generation - Generate social media posts from content
- Thread Creation - Convert long-form content into Twitter threads
- Image Generation - Create images with DALL-E 3
- Post Splitting - Automatically split long posts to fit platform limits
- Video Slides - Generate slide presentations from text
- Content Extraction - Extract article content from websites
- Voice Optimization - Convert posts to natural-sounding voice scripts
Configuration
Environment Variable
Add your OpenAI API key to.env:
If
OPENAI_API_KEY is not set, AI features will be disabled in the UI but Postiz will continue to function normally.Get OpenAI API Key
Create OpenAI Account
- Visit platform.openai.com
- Sign up or log in to your account
- Navigate to API keys section
Generate API Key
- Click “Create new secret key”
- Name it “Postiz Production”
- Copy the key (starts with
sk-proj-orsk-)
Add Billing Information
OpenAI requires billing information to use the API:
- Go to Settings → Billing
- Add a payment method
- Set usage limits to control costs
AI Features Implementation
Postiz uses the OpenAI service (openai.service.ts) for various AI-powered features.
Post Generation
Generate social media posts from content using GPT-4:Image Generation with DALL-E 3
Create images from text prompts:- Standard (1024x1024) or vertical (1024x1792) formats
- URL or base64 output
- Enhanced prompts for better results
Enhanced Image Prompts
AI optimizes your simple prompts into detailed DALL-E prompts:- Input: “sunset over mountains”
- Output: “A breathtaking sunset over snow-capped mountain peaks, golden hour lighting with warm orange and pink hues, dramatic clouds, shot with wide-angle lens, f/8 aperture, professional landscape photography…”
Post Splitting for Character Limits
Automatically split long posts to fit platform character limits:- X (Twitter): 280 characters (4000 for premium)
- LinkedIn: 3000 characters
- Facebook: 63,206 characters
Video Slide Generation
Create video presentation slides from text:Voice Text Optimization
Convert social posts to natural-sounding voice scripts:- Input: “Check out our new feature - it’s amazing!”
- Output: “Check out our new feature… it’s amazing!”
Website Content Extraction
Extract article content from websites and generate posts:Model Selection
Postiz uses GPT-4.1 for all text generation tasks:GPT-4.1 provides the best balance of quality and speed for social media content generation. Image generation uses DALL-E 3.
Structured Output with Zod
Postiz uses OpenAI’s structured output feature with Zod schemas:Cost Optimization
Pricing Considerations
- GPT-4: ~0.06 per 1K tokens (output)
- DALL-E 3: ~0.08 per HD image
- Average post generation: ~$0.01-0.05 per request
Best Practices
Set Usage Limits
Configure OpenAI usage limits in your account:
- Go to Settings → Limits
- Set monthly budget (e.g., $50/month)
- Enable email alerts at 75% and 100%
Error Handling
Postiz implements robust error handling with retries:Failed AI operations gracefully degrade - Postiz continues to function without AI features if OpenAI is unavailable.
Testing AI Integration
Test Post Generation
- Create a new post in Postiz
- Click the AI generation button
- Enter sample content
- Verify generated posts appear
Test Image Generation
- Navigate to media library
- Use AI image generation feature
- Enter a prompt
- Verify image is generated
Troubleshooting
AI features not appearing in UI
AI features not appearing in UI
If AI buttons are missing:
- Verify
OPENAI_API_KEYis set in.env - Ensure the key starts with
sk-orsk-proj- - Restart frontend and backend:
- Check browser console for errors
API key authentication failed
API key authentication failed
If you see authentication errors:
- Invalid Key: Verify the API key is correct and active
- Billing: Ensure billing is set up in OpenAI account
- Usage Limits: Check you haven’t exceeded monthly limits
- Revoked Key: Generate a new API key if the current one was revoked
Rate limit errors
Rate limit errors
OpenAI has rate limits:
- Tier 1: 200 requests/min, 40,000 tokens/min
- Tier 2: 500 requests/min, 80,000 tokens/min
- Tier 3+: Higher limits
- Implement request queuing
- Upgrade your OpenAI tier
- Cache results to reduce API calls
- Add retry logic with exponential backoff (already implemented)
High costs / unexpected usage
High costs / unexpected usage
To reduce costs:
- Set Hard Limits: Configure monthly budget in OpenAI dashboard
- Monitor Usage: Check usage daily for unexpected spikes
- Disable Features: Disable AI features for certain users/orgs
- Cache Aggressively: Cache generated content
- Use Cheaper Models: Consider GPT-3.5 for non-critical features (requires code changes)
Generation quality issues
Generation quality issues
If AI-generated content is poor quality:
- Better Prompts: Provide more context and examples
- Temperature: Already optimized at 1.0 for creative variety
- Model: Using GPT-4.1 (highest quality)
- Content Length: Provide sufficient input content
- Specificity: Be specific about desired output format
Advanced Configuration
Custom System Prompts
To customize AI behavior, modify the system prompts inopenai.service.ts:
Alternative Models
To use different models, update the model parameter:Temperature Control
Adjust creativity vs consistency:Security Best Practices
- Store API key in environment variables only
- Rotate keys periodically
- Set usage limits to prevent abuse
- Monitor for unusual activity
- Implement rate limiting for AI features
- Use separate keys for development and production
Disabling AI Features
To completely disable AI features:Next Steps
After configuring AI integration:- OAuth Apps - Set up social media platforms
- Email Setup - Configure email delivery
- Billing Configuration - Set up payments
- Short Links - Configure URL shortening