English | 简体中文 | 繁體中文 | 日本語 | Español | Français | Русский | Deutsch
GPT-Telegram-Bot is a powerful Telegram bot that integrates various AI models, providing intelligent conversations, image generation and analysis capabilities.
GPT-Telegram-Bot/
├── api/ # API related configuration
│ ├── telegram.js # Handles Telegram bot interactions
├── src/ # Source code
│ ├── api.js # Handles interactions with OpenAI compatible APIs
│ ├── bot.js # Main Telegram bot logic
│ ├── config.js # Configuration file
│ ├── azureOpenAI.js # Handles interactions with Azure OpenAI
│ ├── claude.js # Handles interactions with Claude
│ ├── generateImage.js# Handles interactions with DALL·E
│ ├── geminiApi.js # Handles interactions with Gemini
│ ├── groqapi.js # Handles interactions with Groq
│ ├── uploadhandler.js# Handles image upload and analysis logic
│ ├── localization.js # Handles multilingual support
│ ├── redis.js # Upstash Redis database functionality
├── locales/ # Multilingual support files
│ ├── en.json
│ ├── zh-cn.json
│ ├── zh-hant.json
│ └── ja.json
│ └── es.json
│ └── fr.json
│ └── ru.json
│ └── de.json
├── docs/ # Multilingual README files
│ ├── README.zh-cn.md
│ ├── README.zh-hant.md
│ ├── README.ja.md
│ ├── README.es.md
│ ├── README.fr.md
│ ├── README.ru.md
│ └── README.de.md
├── public/ # Vercel webpage after deployment
│ └── index.html # Webpage entry file
├── package.json # Project dependencies
├── vercel.json # Vercel configuration file
└── README.md # Project description file
Clone the repository:
git clone https://github.com/snakeying/GPT-Telegram-Bot.git
cd GPT-Telegram-Bot
Install dependencies:
npm install
Configure environment variables:
Create a .env
file and fill in the necessary configuration information (refer to the environment variable configuration below).
Deploy to Vercel:
Set up Telegram Webhook: After deployment, use the following URL to set up the Webhook:
https://api.telegram.org/bot/setWebhook?url=/api/telegram
Before deploying and running GPT-Telegram-Bot, you need to set the following environment variables. Create a .env
file in the project root directory and configure the following variables:
Variable Name | Description | Default Value |
---|---|---|
OPENAI_API_KEY |
OpenAI API key | - |
OPENAI_BASE_URL |
OpenAI API base URL | https://api.openai.com/v1 |
OPENAI_MODELS |
OpenAI models to use (comma-separated) | - |
DEFAULT_MODEL |
Default model to use | First model in OPENAI_MODELS |
AZURE_OPENAI_API_KEY |
Azure OpenAI API key | - |
AZURE_OPENAI_ENDPOINT |
Azure OpenAI endpoint | - |
AZURE_OPENAI_MODELS |
Azure OpenAI models to use (comma-separated) | - |
TELEGRAM_BOT_TOKEN |
Telegram Bot Token | - |
WHITELISTED_USERS |
Allowed user IDs (comma-separated) | - |
DALL_E_MODEL |
DALL-E model to use | dall-e-3 |
UPSTASH_REDIS_REST_URL |
Upstash Redis REST URL | - |
UPSTASH_REST_TOKEN |
Upstash Redis REST Token | - |
SYSTEM_INIT_MESSAGE |
System initialization message | You are a helpful assistant. |
SYSTEM_INIT_MESSAGE_ROLE |
System message role | system |
GEMINI_API_KEY |
Google Gemini API key | - |
GOOGLE_MODELS |
Google models to use (comma-separated) | - |
GEMINI_ENDPOINT |
Gemini API endpoint | https://generativelanguage.googleapis.com/v1beta/models |
GROQ_API_KEY |
Groq API key | - |
GROQ_MODELS |
Groq models to use (comma-separated) | - |
MAX_HISTORY_LENGTH |
Maximum history length | 50 |
CLAUDE_API_KEY |
Anthropic Claude API key | - |
CLAUDE_MODELS |
Claude models to use (comma-separated) | - |
CLAUDE_ENDPOINT |
Claude API endpoint | https://api.anthropic.com/v1/chat/completions |
Make sure to add these environment variables to your project's environment configuration when deploying to Vercel or other platforms.
/start
- Initialize the bot/new
- Start a new conversation/history
- View conversation history summary/help
- Get help information/switchmodel
- Switch AI model/img [size]
- Generate image/language
- Switch interface languageSupported languages (use /language command):
Welcome to submit Pull Requests or open Issues to improve this project! Your contributions will make this AI assistant more powerful and interesting.
This project is licensed under the MIT License.
About the "Deploy to Vercel" button: This button provides a one-click deployment to Vercel, which is very convenient. However, please note:
snakeying/GPT-Telegram-Bot
in the link with your GitHub username and repository name.For example, if your GitHub username is "yourname", you should change the button link to:
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fyourname%2FGPT-Telegram-Bot)
This ensures that the "Deploy to Vercel" button will deploy your forked version, not the original repository.