Overview
The AI Video Presentation Generator requires three API keys to function:- GEMINI_API_KEY - For AI content and script generation
- SARVAM_API_KEY - For multi-language voice synthesis
- UNSPLASH_ACCESS_KEY - For high-quality presentation images
Gemini API Key
What It’s Used For
The Gemini API key powers the core AI features:- Content Generation: Creates structured presentation content based on your topic
- Script Generation: Generates natural narration scripts for each slide
- Smart Visuals: Determines which slides need animations or images
ContentGenerator (content_generator.py) and ScriptGenerator (script_generator.py)
How to Get Your Key
Visit Google AI Studio
Go to Google AI StudioSign in with your Google account.
Copy Your Key
Copy the generated API key (format:
AIza...)Store it securely - you won’t be able to see it again.Model Configuration
The system uses the Gemini 2.5 Flash model by default, configured inconfig.py:29:
Pricing & Limits
Gemini API offers a free tier with generous limits:
- 15 requests per minute
- 1 million tokens per minute
- 1,500 requests per day
Sarvam API Key
What It’s Used For
The Sarvam AI API key enables multi-language voice generation:- Text-to-Speech: Converts narration scripts to natural-sounding audio
- Multi-Language Support: Supports 11+ Indian languages
- Voice Customization: Different speakers and voice characteristics
VoiceGenerator (voice_generator.py)
How to Get Your Key
Visit Sarvam AI
Go to Sarvam AI PlatformClick “Get Started” or “Sign Up”
Access Developer Dashboard
Navigate to the API Dashboard or Developer ConsoleFind the “API Keys” section
Available Models
Sarvam AI offers two TTS model versions:bulbul:v2 for production. The v3-beta model may have breaking changes.
Supported Speakers
The system maps languages to appropriate voice speakers:| Language | Speaker | Voice Description |
|---|---|---|
| English | anushka | Indian English Female |
| Hindi | manisha | Hindi Female |
| Kannada | vidya | Kannada Female |
| Telugu | arya | Telugu Female |
config.py:40-45. See Language Options for all supported languages.
API Request Format
The system sends requests with these parameters (fromvoice_generator.py:26-36):
Pricing & Limits
Check Sarvam AI Pricing for current rates and limits.Most plans include a free tier for testing and development.
Unsplash Access Key
What It’s Used For
The Unsplash API key provides access to high-quality images:- Image Fetching: Downloads relevant images based on slide content
- Visual Enhancement: Adds professional photography to presentations
- Smart Selection: AI-determined image keywords for relevance
ImageFetcher (image_fetcher.py)
How to Get Your Key
Visit Unsplash Developers
Go to Unsplash DevelopersSign in or create an Unsplash account
Fill Application Details
Provide application information:
- Application name: “AI Video Presentation Generator”
- Description: Describe your use case
- Accept terms of service
Copy Access Key
After creation, copy your Access KeyNote: There’s also a Secret Key - you only need the Access Key
Usage Guidelines
Rate Limits
| Plan | Requests per Hour |
|---|---|
| Demo | 50 |
| Production | 5,000 |
Security Best Practices
Protecting Your API Keys
Never Commit .env Files
Never Commit .env Files
Critical: Never commit ✅ Commit:
.env files to version control.Add to .gitignore:.env.example (with placeholder values)
❌ Never commit: .env (with actual keys)Use Environment Variables
Use Environment Variables
Always load keys from environment variables, never hardcode:❌ Bad:✅ Good:
Restrict API Key Permissions
Restrict API Key Permissions
- Gemini: Restrict to specific APIs in Google Cloud Console
- Sarvam: Set usage limits if available
- Unsplash: Regenerate keys if exposed
Rotate Keys Regularly
Rotate Keys Regularly
Best practices:
- Rotate keys every 90 days
- Immediately rotate if exposed
- Keep backup keys during rotation
- Update all environments after rotation
Monitor Usage
Monitor Usage
Regularly check API usage dashboards:
- Detect unusual activity
- Track costs and limits
- Identify optimization opportunities
- Set up alerts for threshold breaches
What to Do If Keys Are Exposed
Verification
Test Your Configuration
Verify all API keys are correctly configured:Test API Connectivity
Start the backend server and check the health endpoint:{"status":"healthy"}
Troubleshooting
Invalid API Key Error
Invalid API Key Error
Problem: “Invalid API key” or “Unauthorized” errorsSolutions:
- Verify the key is copied correctly (no extra spaces)
- Check the key hasn’t expired or been revoked
- Ensure the key has proper permissions enabled
- Try regenerating the key
Rate Limit Exceeded
Rate Limit Exceeded
Problem: “Rate limit exceeded” or “429 Too Many Requests”Solutions:
- Wait for the rate limit window to reset
- Reduce the frequency of requests
- Upgrade to a higher-tier plan
- Implement request caching
Environment Variables Not Loading
Environment Variables Not Loading
Problem: Config shows
None for API keysSolutions:- Verify
.envfile is in thebackend/directory - Check file is named exactly
.env(not.env.txt) - Ensure no spaces around
=in.envfile - Restart the backend server after changes
- Check file encoding (should be UTF-8)
API Service Unavailable
API Service Unavailable
Next Steps
Environment Setup
Configure the complete development environment
Language Options
Explore multi-language voice generation options