Get real audio-to-text transcription working instead of mock results.
- Go to: https://makersuite.google.com/app/apikey
- Sign in with Google account
- Click "Create API Key"
- Copy the API key
- In your project root (CLASS_LESS-main folder), create a file named
.env.local - Add this content:
GEMINI_API_KEY=your_actual_api_key_here
- Replace
your_actual_api_key_herewith your real API key
Run this command to test your API key:
node test-gemini-api.js- Stop your current server (Ctrl+C)
- Run:
npm run dev - Go to: http://localhost:3001/ask
- Select "Voice" question type
- Record: "What is Java?"
- Click "Transcribe"
- You should see "Gemini AI" in the response
- Console shows:
[Transcribe] Gemini AI transcription successful! - Response shows:
"source": "gemini-ai" - Transcription matches what you actually said
- Console shows:
[Transcribe] No Gemini API key found - Response shows:
"source": "mock" - Transcription is random educational questions
- Problem: "Too Many Requests"
- Solution: Wait for quota reset or upgrade plan
- Alternative: Use mock mode for testing
- Problem: Still getting mock results
- Solution: Check
.env.localfile exists and has correct API key - Fix: Restart server after adding API key
- Problem: API works but transcription is wrong
- Solution: Speak clearly, avoid background noise
- Tip: Keep recordings under 30 seconds
- Check console logs for detailed error messages
- Run
node test-gemini-api.jsto test API key - Verify
.env.localfile is in the correct location - Make sure you restarted the server after adding the API key
When you record "What is Java?" and transcribe it, you should get:
- Text: "What is Java?" (or very similar)
- Source: "gemini-ai"
- Confidence: 95%
Instead of the current mock result: "How do I write a thesis statement?"