View on GitHub:
github.com/sukhrobyangibaev/bmi_1_all-chat-bot

All-Chat-Bot is a powerful open-source Telegram chatbot that brings the latest AI models from multiple providers—OpenAI, Anthropic, Google, Groq, and XAI—right to your Telegram chats. Designed for flexibility and persistent, multi-conversation support, it’s ideal for anyone who wants to experiment with different AI models, keep organized chat histories, and track their AI usage.

asd

Key Features

  • Multi-AI Provider Integration:
    Instantly switch between OpenAI, Anthropic, Google, Groq, and XAI models using simple commands and inline keyboards. Each provider offers a curated list of models for fine-tuned experiences.

asd

  • Persistent Multi-Conversation Support:
    Users can manage multiple conversations, each with its own history and title. Start new chats, rename them, and switch between them—your chat history is always saved in SQLite.

asd

  • User Preferences:
    The bot remembers your preferred AI provider and model, loading them automatically for each session.

  • Rich Telegram Integration:
    Inline keyboards for provider/model selection, conversation switching, and pagination make the experience seamless and interactive.

  • Comprehensive Statistics:
    Track your total messages, usage by provider/model, and recent activity with the /stats command.

asd

  • Robust Error Handling:
    All errors are logged, and users receive friendly error messages for a smooth experience.

Technical Architecture

  • Backend:
    Written in Python using python-telegram-bot for async Telegram API integration.
    SQLite is used for persistent storage of users, conversations, and messages.

  • AI Providers:
    Modular provider classes for OpenAI, Anthropic, Google, Groq, and XAI, each supporting async API calls and model selection.

  • Database:
    Three main tables—users, conversations, and messages—track all user data, chat histories, and preferences.

  • Configuration:
    Uses dotenv for environment-based configuration of API keys and settings.

  • Deployment:
    Supports both webhook and polling modes for flexible deployment.

Example Workflow

  1. User starts the bot:
    Registers the user, loads preferences, and displays a welcome message with current provider/model.
  2. Switching AI providers:
    /switch_ai brings up an inline keyboard to select a provider and model.
  3. Managing conversations:
    /new starts a fresh chat; /conversations lists all chats with pagination; /rename_conversation lets you rename the current chat.
  4. Chatting:
    Any message is sent to the selected AI provider, with full conversation context for better responses.
  5. Viewing stats:
    /stats shows detailed usage analytics.

Technologies Used

  • Python 3
  • python-telegram-bot
  • SQLite
  • AsyncIO
  • REST APIs (for AI provider integration)
  • dotenv

This project showcases how to build a robust, user-friendly, and extensible multi-AI chatbot for Telegram, with persistent storage and advanced conversation management. Perfect for AI enthusiasts, researchers, and anyone who wants to explore the latest in conversational AI—right from Telegram!