Skip to content

reedemus/teleGPT

Repository files navigation

TeleGPT

python-version openai-version license: MIT

A simple Telegram bot example that integrates with OpenAI's ChatGPT with minimal configuration required.

Screenshots

Demo

demo GPT-4 Vision demo

Features

  • run locally using main branch, or
  • deploy to any online server as a Flask app using telebot2 branch
  • added GPT-4-Turbo and GPT-4-Vision models!

Prerequisites

Getting started

Configuration

Customize the configuration by copying .env.example and renaming it to .env, then editing the required parameters as desired:

Parameter Description
OPENAI_API_TOKEN Your OpenAI API key from here
TELEGRAM_API_TOKEN Your Telegram bot's token, obtained using BotFather (see tutorial)
TELEGRAM_BOT_NAME Your Telegram bot's name
PUBLIC_URL Web service provider's URL for your app e.g. https://www.yourapp-heroku.com (only for telebot2 branch)

Installing

Clone the repository and navigate to the project directory:

git clone https://github.com/reedemus/teleGPT.git
cd teleGPT

From Source

  1. Create a virtual environment:
python -m venv venv
  1. Activate the virtual environment:
# For Linux or macOS:
source venv/bin/activate

# For Windows:
venv\Scripts\activate

To deploy bot online, skip to Deploy to web host section.

Run locally on your PC

  1. Install the dependencies using requirements.txt file:
pip install -r requirements.txt
  1. Checkout main branch
git checkout main
  1. Use the following command to start the bot:
python app.py

Deploy to web host

  1. Install the dependencies using requirements.txt file:
pip install -r requirements.txt
  1. Checkout telebot2 branch
git checkout telebot2
  1. Use the following command to start the bot The bot is deployed as a Flask app with gunicorn wsgi server with the command below:
gunicorn wsgi:app

Credits

Disclaimer

This is a personal project and is not affiliated with OpenAI or StabilityAI in any way.

License

This project is released under the terms of the MIT license. For more information, see the LICENSE file included in the repository.