{"id":15291828,"url":"https://github.com/snakeying/gpt-telegram-bot","last_synced_at":"2025-05-07T15:47:52.674Z","repository":{"id":257028715,"uuid":"855875178","full_name":"snakeying/GPT-Telegram-Bot","owner":"snakeying","description":"Your own GPT Telegram Bot on Vercel","archived":false,"fork":false,"pushed_at":"2024-10-06T23:31:32.000Z","size":589,"stargazers_count":45,"open_issues_count":1,"forks_count":24,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-02-19T01:12:23.419Z","etag":null,"topics":["azure","chatbot","chatgpt-bot","claude","claude-api","dall-e","gemini","gemini-api","gpt","groq","groq-api","multilanguage","openai","openai-api","telegram","telegram-bot"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/snakeying.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-09-11T15:44:00.000Z","updated_at":"2025-02-09T13:40:23.000Z","dependencies_parsed_at":"2024-09-14T12:31:31.213Z","dependency_job_id":"c0fe404e-2ba3-4f5f-a6de-4069037c507e","html_url":"https://github.com/snakeying/GPT-Telegram-Bot","commit_stats":null,"previous_names":["snakeying/gpt-telegram-bot"],"tags_count":26,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snakeying%2FGPT-Telegram-Bot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snakeying%2FGPT-Telegram-Bot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snakeying%2FGPT-Telegram-Bot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snakeying%2FGPT-Telegram-Bot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/snakeying","download_url":"https://codeload.github.com/snakeying/GPT-Telegram-Bot/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240778264,"owners_count":19855984,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["azure","chatbot","chatgpt-bot","claude","claude-api","dall-e","gemini","gemini-api","gpt","groq","groq-api","multilanguage","openai","openai-api","telegram","telegram-bot"],"created_at":"2024-09-30T16:14:42.221Z","updated_at":"2025-02-26T02:22:11.835Z","avatar_url":"https://github.com/snakeying.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GPT-Telegram-Bot: Multifunctional AI Assistant 🤖💬\n\n[English](./README.md) | [简体中文](./docs/README.zh-cn.md) | [繁體中文](./docs/README.zh-hant.md) | [日本語](./docs/README.ja.md) | [Español](./docs/README.es.md) | [Français](./docs/README.fr.md) | [Русский](./docs/README.ru.md) | [Deutsch](./docs/README.de.md)\n\nGPT-Telegram-Bot is a powerful Telegram bot that integrates various AI models, providing intelligent conversations, image generation and analysis capabilities.\n\n[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fsnakeying%2FGPT-Telegram-Bot)\n\n## Main Features 🌟\n\n1. **Multi-model Support** 🎭: Any model compatible with OpenAI API, Google Gemini, Anthropic Claude, Groq, and Azure OpenAI\n2. **Intelligent Conversations** 💬: Natural language interactions with context memory support\n3. **Image Generation** 🎨: Create images based on text descriptions\n4. **Image Analysis** 🔍: Interpret and describe uploaded images\n5. **Multilingual Support** 🌐: Localization support for multiple languages\n6. **Stream Response** ⚡: Real-time generation and display of AI replies\n7. **User Whitelist** 🔐: Can be set to allow access only to specific users\n\n## Supported AI Models 🧠\n\n- OpenAI Series: Powerful language models 🚀\n- Google Gemini: Google's next-generation AI model 🧑‍🔬\n- Anthropic Claude: Another powerful language model choice 🎭\n- Groq: High-speed inference AI model ⚡\n- Azure OpenAI: Microsoft-hosted OpenAI service 👔\n\n## Project Structure 📁\n\n```\nGPT-Telegram-Bot/\n├── api/                # API related configuration\n│   ├── telegram.js     # Handles Telegram bot interactions\n├── src/                # Source code\n│   ├── api.js          # Handles interactions with OpenAI compatible APIs \n│   ├── bot.js          # Main Telegram bot logic\n│   ├── config.js       # Configuration file\n│   ├── azureOpenAI.js  # Handles interactions with Azure OpenAI\n│   ├── claude.js       # Handles interactions with Claude\n│   ├── generateImage.js# Handles interactions with DALL·E\n│   ├── geminiApi.js    # Handles interactions with Gemini\n│   ├── groqapi.js      # Handles interactions with Groq\n│   ├── uploadhandler.js# Handles image upload and analysis logic\n│   ├── localization.js # Handles multilingual support\n│   ├── redis.js        # Upstash Redis database functionality\n├── locales/            # Multilingual support files\n│   ├── en.json         \n│   ├── zh-cn.json      \n│   ├── zh-hant.json    \n│   └── ja.json         \n│   └── es.json         \n│   └── fr.json         \n│   └── ru.json         \n│   └── de.json         \n├── docs/               # Multilingual README files\n│   ├── README.zh-cn.md \n│   ├── README.zh-hant.md\n│   ├── README.ja.md    \n│   ├── README.es.md    \n│   ├── README.fr.md    \n│   ├── README.ru.md    \n│   └── README.de.md    \n├── public/             # Vercel webpage after deployment\n│   └── index.html      # Webpage entry file\n├── package.json        # Project dependencies\n├── vercel.json         # Vercel configuration file\n└── README.md           # Project description file\n```\n\n## Quick Start 🚀\n\n### Prerequisites\n\n- [Vercel](https://vercel.com/) account\n- Telegram account and Bot Token\n- [Upstash](https://upstash.com/) Please select the Redis database and enable the [Eviction](https://upstash.com/docs/redis/features/eviction) feature\n- API key for at least one AI service\n\n### Deployment Steps\n\n1. Clone the repository:\n   ```bash\n   git clone https://github.com/snakeying/GPT-Telegram-Bot.git\n   cd GPT-Telegram-Bot\n   ```\n\n2. Install dependencies:\n   ```bash\n   npm install\n   ```\n\n3. Configure environment variables:\n   Create a `.env` file and fill in the necessary configuration information (refer to the environment variable configuration below).\n\n4. Deploy to Vercel:\n   - Fork this repo\n   - Modify according to the instructions at the bottom of the readme\n   - Click the \"Deploy with Vercel\" button\n   - Connect your GitHub repository\n   - Configure environment variables\n   - Complete deployment\n\n5. Set up Telegram Webhook:\n   After deployment, use the following URL to set up the Webhook:\n   ```\n   https://api.telegram.org/bot\u003cYOUR_BOT_TOKEN\u003e/setWebhook?url=\u003cYOUR_VERCEL_DOMAIN\u003e/api/telegram\n   ```\n\n## Environment Variable Configuration 🔧\n\nBefore 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:\n\n| Variable Name | Description | Default Value |\n|--------|------|--------|\n| `OPENAI_API_KEY` | OpenAI API key | - |\n| `OPENAI_BASE_URL` | OpenAI API base URL | https://api.openai.com/v1 |\n| `OPENAI_MODELS` | OpenAI models to use (comma-separated) | - |\n| `DEFAULT_MODEL` | Default model to use | First model in OPENAI_MODELS |\n| `AZURE_OPENAI_API_KEY` | Azure OpenAI API key | - |\n| `AZURE_OPENAI_ENDPOINT` | Azure OpenAI endpoint | - |\n| `AZURE_OPENAI_MODELS` | Azure OpenAI models to use (comma-separated) | - |\n| `TELEGRAM_BOT_TOKEN` | Telegram Bot Token | - |\n| `WHITELISTED_USERS` | Allowed user IDs (comma-separated) | - |\n| `DALL_E_MODEL` | DALL-E model to use | dall-e-3 |\n| `UPSTASH_REDIS_REST_URL` | Upstash Redis REST URL | - |\n| `UPSTASH_REST_TOKEN` | Upstash Redis REST Token | - |\n| `SYSTEM_INIT_MESSAGE` | System initialization message | You are a helpful assistant. |\n| `SYSTEM_INIT_MESSAGE_ROLE` | System message role | system |\n| `GEMINI_API_KEY` | Google Gemini API key | - |\n| `GOOGLE_MODELS` | Google models to use (comma-separated) | - |\n| `GEMINI_ENDPOINT` | Gemini API endpoint | https://generativelanguage.googleapis.com/v1beta/models |\n| `GROQ_API_KEY` | Groq API key | - |\n| `GROQ_MODELS` | Groq models to use (comma-separated) | - |\n| `MAX_HISTORY_LENGTH` | Maximum history length | 50 |\n| `CLAUDE_API_KEY` | Anthropic Claude API key | - |\n| `CLAUDE_MODELS` | Claude models to use (comma-separated) | - |\n| `CLAUDE_ENDPOINT` | Claude API endpoint | https://api.anthropic.com/v1/chat/completions |\n\nMake sure to add these environment variables to your project's environment configuration when deploying to Vercel or other platforms.\n\n## Usage Guide 📖\n\n- `/start` - Initialize the bot\n- `/new` - Start a new conversation\n- `/history` - View conversation history summary\n- `/help` - Get help information\n- `/switchmodel \u003cmodel name\u003e` - Switch AI model\n- `/img \u003cdescription\u003e [size]` - Generate image\n- `/language \u003clanguage code\u003e` - Switch interface language\n- Send an image for analysis\n- Send a message directly for conversation\n\nSupported languages (use /language command):\n- English (en)\n- Simplified Chinese (zh-cn)\n- Traditional Chinese (zh-hant)\n- Japanese (ja)\n- Spanish (es)\n- French (fr)\n- Russian (ru)\n- German (de)\n\n## Notes ⚠️\n\n- Use API quotas reasonably, especially when using image features 💸\n- Securely store environment variables and API keys 🔒\n- Different AI models may have different features and limitations 🔄\n- Regularly check and update dependencies to ensure security and performance 🔧\n\n## Contribution 🤝\n\nWelcome to submit Pull Requests or open Issues to improve this project! Your contributions will make this AI assistant more powerful and interesting.\n\n## License 📜\n\nThis project is licensed under the [MIT License](https://choosealicense.com/licenses/mit/).\n\n---\n\nAbout the \"Deploy to Vercel\" button:\nThis button provides a one-click deployment to Vercel, which is very convenient. However, please note:\n\n1. The link in the button points to the original repository (https://github.com/snakeying/GPT-Telegram-Bot).\n2. If you've forked this project and want to deploy your own version, you need to update this button link in the README.\n3. Update method: Replace `snakeying/GPT-Telegram-Bot` in the link with your GitHub username and repository name.\n\nFor example, if your GitHub username is \"yourname\", you should change the button link to:\n\n```markdown\n[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fyourname%2FGPT-Telegram-Bot)\n```\n\nThis ensures that the \"Deploy to Vercel\" button will deploy your forked version, not the original repository.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsnakeying%2Fgpt-telegram-bot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsnakeying%2Fgpt-telegram-bot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsnakeying%2Fgpt-telegram-bot/lists"}