This guide explains how to set up environment variables for the Telegram Sideload Bot.
-
Copy the template:
cp docs/env_template.txt .env
-
Edit the .env file:
# Open .env in your editor and fill in the values nano .env # or code .env
-
Install dependencies:
pip install python-dotenv
The following credentials must be provided either in environment variables or in the .env file:
TELEGRAM_LLM_BOT_TOKEN: Your Telegram bot token from @BotFatherALLOWED_USER_IDS: Comma-separated list of Telegram user IDs allowed to use the botALLOWED_GROUP_IDS: Comma-separated list of Telegram group IDs (use negative numbers)
You must choose one AI provider and provide its credentials:
- Set
AI_PROVIDER=openrouter - Provide
OPENROUTER_KEYfrom openrouter.ai
- Set
AI_PROVIDER=openai - Provide
OPENAI_API_KEYfrom platform.openai.com - Optionally set
OPENAI_MODEL(defaults to gpt-4)
- Set
AI_PROVIDER=anthropic - Provide
ANTHROPIC_API_KEYfrom console.anthropic.com - Optionally set
ANTHROPIC_MODEL(defaults to claude-3-sonnet-20240229)
- Set
AI_PROVIDER=google - Provide
GOOGLE_API_KEYfrom makersuite.google.com - Optionally set
GOOGLE_MODEL_NAME(defaults to gemini-pro)
- Set
AI_PROVIDER=ollama - No API key required (uses local Ollama instance)
USERS_INFO: Descriptive information about users (for personalization)TRIGGER_WORDS: Words that trigger bot responses (comma-separated)
- Never commit
.envfiles to version control - Keep your API keys secure
- Use environment variables on production servers instead of
.envfiles when possible
- "Required keys not found": Make sure all required credentials are filled in
- "Invalid bot token": Double-check your bot token from @BotFather
- "User not allowed": Verify the user ID is in
ALLOWED_USER_IDS - API errors: Check your API key and provider-specific settings