The application requires a Google Gemini API key to generate AI-powered repository analysis and chat responses.
- Visit Google AI Studio
- Click "Create API Key"
- Select or create a Google Cloud project
- Your API key will be displayed - copy it
Open .env.local in the project root and add:
NEXT_PUBLIC_GEMINI_API_KEY=your_api_key_hereReplace your_api_key_here with the key you copied.
Example:
NEXT_PUBLIC_GEMINI_API_KEY=AIzaSyDnRveyHJ0K2L3M4N5O6P7Q8R9S0T1U2VIf the server is running, stop it (Ctrl+C) and restart:
npm run devThis error means:
- ✗ API key is missing or empty
- ✗ API key is invalid
- ✗ Changes to
.env.localweren't applied
Solution:
- Check that
.env.localhas:NEXT_PUBLIC_GEMINI_API_KEY=your_key_here - Verify the API key from AI Studio
- Make sure there are no spaces:
NEXT_PUBLIC_GEMINI_API_KEY=AIzaS...(notAIzaS ...) - Restart the dev server
Solution:
- Go back to Google AI Studio
- Create a new API key (delete the old one if needed)
- Copy the new key and update
.env.local - Restart the dev server
If the chat responds but slowly or with errors:
- Check your Google Cloud project's billing setup
- Verify the Gemini API is enabled
- Check your API quota at Google Cloud Console
For enhanced repository analysis, you can optionally add a GitHub token:
- Go to GitHub Settings → Developer Settings → Tokens
- Generate a new classic token with
reposcope - Add to
.env.local:GITHUB_TOKEN=your_token_here
This allows:
- Higher rate limits for GitHub API calls
- Better repository analysis
- Access to private repository metadata
- ✅
NEXT_PUBLIC_GEMINI_API_KEYis safe to commit (it's public) ⚠️ Never share your actual API key in version control⚠️ Rotate your key if accidentally exposed- ✅ Use
.env.localfor local overrides (it's gitignored)
- Check the browser console (F12) for detailed error messages
- See the terminal output of
npm run devfor server-side errors - Review Google Gemini API docs