| name | bot-orchestrator |
| description | Telegram Bot Orchestrator - Manage multiple bot tokens, route messages to different agents based on context. Includes token logging per bot and cost tracking per model/agent. |
🤖 Telegram Bot Orchestrator
Central hub untuk manage multiple Telegram bots dengan smart routing dan cost tracking.
🎯 Features
1️⃣ Multi-Bot Management
- Register multiple bot tokens
- Monitor status setiap bot (active/inactive)
- Auto-restart kalau bot down
- Backup/restore bot configurations
2️⃣ Smart Routing
- Route pesan ke agent berbeda berdasarkan:
- Chat ID / Group ID
- Message content (keywords)
- Time of day
- User role/privileges
- Fallback routing kalau agent busy
3️⃣ Token Logging
📊 Token Usage Log:
┌─────────────┬──────────┬─────────┬─────────────┐
│ Bot │ Requests │ Tokens │ Cost (USD) │
├─────────────┼──────────┼─────────┼─────────────┤
│ Radit │ 150 │ 45K │ $0.89 │
│ Raka │ 80 │ 22K │ $0.44 │
│ Rama │ 120 │ 38K │ $0.76 │
│ Rafi │ 200 │ 65K │ $1.30 │
└─────────────┴──────────┴─────────┴─────────────┘
Total Daily: $3.39
4️⃣ Price Search & Cost Calculation
- Search harga per model real-time:
- Kimi K2.5: $0.002/1K tokens
- GLM-4.7: $0.001/1K tokens
- Claude Opus: $0.015/1K tokens
- Calculate cost per agent/bot
- Alert kalau daily budget terlampaui
5️⃣ Dashboard
Real-time monitoring via CLI atau Telegram:
🤖 Bot Orchestrator Dashboard
Active Bots: 4/4 ✅
Agent Status:
• Radit: 🟢 Online (12 req/min)
• Raka: 🟢 Online (8 req/min)
• Rama: 🟡 Busy (20 req/min)
• Rafi: 🟢 Online (15 req/min)
💰 Today's Cost: $3.39 / $10.00 budget
📊 Total Requests: 550
🔄 Avg Response Time: 2.3s
🚀 Usage
Register New Bot
bash skills/bot-orchestrator/scripts/manage.sh register \
--name raka \
--token "8048365357:AAEu_RwPpqJDEprP2mqFSlNr8sEjvMQocZs" \
--agent raka \
--model "kimi-coding/k2p5"
Start Orchestrator
bash skills/bot-orchestrator/scripts/orchestrator.sh start
View Dashboard
bash skills/bot-orchestrator/scripts/dashboard.sh
Check Cost Report
bash skills/bot-orchestrator/scripts/cost.sh --daily
⚙️ Configuration
config.json:
{
"bots": [
{
"name": "radit",
"token": "8365127262:AAE...",
"agent": "radit",
"model": "kimi-coding/k2p5",
"enabled": true,
"routing_rules": {
"priority": 1,
"time_restrictions": null
}
},
{
"name": "raka",
"token": "8048365357:AAE...",
"agent": "raka",
"model": "kimi-coding/k2p5",
"enabled": true
}
],
"cost_tracking": {
"enabled": true,
"daily_budget": 10.00,
"currency": "USD",
"alert_threshold": 0.8
},
"routing": {
"default_agent": "radit",
"fallback_enabled": true,
"load_balancing": false
}
}
📊 Cost Calculation
Prices auto-updated dari API providers:
| Provider | Model | Input | Output | Context |
|---|
| Moonshot | kimi-k2.5 | $0.002 | $0.006 | 128K |
| ZAI | glm-4.7 | $0.001 | $0.003 | 128K |
| Anthropic | claude-opus | $0.015 | $0.075 | 200K |
Cost Formula:
Total Cost = (Input Tokens × Input Price) + (Output Tokens × Output Price)
🔧 Commands
| Command | Description |
|---|
register | Add new bot token |
start | Start orchestrator |
stop | Stop all bots |
status | Check bot status |
dashboard | Show live dashboard |
cost | Show cost report |
logs | View token usage logs |
route | Test routing rules |
📈 Logs
All logs stored in logs/:
token_usage_YYYY-MM-DD.json - Per-request token usage
cost_report_YYYY-MM.json - Monthly cost aggregation
routing_decisions.log - Routing logic trace
bot_status.log - Bot health status
🔔 Alerts
Auto-send Telegram alert kalau:
- Bot down > 5 minutes
- Daily cost > 80% budget
- Unusual token usage spike
- Rate limit approaching
🛡️ Security
- Tokens encrypted at rest
- Access logs tracked
- Rate limiting per bot
- Auto-revoke compromised tokens