An AI chatbot agent that helps students answer scientific questions and study more effectively. It uses large language models through the OpenRouter API and provides a simple web interface for chatting.
- Features
- Demo
- Tech Stack
- Project Structure
- Getting Started
- Configuration
- Usage
- Security
- Roadmap
- Contributing
- License
- Answers questions across scientific subjects (physics, chemistry, biology, mathematics, etc.)
- Explains concepts step by step, adapted to a student's level
- Keeps conversation history so you can continue a study session
- Lightweight web interface, no framework needed on the front end
- Model access through OpenRouter, so you can switch models easily
| Layer | Technology |
|---|---|
| Backend | Python |
| AI provider | OpenRouter API |
| Frontend | HTML (static/index.html) |
| Config | python-dotenv |
| Storage | Local chat history files |
chat/
├── .gitignore
├── README.md
└── chatbot/
├── main.py # Backend and chatbot logic
├── example.env # Template for environment variables
├── .gitignore
└── static/
└── index.html # Web interface
The chat_history/ folder is created automatically at runtime and is not tracked by Git.
- Python 3.9 or newer
- An OpenRouter account and API key (get one here)
- Git
-
Clone the repository
git clone https://github.com/rayngift/chatbot.git cd chatbot/chatbot -
Create a virtual environment (recommended)
python -m venv venv venv\Scripts\activate # Windows source venv/bin/activate # macOS / Linux
-
Install dependencies
pip install -r requirements.txt
-
Copy the template:
copy example.env .env # Windows cp example.env .env # macOS / Linux
-
Open
.envand add your own key:OPENROUTER_API_KEY=your_key_here
⚠️ Never commit.envor share your API key. It is already listed in.gitignore.
Start the application:
python main.pyThen open the address shown in the terminal (for example http://localhost:8000) in your browser and start asking questions.
Example prompts
- "Explain photosynthesis in simple terms."
- "Walk me through solving a quadratic equation step by step."
- "Quiz me on Newton's three laws."
- "What is the difference between mitosis and meiosis?"
- API keys are loaded from environment variables and never stored in the code.
.env, chat history, and archive files are excluded through.gitignore.- If a key is ever exposed, revoke it immediately from the OpenRouter dashboard.
- Quiz and flashcard generation mode
- Support for LaTeX / math formula rendering
- Subject selection (physics, chemistry, biology, ...)
- Upload a PDF course and ask questions about it
- Multi-language interface (French / English)
Contributions are welcome.
- Fork the repository
- Create a branch:
git checkout -b feature/my-feature - Commit your changes:
git commit -m "Add my feature" - Push the branch:
git push origin feature/my-feature - Open a Pull Request
This project is licensed under the MIT License. See the LICENSE file for details.
Made by rayngift