/chatgpt-telegram-bot

🤖 A Telegram bot that integrates with OpenAI's ChatGPT to provide answers, with showing typing status and streaming responses support

Primary LanguagePython

n3d1117 is back! Use this.

Update

2023.3.2 Use official ChatGPT API

A branch for bot to interact with chatgpt official api ( comes with acheong08 )

Configuration

Customize the configuration by create a file named .env, then editing the settings as desired:

OPENAI_API_KEY="<YOUR_OPENAI_API_KEY>"
TELEGRAM_BOT_TOKEN="<YOUR_TELEGRAM_BOT_TOKEN>"
  • OPENAI_API_KEY: Your OpenAI api key. Steps to follow
  1. Create account on OpenAI
  2. Go to https://platform.openai.com/account/api-keys
  3. Copy API key
  • TELEGRAM_BOT_TOKEN: Your Telegram bot's token, obtained using BotFather (see tutorial)

Additional optional configuration values:

OPENAI_MODEL="<ANY_MODEL_AVAILABLE_FROM_OPENAI>" # Defaults to "gpt-3.5-turbo"

Usage

Create a file named docker-compose.yml(same directory as .env)

services:
  chatgpt:
    image: sheepgreen/chatgpt
    container_name: chatgpt
    volumes:
      - ./.env:/home/appuser/.env
    restart: always

Then run docker-compose up -d,that's all!