Chat Boy is an intelligent AI-powered chatbot web application built with FastAPI and integrated with OpenRouter's AI models. It provides a modern, responsive chat interface with smooth animations and a delightful user experience. Link https://chatboy-ai.onrender.com
- π€ AI-Powered Responses: Leverages Google Gemma-3-4b-it model via OpenRouter API
- π¨ Modern UI: Glassmorphism design with smooth animations and particle effects
- βΏ Accessibility First: WCAG compliant with screen reader support, keyboard navigation, and reduced motion options
- β‘ Real-time Chat: Instant AI responses with typing indicators and character-by-character animation
- π± Responsive Design: Mobile-first approach with adaptive layouts
- π Secure: Environment variable configuration for API keys
- π Dark Mode: Enhanced dark theme with high contrast support
- π Message Features:
- Copy messages to clipboard
- Timestamps for each message
- Character counter (2000 limit)
- Auto-resizing textarea
- β¨οΈ Keyboard Shortcuts:
Enter- Send messageCtrl+Enter- New lineEscape- Clear input
- π User Feedback:
- Toast notifications for actions
- Scroll indicator for long conversations
- Idle status indicator
- Loading states and error handling
- Backend: FastAPI - Modern Python web framework
- AI Integration: OpenRouter - Unified API for AI models
- Frontend: HTML5, CSS3, JavaScript (Vanilla)
- Templating: Jinja2
- Deployment Ready: Compatible with Render, Heroku, and other platforms
- Python 3.11 or higher
- OpenRouter API Key
- Clone the repository
bash
git clone https://github.com/yourusername/chatboy.git
cd chatboy
- Create a virtual environment
bash
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
- Install dependencies
bash
pip install -r requirements.txt
-
Configure environment variables
Create a
.envfile in root directory (this file is already in.gitignorefor security):
# OpenRouter API Configuration
OPENROUTER_API_KEY=your_openrouter_api_key_here
# Application Configuration
APP_NAME=ChatBoy AI
APP_VERSION=1.0.0
DEBUG=falseπ Security Note: Get your free API key from OpenRouter
The .env file is automatically excluded from git commits to protect your API keys.
- Run the application
bash
uvicorn app:app --reload
- Open your browser
Navigate to
http://localhost:8000
chatboy/
βββ app.py # Main FastAPI application
βββ lim.py # Standalone CLI version (optional)
βββ requirements.txt # Python dependencies
βββ .env # Environment variables (not in git)
βββ .gitignore # Git ignore rules
βββ TODO.md # Development roadmap
βββ static/
β βββ style.css # Modern CSS with glassmorphism
β βββ animations.js # Client-side animations
βββ templates/
βββ index.html # Main chat interface
βββ about.html # About page
| Method | Endpoint | Description |
|---|---|---|
| GET | / |
Main chat page |
| GET | /about |
About page |
| GET | /health |
Health check |
| GET | /ai?prompt={text} |
AI chat endpoint |
| POST | /items/ |
Create item (demo) |
| GET | /items/{id} |
Get item (demo) |
- Translucent chat container with backdrop blur
- Frosted glass effects on header and input areas
- Subtle blur backgrounds with particle animations
- Floating shapes for visual depth
- Smooth message slide-in effects with staggered timing
- Typing indicator with animated dots
- Button hover effects with shimmer animations
- Toast notification animations
- Particle background with connected nodes
- Robot icon floating animation
- Mobile-first design approach
- Adaptive chat container for all screen sizes
- Touch-friendly buttons and inputs
- Flexible input area on mobile devices
- Optimized typography scaling
- β
API keys are stored in
.envfile (never committed to git) - β
.envis included in.gitignoreby default - β
Use
.env.exampleas a template for required variables
- π Use environment-specific secret management (AWS Secrets Manager, etc.)
- π Enable HTTPS in production
- π Implement rate limiting
- π Add CORS configuration as needed
- π― WCAG 2.1 AA compliant
- π― Screen reader support with ARIA labels
- π― Keyboard navigation support
- π― High contrast mode support
- π― Reduced motion support for users with vestibular disorders
- π― Skip links for keyboard users
bash
# Run the development server
uvicorn app:app --reload
# Test health endpoint
curl http://localhost:8000/health
# Test AI endpoint
curl "http://localhost:8000/ai?prompt=Hello"
This project is licensed under the MIT License - see the LICENSE file for details.
- OpenRouter for providing AI API access
- FastAPI for the amazing framework
- Google for the Gemma model
- Emoji picker and voice input are planned features (not yet implemented)
- Rate limits depend on OpenRouter API tier
- Voice input support
- Emoji picker
- Chat history persistence
- Multiple AI model selection
- User authentication
- Real-time WebSocket updates
Made with β€οΈ using FastAPI