Chinese documentation: click here
AiChat Pro is a self-hosted multi-model AI chat platform built with PHP and MySQL.
Important
The payment system is not fully implemented yet and should be treated as work in progress.
Parts of this project were generated or assisted by AI. Please review security, payment, and business logic carefully before production use.
It includes:
- User auth and profile management
- Multi-turn chat sessions with streaming response support
- Model/provider management (OpenAI / Anthropic / DeepSeek)
- File upload support
- Plan, quota, subscription, and transaction management
- Admin dashboard
- Web installer for first-time setup
- Backend: PHP 7.4+ (lightweight MVC-style structure)
- Database: MySQL 5.7+
- Frontend: Vanilla HTML/CSS/JS + Tailwind CDN
- Deployment: Nginx + PHP-FPM (Docker supported)
.
+-- app/ # Controllers, services, models, and core classes
+-- routes/ # API routes
+-- config/ # App config (runtime DB config generated after install)
+-- sql/ # Database schema and seed data
+-- admin/ # Admin page
+-- install/ # Installer page and API
+-- assets/ # Static files
+-- docker/ # Docker and Nginx configs
+-- uploads/ # Runtime upload directory
`-- storage/ # Runtime cache and rate-limit storage
- Clone this repository.
- Copy the environment template.
- Create a MySQL database.
- Start the app.
- Open the installer and complete setup.
cp .env.example .env
php -S 127.0.0.1:8080Windows PowerShell:
Copy-Item .env.example .env
php -S 127.0.0.1:8080Docker (optional):
docker compose -f docker/docker-compose.yml up -d --buildInstaller URL:
http://127.0.0.1:8080/install
Set the following in .env:
JWT_SECRETDB_HOST,DB_PORT,DB_NAME,DB_USER,DB_PASSOPENAI_API_KEYANTHROPIC_API_KEYDEEPSEEK_API_KEYAPP_URL
Reference file:
.env.example
- Never commit real secrets (
.env, API keys, DB passwords, payment private keys) - Keep
APP_DEBUG=falsein production - Use a strong random
JWT_SECRET - Rotate API keys immediately if exposed
- Review AI-generated code before public deployment
Core routes are defined in routes/api.php:
/api/auth/*authentication/api/chats/*chat/session endpoints/api/user/*profile, usage, transactions/api/admin/*admin endpoints/api/install/*install endpoints
- License: MIT (LICENSE)
- Contributing guide: CONTRIBUTING.md
- Security policy: SECURITY.md