# Image Studio: Quick Integration Guide ## 🎉 Phase 1, Module 1 (Create Studio) - BACKEND COMPLETE! **Status**: Backend fully implemented and ready for use **What's Done**: ✅ Backend services, ✅ API endpoints, ✅ WaveSpeed provider, ✅ Templates **What's Next**: Frontend component integration --- ## 🚀 Quick Start (3 Steps) ### Step 1: Add Environment Variable Add to your `.env` file: ```bash WAVESPEED_API_KEY=your_wavespeed_api_key_here ``` ### Step 2: Register Router Add to `backend/app.py`: ```python from routers import image_studio app.include_router(image_studio.router) ``` ### Step 3: Test the API ```bash # Health check curl http://localhost:8000/api/image-studio/health # Get templates curl http://localhost:8000/api/image-studio/templates \ -H "Authorization: Bearer YOUR_TOKEN" # Generate image curl -X POST http://localhost:8000/api/image-studio/create \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "prompt": "Modern coffee shop interior", "template_id": "instagram_feed_square", "quality": "premium" }' ``` That's it! The backend is ready to use. --- ## 📦 What's Available Now ### ✅ Image Generation - **5 AI Providers**: Stability AI (Ultra/Core/SD3), WaveSpeed (Ideogram V3, Qwen), HuggingFace, Gemini - **27 Platform Templates**: Instagram, Facebook, Twitter, LinkedIn, YouTube, Pinterest, TikTok, Blog, Email, Website - **Smart Features**: Auto-provider selection, prompt enhancement, batch generation (1-10 variations) ### ✅ API Endpoints - `POST /api/image-studio/create` - Generate images - `GET /api/image-studio/templates` - Get templates - `GET /api/image-studio/templates/search` - Search templates - `GET /api/image-studio/templates/recommend` - Get recommendations - `GET /api/image-studio/providers` - Get provider info - `POST /api/image-studio/estimate-cost` - Estimate costs - `GET /api/image-studio/platform-specs/{platform}` - Get platform specs - `GET /api/image-studio/health` - Health check ### ✅ Templates by Platform **Instagram** (4 templates): - `instagram_feed_square` - 1080x1080 (1:1) - `instagram_feed_portrait` - 1080x1350 (4:5) - `instagram_story` - 1080x1920 (9:16) - `instagram_reel_cover` - 1080x1920 (9:16) **Facebook** (4 templates): - `facebook_feed` - 1200x630 (1.91:1) - `facebook_feed_square` - 1080x1080 (1:1) - `facebook_story` - 1080x1920 (9:16) - `facebook_cover` - 820x312 (16:9) **Twitter/X** (3 templates): - `twitter_post` - 1200x675 (16:9) - `twitter_card` - 1200x600 (2:1) - `twitter_header` - 1500x500 (3:1) **LinkedIn** (4 templates): - `linkedin_post` - 1200x628 (1.91:1) - `linkedin_post_square` - 1080x1080 (1:1) - `linkedin_article` - 1200x627 (2:1) - `linkedin_cover` - 1128x191 (4:1) ...and 12 more templates for YouTube, Pinterest, TikTok, Blog, Email, and Website! --- ## 💻 API Usage Examples ### Example 1: Simple Generation with Template **Request:** ```json POST /api/image-studio/create { "prompt": "Modern minimalist workspace with laptop", "template_id": "linkedin_post", "quality": "premium" } ``` **Response:** ```json { "success": true, "request": { "prompt": "Modern minimalist workspace with laptop", "enhanced_prompt": "Modern minimalist workspace with laptop, professional photography, high quality, detailed, sharp focus, natural lighting", "template_id": "linkedin_post", "template_name": "LinkedIn Post", "provider": "wavespeed", "model": "ideogram-v3-turbo", "dimensions": "1200x628", "quality": "premium" }, "results": [ { "image_base64": "iVBORw0KGgoAAAANS...", "width": 1200, "height": 628, "provider": "wavespeed", "model": "ideogram-v3-turbo", "variation": 1 } ], "total_generated": 1 } ``` ### Example 2: Multiple Variations **Request:** ```json POST /api/image-studio/create { "prompt": "Product photography of smartphone", "width": 1080, "height": 1080, "provider": "wavespeed", "model": "ideogram-v3-turbo", "num_variations": 4, "quality": "premium" } ``` **Result:** Generates 4 different variations of the same prompt. ### Example 3: Get Templates for Instagram **Request:** ```bash GET /api/image-studio/templates?platform=instagram ``` **Response:** ```json { "templates": [ { "id": "instagram_feed_square", "name": "Instagram Feed Post (Square)", "category": "social_media", "platform": "instagram", "aspect_ratio": { "ratio": "1:1", "width": 1080, "height": 1080, "label": "Square" }, "description": "Perfect for Instagram feed posts with maximum visibility", "recommended_provider": "ideogram", "style_preset": "photographic", "quality": "premium", "use_cases": ["Product showcase", "Lifestyle posts", "Brand content"] } // ... 3 more Instagram templates ], "total": 4 } ``` ### Example 4: Search Templates **Request:** ```bash GET /api/image-studio/templates/search?query=product ``` **Result:** Returns all templates with "product" in name, description, or use cases. ### Example 5: Cost Estimation **Request:** ```json POST /api/image-studio/estimate-cost { "provider": "wavespeed", "model": "ideogram-v3-turbo", "operation": "generate", "num_images": 10, "width": 1080, "height": 1080 } ``` **Response:** ```json { "provider": "wavespeed", "model": "ideogram-v3-turbo", "operation": "generate", "num_images": 10, "resolution": "1080x1080", "cost_per_image": 0.10, "total_cost": 1.00, "currency": "USD", "estimated": true } ``` --- ## 🎨 Frontend Integration (Next Step) ### What to Build Create a React component at: `frontend/src/components/ImageStudio/CreateStudio.tsx` ### Component Structure ```typescript import React, { useState } from 'react'; interface CreateStudioProps { // Your props } export const CreateStudio: React.FC = () => { const [prompt, setPrompt] = useState(''); const [templateId, setTemplateId] = useState(null); const [quality, setQuality] = useState<'draft' | 'standard' | 'premium'>('standard'); const [loading, setLoading] = useState(false); const [results, setResults] = useState([]); // Fetch templates on mount useEffect(() => { fetchTemplates(); }, []); const fetchTemplates = async () => { const response = await fetch('/api/image-studio/templates'); const data = await response.json(); setTemplates(data.templates); }; const generateImage = async () => { setLoading(true); try { const response = await fetch('/api/image-studio/create', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ prompt, template_id: templateId, quality, num_variations: 1 }) }); const data = await response.json(); setResults(data.results); } catch (error) { console.error('Generation failed:', error); } finally { setLoading(false); } }; return (

Create Studio

{/* Template Selector */} {/* Prompt Input */}