Skip to content

Commit 59360cc

Browse files
committed
feat: add Telegram bot for remote quota monitoring
1 parent a1c7046 commit 59360cc

File tree

4 files changed

+645
-1
lines changed

4 files changed

+645
-1
lines changed

.env.example

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,4 +250,28 @@ OAUTH_REFRESH_INTERVAL=600 # Default is 600 seconds (10 minutes)
250250
# setup/validation flow on startup. This is highly recommended for non-interactive
251251
# environments like Docker containers or automated scripts.
252252
# Ensure your credentials in 'oauth_creds/' are valid before enabling this.
253-
SKIP_OAUTH_INIT_CHECK=false
253+
SKIP_OAUTH_INIT_CHECK=false
254+
255+
256+
# ------------------------------------------------------------------------------
257+
# | [TELEGRAM] Telegram Bot Configuration |
258+
# ------------------------------------------------------------------------------
259+
#
260+
# Optional: Enable a Telegram bot to query quota stats from your phone.
261+
#
262+
# Setup:
263+
# 1. Message @BotFather on Telegram and send /newbot
264+
# 2. Follow the prompts to create your bot
265+
# 3. Copy the token and paste it below
266+
# 4. Message @userinfobot to get your Telegram user ID
267+
# 5. Add your user ID to TELEGRAM_ALLOWED_USERS (comma-separated for multiple)
268+
# 6. Run: python -m src.proxy_app.telegram_bot
269+
#
270+
271+
# Bot token from @BotFather (required for Telegram bot)
272+
TELEGRAM_BOT_TOKEN=""
273+
274+
# Comma-separated list of Telegram user IDs allowed to use the bot
275+
# Get your ID by messaging @userinfobot on Telegram
276+
# Example: TELEGRAM_ALLOWED_USERS="123456789,987654321"
277+
TELEGRAM_ALLOWED_USERS=""

docker-compose.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,21 @@ services:
4949
timeout: 10s
5050
retries: 3
5151
start_period: 30s
52+
53+
telegram-bot:
54+
build:
55+
context: .
56+
dockerfile: Dockerfile
57+
container_name: llm-telegram-bot
58+
restart: unless-stopped
59+
command: python -m src.proxy_app.telegram_bot
60+
volumes:
61+
- ./.env:/app/.env:ro
62+
environment:
63+
- PYTHONUNBUFFERED=1
64+
# Point to the llm-proxy container
65+
- PROXY_HOST=llm-proxy
66+
- PROXY_PORT=8317
67+
depends_on:
68+
llm-proxy:
69+
condition: service_healthy

requirements.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,6 @@ customtkinter
2525

2626
# For building the executable
2727
pyinstaller
28+
29+
# Telegram bot for quota monitoring
30+
python-telegram-bot>=21.0

0 commit comments

Comments
 (0)