AI-powered multi-language chatbot built with Aiogram 3, DeepSeek API, and OpenRouter.
Supports model switching, smart history, per-user configuration, and clean modular architecture.
- Supports multiple DeepSeek models
- Each user can select their own model
- Smart chat history with automatic trimming
- Configurable system prompt
- Fast async requests through OpenRouter
- Selected model
- Language
- Custom API key (optional)
- All saved in meta-JSON in DB
- Clean project structure
- Modular handlers
- CRUD layer for DB operations
- Service layer for business logic
- SQLAlchemy + Async engine
app/
ββ handlers/
β ββ help.py
β ββ models.py
β ββ language_change.py
β ββ chat.py
ββ services/
β ββ ai_service.py
β ββ user_service.py
ββ crud/
β ββ users.py
β ββ history.py
ββ models/
β ββ users.py
β ββ ai_history.py
ββ db/
β ββ base.py
β ββ session.py
ββ run.py
ββ config.py
git clone https://github.com/RustamovAkrom/DeepSeek_TelegramBot.git
cd DeepSeek_TelegramBotpython -m venv .venv
source .venv/bin/activate # Linux / Mac
.venv\Scripts\activate # Windowspip install -r requirements.txtYou can get your api keys from this resources and set into .env file:
- DEEPSEEK_API_KEY -> https://openrouter.ai/ AI token
- TELEGRAM_BOT_TOKEN -> https://t.me/BotFather Telegram bot token
- ADMIN_IDS -> https://t.me/TgramUserIDBot Your telegram ID
DEEPSEEK_API_KEY=DEEPSEEK_API_KEY
TELEGRAM_BOT_TOKEN=TELEGRAM_BOT_TOKEN
ADMIN_IDS=6572863564
ENV=dev # dev or prod
DATABASE_URL=DATABASE_URL # production database
TEST_DATABASE_URL=sqlite+aiosqlite:///./test.db # development database and for testing
python run.py| Command | Description |
|---|---|
/start |
Start bot and init user |
/help |
Show help message |
/models |
Choose AI model |
/admin |
Manage users |
/models |
Change model DeepSeek |
/profile |
User profile |
| text | Simply chat with the AI |
Pull requests and improvements are welcome! Feel free to open issues or suggest features.
If this bot helped you β leave a star βοΈ in the repository! Your support motivates me to continue improving it π
MIT β free for personal and commercial use.