AI Code Generator is a modern, web-based tool that leverages OpenAI's GPT models to generate clean, executable code, unit tests, and documentation across multiple programming languages. Built with FastAPI for the backend and Gradio for the frontend, it provides developers with a seamless, interactive, and visually appealing coding assistant.
- Generate production-ready code in multiple languages: Python, JavaScript, Java, HTML, C++, Go, TypeScript, PHP, Ruby, Swift.
- Automatically generate unit tests for your code.
- Generate documentation for classes and functions.
- Copy code to the clipboard or save it directly to a file.
- Clean, modern, and responsive UI with custom CSS.
- Works locally or can be deployed to cloud servers.
- Backend: FastAPI
- Frontend: Gradio
- AI: OpenAI GPT (via
openaiPython library) - Clipboard Support: Pyperclip
- Environment Variables:
.envfile for OpenAI API key
- Clone the repository:
git clone https://github.com/your-username/ai-code-generator.git
cd ai-code-generator- Install dependencies:
pip install -r requirements.txt- Create a .env file in the backend folder with your OpenAI API key:
OPENAI_API_KEY=your_openai_api_key_here