forty two
1.0.0
Forty-two is a Telegram bot that allows you to create your own ChatGPT in Telegram with OpenAI GPT, Google Gemini and Anthropic Claude models.
TELEGRAM_TOKEN=your_telegram_api_key
OPENAI_API_KEY=your_openai_api_key
# and / or
# GEMINI_API_KEY=your_gemini_api_key
# ANTHROPIC_API_KEY=your_anthropic_api_key
With docker-compose:
docker-compose up -d
Run without Docker:
pip install -r requirements.txt
alembic upgrade head
python main.py
Variable | Description | Default Value |
---|---|---|
TELEGRAM_TOKEN | Telegram API key. | - |
OPENAI_API_KEY | OpenAI API key. | - |
GEMINI_API_KEY | Google Gemini API key. | - |
ANTHROPIC_API_KEY | Anthropic API key. | - |
PROVIDER | Default provider for users. Users then can change their default provider with /provider command. Please note that API_KEY for selected provider is required. | OPENAI |
DB_STRING | Database connection string. | sqlite+aiosqlite:///db.sqlite3 |
MAX_COMPLETION_TOKENS | Maximum tokens for completion. | 4096 |
MAX_TOTAL_TOKENS | Maximum tokens for total output. If AI provider uses more than this amount, the bot will summarize user input. | 10000 |
SYSTEM_PROMPT | System prompt for GPT. | You are a friendly assistant, your name is Rick |
OPENAI_MODEL | OpenAI model. | gpt-4o |
ANTHROPIC_MODEL | Anthropic model. | claude-3-5-sonnet-20240620 |
GEMINI_MODEL | Gemini model. | gemini-1.5-flash |
ALLOWED_USERS | Comma-separated list of Telegram users who can interact with the bot. You can use both Telegram IDs or Usernames. If None, everyone can interact with the bot. Example: durov,238373289 | None |
LOG_MESSAGES | Log user messages to a file and the console. | False |
HISTORY_EXPIRATION | If the last message from a user occurred more than the specified time in minutes, the message history will be reset. | 30 |
LANGUAGE | Language for bot system messages. Curretly support en, es, ca, ru. | en |
This project is licensed under the MIT License - see the LICENSE file for details.
Made with love in Barcelona