Environment Configuration
Mega Brain uses a.env file to store API keys and configuration. This file is automatically generated during setup and should never be committed to version control.
API Keys Overview
Mega Brain integrates with multiple services for different capabilities:Required
OpenAIEssential for video/audio transcription
Recommended
Voyage AIEnables high-quality semantic search
Optional
Everything elseAdvanced features and integrations
Required API Keys
OpenAI API Key
Required for: Video/audio transcription via Whisper APIUsed by:
/ingest command when processing YouTube videos, podcasts, or audio files1
Get your API key
- Go to OpenAI Platform
- Sign in or create an account
- Click “Create new secret key”
- Copy the key (starts with
sk-)
2
Add to .env file
Open your
.env file and add:3
Verify the key
Test your configuration:You should see:
- $0.006 per minute of audio
- A 1-hour video costs ~$0.36 to transcribe
- Video/audio ingestion will fail
- PDF and text ingestion still works
- You can manually place transcripts in
inbox/
Recommended API Keys
Voyage AI API Key
Required for: High-quality semantic embeddings for RAG (Retrieval Augmented Generation)Used by: Knowledge search, similarity matching, and agent context retrieval
1
Get your API key
- Go to Voyage AI Dashboard
- Sign up for an account
- Navigate to API Keys section
- Create a new API key
2
Add to .env file
3
Configure embedding model (optional)
Voyage AI offers different embedding models. The default is
voyage-3-lite.To use a different model, you can configure it in your processing scripts.- 100M tokens/month free
- ~$0.02 per 1M tokens after that
- System falls back to mock vectors (significantly degraded quality)
- Semantic search accuracy drops
- Agent context retrieval is less precise
- Processing still works, but outputs are less intelligent
Optional API Keys
Google OAuth (Drive Integration)
Required for: Importing transcriptions directly from Google Drive or Google DocsUsed by:
/ingest command when processing Google Drive URLs1
Create OAuth credentials
- Go to Google Cloud Console
- Create a new project or select existing
- Enable Google Drive API and Google Docs API
- Create OAuth 2.0 credentials
- Add authorized redirect URIs (typically
http://localhost:8080)
2
Add to .env file
- Google Drive ingestion won’t work
- You’ll need to manually download files from Drive
- Direct ingestion from Google Docs is unavailable
Anthropic API Key
Required for: Direct Claude API access (separate from Claude Code)Used by: Standalone scripts and batch processing operations
Voice & Audio Features
These keys enable advanced voice interaction features:ElevenLabs
Deepgram
VAPI
Database & Storage
Supabase (Email Validation)
Integration Services (MCP)
These services enable integrations with productivity tools:N8N
Workflow automation and webhook handling
ClickUp
Task and project management integration
Miro
Collaborative whiteboarding
Notion
Documentation and knowledge management
Figma
Design file access and integration
Premium Distribution
contents:read permission on the mega-brain-premium repository.
Configuration File Structure
Your complete.env file should look like this:
Setup Wizard
Interactive Configuration
The easiest way to configure Mega Brain is using the interactive setup wizard:1
Check prerequisites
Verify Node.js 18+ and Python 3.10+ are installed
2
Install dependencies
Automatically install Python packages from
requirements.txt:- PyYAML >= 6.0
3
Configure API keys
Prompt you for each API key with helpful context:
- Which keys are required vs optional
- What each key is used for
- Where to get each key
4
Validate keys
Test API connectivity for OpenAI and Voyage AI
5
Generate .env
Create or update your
.env file with the provided keys6
Show summary
Display a complete setup summary with next steps
Example Setup Session
Manual Configuration
If you prefer to configure manually:1
Copy the template
.env file from scratch.2
Edit the file
Open
.env in your text editor and fill in your API keys:3
Verify configuration
Validation Commands
Check System Status
View your complete configuration status:Validate API Keys
The setup wizard automatically validates keys, but you can also use Claude Code:Test Specific Features
Security Best Practices
Verify .gitignore
Ensure your.env file is ignored:
Key Rotation
If you need to rotate a compromised key:1
Revoke the old key
Log into the provider’s dashboard and revoke/delete the old key
2
Generate a new key
Create a new API key with the same permissions
3
Update .env
Replace the old key in your
.env file4
Test the new key
Troubleshooting
API Key Validation Failed
If the setup wizard reports a key is invalid:- Check for extra spaces - Copy the key again, ensuring no leading/trailing spaces
- Verify key format - OpenAI keys start with
sk-, Voyage keys start withpa- - Check key status - Log into the provider’s dashboard and verify the key is active
- Test network - Ensure you can reach the API endpoint:
Environment Variables Not Loading
If your keys aren’t being recognized:- Check file location -
.envmust be in your project root - Verify file name - Must be exactly
.env(not.env.txtor similar) - Restart Claude Code - Environment changes require a restart
- Check syntax - Use
KEY=valueformat with no spaces around=
Setup Wizard Won’t Start
Ifnpx mega-brain-ai setup fails:
Next Steps
Quick Start Guide
Now that you’re configured, ingest your first material
Available Commands
Explore all CLI commands and slash commands
API Keys Guide
Detailed guide for each API provider
Layer System
Understand Community vs Pro features
