An AI-powered web application that helps students understand complex study topics through simple, student-friendly explanations. Students can enter any topic and receive instant, easy-to-understand explanations generated by advanced AI models.
Key Features:
- Clean, responsive web interface
- Real-time AI-generated explanations
- Support for various study topics (science, math, history, etc.)
- Markdown-formatted output for better readability
- Daily rate limiting (30 requests per API)
The application integrates two AI APIs with automatic fallback:
Primary API: Google Gemini
- Used for generating initial explanations
- Model:
gemini-2.5-flash(configurable viaGEMINI_MODEL) - Provides high-quality, student-friendly explanations
Fallback API: Groq
- Automatically used if Gemini fails
- Model:
openai/gpt-oss-120b(configurable viaGROQ_MODEL) - Ensures reliability with fast inference
Implementation Details:
- API calls made from Next.js API routes (
/api/explain) - Prompts designed to generate concise, educational content
- Comprehensive logging of usage statistics and metadata
- Error handling with graceful degradation
- Daily rate limiting: 30 requests per API (resets daily)
- Node.js 18+ installed
- API keys for Google Gemini and Groq
-
Clone and install dependencies:
git clone https://github.com/MagicalCoder-12/AI-study-Explainer.git cd ai-study-explainer npm install -
Configure environment variables:
Create
.env.localfile:# Get from https://makersuite.google.com/app/apikey GOOGLE_API_KEY=your_gemini_api_key_here # Get from https://console.groq.com/ GROQ_API_KEY=your_groq_api_key_here # Optional: override default models GEMINI_MODEL= gemini-2.5-flash GROQ_MODEL= openai/gpt-oss-120b
-
Run the application:
npm run dev
-
Open in browser:
- Navigate to
http://localhost:3000 - Enter a study topic and click "Explain Topic"
- Navigate to
- Gemini: Visit Google AI Studio to get your API key
- Groq: Visit Groq Console to get your API key
The application will automatically use Gemini first, falling back to Groq if needed.