A monetizable AI assistant bot powered by Groq (Llama 3.3) with Telegram Stars payments — zero API cost to run.
| Feature | Free | Premium |
|---|---|---|
| Messages | 20/day | Unlimited |
| AI Modes (5 personalities) | ✅ | ✅ |
| Conversation memory | ✅ | ✅ (longer) |
| Priority responses | ❌ | ✅ |
- 🤖 General — All-around assistant
- 💻 Code Expert — Programming & debugging
- ✍️ Writing Pro — Writing, editing & content
- 📊 Analyst — Research & strategy
- 🎓 Tutor — Learn any topic
- Open Telegram → search @BotFather
- Send
/newbot - Choose a name and username
- Copy the bot token you receive
- In BotFather, send
/mybots - Select your bot → Payments
- Choose Telegram Stars as provider
- Done — no extra configuration needed
- Go to console.groq.com
- Sign up (free)
- Create an API key → copy it
- Push this project to a GitHub repo
- Go to railway.app → New Project → Deploy from GitHub
- Select your repo
- Go to Variables and add:
BOT_TOKEN=your_token_here GROQ_API_KEY=your_groq_key_here - Railway auto-detects the
Procfileand deploys
✅ That's it. Your bot is live.
# 1. Clone & enter directory
cd telegram-ai-bot
# 2. Install dependencies
pip install -r requirements.txt
# 3. Set environment variables
cp .env.example .env
# Edit .env with your tokens
# 4. Run
python bot.pyTo load .env locally, add this to the top of bot.py:
from dotenv import load_dotenv
load_dotenv()- Users pay 250 Telegram Stars (~$3.50) for 30 days of Premium
- Telegram Stars are purchased inside the Telegram app — no payment processor setup needed
- You receive Stars directly; withdraw via BotFather →
/mybots→ Payments
To adjust pricing, change in bot.py:
PREMIUM_STARS = 250 # Price in Stars
PREMIUM_DAYS = 30 # Duration in daysFREE_LIMIT = 20 # messages per dayGROQ_MODEL = "llama-3.3-70b-versatile" # or "llama-3.1-8b-instant" for faster/lighterEdit the MODES dictionary in bot.py. Each mode has:
name— Display name with emojidesc— Short descriptionprompt— System prompt (personality)
telegram-ai-bot/
├── bot.py # Main bot — all handlers, AI, payments
├── database.py # SQLite — users, usage, conversations
├── requirements.txt
├── Procfile # Railway deployment
├── .env.example # Environment variable template
└── README.md
| Command | Description |
|---|---|
/start |
Welcome message |
/mode |
Switch AI personality |
/status |
Plan & usage info |
/reset |
Clear conversation history |
/premium |
Upgrade page |
/help |
Command reference |
Q: Will I get charged for Groq API?
A: No. Groq's free tier is very generous — more than enough for a starting bot.
Q: What if Groq rate limits hit?
A: The bot returns a friendly error. You can upgrade to Groq paid later if you scale.
Q: Where is user data stored?
A: In a local SQLite file (bot.db). On Railway, it persists on disk. For production scale, swap for PostgreSQL.
Q: Can I add more payment options?
A: Yes. Telegram also supports Stripe, YooMoney, and others via BotFather → Payments.