Skip to main content

Overview

The AI Video Presentation Generator requires three API keys to function:
  1. GEMINI_API_KEY - For AI content and script generation
  2. SARVAM_API_KEY - For multi-language voice synthesis
  3. UNSPLASH_ACCESS_KEY - For high-quality presentation images
This guide provides step-by-step instructions for obtaining each API key.

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
Used by: ContentGenerator (content_generator.py) and ScriptGenerator (script_generator.py)

How to Get Your Key

1

Visit Google AI Studio

Go to Google AI StudioSign in with your Google account.
2

Create API Key

Click “Get API Key” or “Create API Key”Select or create a Google Cloud project.
3

Copy Your Key

Copy the generated API key (format: AIza...)Store it securely - you won’t be able to see it again.
4

Add to .env File

Add to your backend/.env file:
GEMINI_API_KEY=AIzaSyC...

Model Configuration

The system uses the Gemini 2.5 Flash model by default, configured in config.py:29:
GEMINI_MODEL = "gemini-2.5-flash"
This model provides the best balance of speed and quality for content generation.

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
Perfect for development and small-scale usage.
Monitor your usage in Google Cloud Console to avoid unexpected charges if you exceed the free tier.

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
Used by: VoiceGenerator (voice_generator.py)

How to Get Your Key

1

Visit Sarvam AI

Go to Sarvam AI PlatformClick “Get Started” or “Sign Up”
2

Create Account

Sign up with your email or GitHub accountVerify your email address
3

Access Developer Dashboard

Navigate to the API Dashboard or Developer ConsoleFind the “API Keys” section
4

Generate API Key

Click “Create New API Key”Copy your API subscription key
5

Add to .env File

Add to your backend/.env file:
SARVAM_API_KEY=your_sarvam_key_here
SARVAM_TTS_URL=https://api.sarvam.ai/text-to-speech
SARVAM_MODEL=bulbul:v2

Available Models

Sarvam AI offers two TTS model versions:
SARVAM_MODEL=bulbul:v2
Recommendation: Use bulbul:v2 for production. The v3-beta model may have breaking changes.

Supported Speakers

The system maps languages to appropriate voice speakers:
LanguageSpeakerVoice Description
EnglishanushkaIndian English Female
HindimanishaHindi Female
KannadavidyaKannada Female
TeluguaryaTelugu Female
Configured in config.py:40-45. See Language Options for all supported languages.

API Request Format

The system sends requests with these parameters (from voice_generator.py:26-36):
{
  "inputs": ["narration text"],
  "target_language_code": "en-IN",
  "speaker": "anushka",
  "pitch": 0,
  "pace": 1.0,
  "loudness": 1.5,
  "speech_sample_rate": 22050,
  "enable_preprocessing": true,
  "model": "bulbul:v2"
}

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
Used by: ImageFetcher (image_fetcher.py)

How to Get Your Key

1

Visit Unsplash Developers

Go to Unsplash DevelopersSign in or create an Unsplash account
2

Create New Application

Click “Register as a Developer” (if first time)Then click “New Application”
3

Accept Terms

Read and accept the API Terms and GuidelinesAgree to follow Unsplash’s usage policies
4

Fill Application Details

Provide application information:
  • Application name: “AI Video Presentation Generator”
  • Description: Describe your use case
  • Accept terms of service
5

Copy Access Key

After creation, copy your Access KeyNote: There’s also a Secret Key - you only need the Access Key
6

Add to .env File

Add to your backend/.env file:
UNSPLASH_ACCESS_KEY=your_unsplash_access_key_here

Usage Guidelines

Important: When using Unsplash images, you must:
  • Credit photographers when required
  • Follow Unsplash’s API Guidelines
  • Respect rate limits (50 requests/hour for demo apps)

Rate Limits

PlanRequests per Hour
Demo50
Production5,000
For development, the Demo plan is sufficient. Apply for Production access for deployed applications.

Security Best Practices

Protecting Your API Keys

Critical: Never commit .env files to version control.Add to .gitignore:
.env
.env.local
.env.*.local
✅ Commit: .env.example (with placeholder values) ❌ Never commit: .env (with actual keys)
Always load keys from environment variables, never hardcode:❌ Bad:
api_key = "AIzaSyC_actual_key_here"
✅ Good:
api_key = os.getenv("GEMINI_API_KEY")
  • Gemini: Restrict to specific APIs in Google Cloud Console
  • Sarvam: Set usage limits if available
  • Unsplash: Regenerate keys if exposed
Review permissions regularly and use least-privilege principle.
Best practices:
  • Rotate keys every 90 days
  • Immediately rotate if exposed
  • Keep backup keys during rotation
  • Update all environments after rotation
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

If you accidentally commit API keys to a public repository:
  1. Immediately revoke the exposed keys
  2. Generate new keys from respective platforms
  3. Update your .env file with new keys
  4. Remove sensitive data from Git history using tools like BFG Repo-Cleaner
  5. Notify the API provider if required

Verification

Test Your Configuration

Verify all API keys are correctly configured:
cd backend
python -c "
from config import Config
print('Gemini API Key:', 'Configured ✓' if Config.GEMINI_API_KEY else 'Missing ✗')
print('Sarvam API Key:', 'Configured ✓' if Config.SARVAM_API_KEY else 'Missing ✗')
print('Unsplash Key:', 'Configured ✓' if Config.UNSPLASH_ACCESS_KEY else 'Missing ✗')
"
Expected output:
Gemini API Key: Configured ✓
Sarvam API Key: Configured ✓
Unsplash Key: Configured ✓

Test API Connectivity

Start the backend server and check the health endpoint:
cd backend
python app.py
In another terminal:
curl http://localhost:8000/health
Should return: {"status":"healthy"}

Troubleshooting

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
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
Problem: Config shows None for API keysSolutions:
  • Verify .env file is in the backend/ directory
  • Check file is named exactly .env (not .env.txt)
  • Ensure no spaces around = in .env file
  • Restart the backend server after changes
  • Check file encoding (should be UTF-8)
Problem: “Service unavailable” or timeout errorsSolutions:
  • Check your internet connection
  • Verify the API service status page
  • Check if your region is supported
  • Try again after a few minutes

Next Steps

Environment Setup

Configure the complete development environment

Language Options

Explore multi-language voice generation options

Build docs developers (and LLMs) love