Configuration
Configure DreamOS with API keys to unlock all features. This guide covers getting keys for Google Gemini AI, Wolfram Alpha, and YouTube Data API.
Overview
DreamOS requires three API keys for full functionality:
Google Gemini AI
Luna AI chat, topic extraction
⚠️ Recommended
60 requests/minute
Wolfram Alpha
Knowledge validation, homework help
Optional
2,000 queries/month
YouTube Data API
Playlist import, video metadata
Optional
10,000 units/day
Quick Setup
1. Create .env File
.env FileIn your DreamOS project root:
# Copy example file
cp .env.example .env2. Add Your Keys
Open .env in a text editor and add:
# Google Gemini AI
VITE_GEMINI_API_KEY=AIzaSyXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
# Wolfram Alpha
VITE_WOLFRAM_APP_ID=XXXXXX-XXXXXXXXXX
# YouTube Data API v3
VITE_YOUTUBE_API_KEY=AIzaSyXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
VITE_YOUTUBE_CLIENT_ID=XXXXXXXXXXXX-XXXXXXXXXXXXXXXXXXXXXXXX.apps.googleusercontent.com3. Restart Development Server
# Press Ctrl+C to stop
npm run devThat's it! DreamOS will now use your API keys.
Detailed API Setup
Google Gemini AI (Luna AI + Topic Extraction)
What you get:
Conversational Luna AI assistant
Automatic topic extraction from YouTube videos
Study plan generation
Quiz generation
Step 1: Get API Key
Go to Google AI Studio
Click "Get API Key"
Click "Create API Key"
Copy the key (starts with
AIzaSy...)
Free Tier: 60 requests per minute, no credit card required!
Step 2: Add to .env
.envVITE_GEMINI_API_KEY=AIzaSyXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXStep 3: Test
Go to Luna AI page
Type: "Hello Luna!"
You should get a response ✅
Not working? Check:
Key is copied correctly (no spaces)
Dev server was restarted
Check browser console for errors
Wolfram Alpha (Knowledge Validation)
What you get:
Validate manually added topics
Homework helper with step-by-step solutions
Scientific/mathematical computations
Step 1: Create Account
Click "Get an AppID"
Sign up (free account)
Verify your email
Step 2: Create App
Go to "My Apps"
Click "Get an AppID"
Fill in:
Application name: DreamOS
Application description: Personal learning assistant
Click "Get AppID"
Copy the AppID (looks like
XXXXXX-XXXXXXXXXX)
Free Tier: 2,000 queries per month (about 65 per day)
Step 3: Add to .env
.envVITE_WOLFRAM_APP_ID=XXXXXX-XXXXXXXXXXStep 4: Test
Go to Birdseye View
Click "Add Topic Manually"
Enter: "Quantum Computing"
Should show "✓ Validated by Wolfram" ✅
YouTube Data API v3 (Playlist Import)
What you get:
Import Watch Later playlist
Import custom playlists
Video thumbnails and metadata
Automatic topic extraction from videos
Step 1: Create Google Cloud Project
Go to Google Cloud Console
Click "Create Project"
Name: DreamOS (or anything)
Click "Create"
Step 2: Enable YouTube Data API
In your project, go to "APIs & Services" → "Library"
Search: "YouTube Data API v3"
Click on it → Click "Enable"
Step 3: Create API Key
Go to "APIs & Services" → "Credentials"
Click "Create Credentials" → "API Key"
Copy the key (starts with
AIzaSy...)Optional: Click "Restrict Key" → Select "YouTube Data API v3"
Step 4: Create OAuth Client ID
Still in "Credentials", click "Create Credentials" → "OAuth client ID"
If prompted, configure OAuth consent screen:
User Type: External
App name: DreamOS
User support email: Your email
Developer contact: Your email
Save and Continue (skip scopes)
Back to "Credentials", create OAuth client:
Application type: Web application
Name: DreamOS Web
Authorized JavaScript origins:
http://localhost:5173Authorized redirect URIs:
http://localhost:5173
Click "Create"
Copy Client ID (ends with
.apps.googleusercontent.com)
Production: For deployed apps, add your production URL to authorized origins!
Step 5: Add to .env
.envVITE_YOUTUBE_API_KEY=AIzaSyXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
VITE_YOUTUBE_CLIENT_ID=XXXXXXXXXXXX-XXXXXXXXXXXXXXXXXXXXXXXX.apps.googleusercontent.comStep 6: Test
Go to SavedContent page
Click "Import from YouTube"
Sign in with Google
Grant permissions
Videos should import with thumbnails ✅
Free Tier: 10,000 quota units per day (enough for ~200 video imports)
Environment Variables Reference
Complete .env File
.env File# ═══════════════════════════════════════════════════════════
# DREAMOS CONFIGURATION
# ═══════════════════════════════════════════════════════════
# ─────────────────────────────────────────────────────────
# Google Gemini AI (Required for Luna AI)
# ─────────────────────────────────────────────────────────
# Get key: https://makersuite.google.com/app/apikey
VITE_GEMINI_API_KEY=your_gemini_api_key_here
# ─────────────────────────────────────────────────────────
# Wolfram Alpha (Optional - for homework help)
# ─────────────────────────────────────────────────────────
# Get AppID: https://developer.wolframalpha.com/
VITE_WOLFRAM_APP_ID=your_wolfram_app_id_here
# ─────────────────────────────────────────────────────────
# YouTube Data API v3 (Optional - for playlist import)
# ─────────────────────────────────────────────────────────
# Setup: https://console.cloud.google.com/
VITE_YOUTUBE_API_KEY=your_youtube_api_key_here
VITE_YOUTUBE_CLIENT_ID=your_youtube_client_id_here.apps.googleusercontent.com
# ─────────────────────────────────────────────────────────
# Firebase (Optional - for cloud sync)
# ─────────────────────────────────────────────────────────
VITE_FIREBASE_API_KEY=your_firebase_api_key
VITE_FIREBASE_AUTH_DOMAIN=your-project.firebaseapp.com
VITE_FIREBASE_PROJECT_ID=your-project-id
VITE_FIREBASE_STORAGE_BUCKET=your-project.appspot.com
VITE_FIREBASE_MESSAGING_SENDER_ID=123456789
VITE_FIREBASE_APP_ID=1:123456789:web:abcdef
# ─────────────────────────────────────────────────────────
# Application Settings (Optional)
# ─────────────────────────────────────────────────────────
VITE_APP_NAME=DreamOS
VITE_APP_VERSION=1.0.0
VITE_ENV=developmentVariable Descriptions
VITE_GEMINI_API_KEY
Google Gemini AI for chat and analysis
None (demo mode)
VITE_WOLFRAM_APP_ID
Wolfram Alpha for computations
None (disabled)
VITE_YOUTUBE_API_KEY
YouTube API for video metadata
None (disabled)
VITE_YOUTUBE_CLIENT_ID
OAuth for YouTube sign-in
None (disabled)
VITE_APP_NAME
Application display name
"DreamOS"
VITE_ENV
Environment mode
"development"
Security Best Practices
⚠️ Never Commit .env to Git
.env to GitThe .gitignore already excludes .env, but verify:
cat .gitignore | grep .env
# Should show: .env🔒 Restrict API Keys
For Gemini AI:
Set HTTP referrer restrictions in Google AI Studio
Limit to your domain only
For YouTube API:
Restrict to YouTube Data API v3 only
Set application restrictions (HTTP referrers)
For Wolfram Alpha:
No restrictions needed (has built-in rate limiting)
🌐 Production Deployment
When deploying to Vercel/Netlify/etc:
Don't include
.envin repositoryDo add environment variables in platform dashboard
Update OAuth redirect URIs to production domain
Enable HTTPS only
Example: Vercel
vercel env add VITE_GEMINI_API_KEY
# Paste your key when promptedTesting Your Configuration
Verify All APIs
Run this test script:
# Create test file
touch test-apis.js// test-apis.js
console.log('🔍 Checking API Configuration...\n');
const checks = {
'Gemini AI': import.meta.env.VITE_GEMINI_API_KEY,
'Wolfram Alpha': import.meta.env.VITE_WOLFRAM_APP_ID,
'YouTube API': import.meta.env.VITE_YOUTUBE_API_KEY,
'YouTube OAuth': import.meta.env.VITE_YOUTUBE_CLIENT_ID,
};
Object.entries(checks).forEach(([name, value]) => {
const status = value ? '✅ Configured' : '❌ Missing';
console.log(`${status} - ${name}`);
});
console.log('\n✨ Configuration check complete!');node test-apis.jsTroubleshooting
Issue: API key not recognized
Symptoms: Features not working, errors in console
Solutions:
Restart dev server after adding keys
Check for typos or extra spaces in
.envVerify variable names start with
VITE_Check file is named exactly
.env(not.env.txt)
Issue: YouTube OAuth not working
Symptoms: Sign-in popup fails, redirect errors
Solutions:
Verify OAuth consent screen is configured
Add
http://localhost:5173to authorized originsCheck client ID is correct (ends with
.apps.googleusercontent.com)Enable YouTube Data API v3 in Cloud Console
Issue: Gemini API quota exceeded
Symptoms: "429 Too Many Requests" errors
Solutions:
Free tier: Wait 1 minute (60 requests/minute limit)
Implement request batching in code
Consider upgrading to paid tier for higher limits
Issue: Wolfram Alpha timeout
Symptoms: Queries take >30 seconds or fail
Solutions:
Check AppID is correct
Verify you haven't exceeded 2,000 queries/month
Try simpler queries (complex computations take longer)
Next Steps
✅ APIs configured! Now learn the basics:
https://github.com/Ananya1464/DreamOS/blob/main/docs/getting-started/first-steps.mdOr dive into specific features:
https://github.com/Ananya1464/DreamOS/blob/main/docs/features/luna-ai.mdhttps://github.com/Ananya1464/DreamOS/blob/main/docs/features/youtube.mdLast updated