AI application that explains code using multiple Large Language Models (LLMs) - OpenAI's GPT-4.0 and Anthropic's Claude-3. The application provides parallel explanations from both models, allowing users to compare different interpretations of their code. (MAIN AI CODE EXPLAINING MODEL PULLED FROM HUGGINGFACE)
The application uses a Flask backend to:
- Accept code input from users
- Estimate token usage and costs
- Send the code to both OpenAI and Anthropic APIs
- Return parallel explanations from both models
- Frontend: HTML/CSS/JavaScript
- Backend: Python Flask
- APIs:
- OpenAI GPT-4.0
- Anthropic Claude-3
- Token Management: tiktoken for accurate token counting
- Environment Management: python-dotenv for secure configuration
- Clone the repository:
git clone https://github.com/yourusername/multi-llm-code-explainer.git
cd multi-llm-code-explainer- Create a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate- Install dependencies:
pip install -r requirements.txt- Set up environment variables:
- Copy
.env.exampleto.env - Add your API keys:
- Get OpenAI API key from: https://platform.openai.com/
- Get Anthropic API key from: https://console.anthropic.com/
- Run the application:
cd app
python app.py- Visit
http://127.0.0.1:5000in your browser
- API keys are stored in
.envfile (not committed to Git) - Token and cost limits prevent excessive API usage
- Input validation and sanitization implemented
- Rate limiting on API requests
The application estimates costs based on:
- Input tokens (code length)
- Estimated output tokens
- Current API pricing for both models
Default limits:
- Max cost per request: $0.50
- Monthly budget: $10.00
- Create a
docs/imagesdirectory in your repository - Save the screenshots you shared with me as:
app-screenshot.pngcost-estimate.pngcode-explanation.png
- Add them to the
docs/imagesdirectory - They will be displayed in the README as shown above
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
MIT License - See LICENSE file for details


