NEVER commit your API keys to Git! This project uses environment variables to keep your keys secure.
- Go to https://www.perplexity.ai/
- Sign up or log in to your account
- Navigate to API settings
- Generate a new API key
- Copy the key (it starts with
pplx-)
Run the app with your API key:
flutter run --dart-define=PERPLEXITY_API_KEY=pplx-your-actual-key-hereWarning: Don't commit these changes!
- Open
lib/services/api_service.dart - Find line ~10:
defaultValue: 'YOUR_API_KEY_HERE', - Replace
YOUR_API_KEY_HEREwith your actual API key - Do the same in
lib/screens/perplexity_insights_dialog.dartaround line 30
git update-index --assume-unchanged lib/services/api_service.dart
git update-index --assume-unchanged lib/screens/perplexity_insights_dialog.dartCreate/update .vscode/launch.json:
{
"version": "0.2.0",
"configurations": [
{
"name": "EdgeScholar",
"request": "launch",
"type": "dart",
"args": [
"--dart-define=PERPLEXITY_API_KEY=pplx-your-actual-key-here"
]
}
]
}For iOS:
flutter build ios --dart-define=PERPLEXITY_API_KEY=pplx-your-actual-key-hereFor Android:
flutter build apk --dart-define=PERPLEXITY_API_KEY=pplx-your-actual-key-hereEdgeScholar uses the sonar model from Perplexity AI for:
- Research paper search
- AI-powered comparisons
- Insights generation
If you see this warning, make sure you're passing the --dart-define flag or have set the default value locally.
Your API key is invalid or expired. Generate a new one from Perplexity.
Check that you're using the correct model name (sonar).
✅ Use environment variables or build-time defines
✅ Add sensitive files to .gitignore
✅ Rotate API keys regularly
✅ Use different keys for development and production
❌ Never commit API keys to version control
❌ Don't share keys in public repositories
❌ Don't hardcode keys in source files (without using environment variables)
Check the Perplexity AI documentation: https://docs.perplexity.ai/