Code Monkey home page Code Monkey logo

telegram-gpt's Introduction

Telegram-GPT

This content is not affiliated with, endorsed, sponsored, or specifically approved by OpenAI and OpenAI is not responsible for it.

I like the web interface when I'm using chatGPT on my computer. On the other hand I never use it on mobile (it's to much work going to web browser, sign-in and chat). So I decide to write a very small Telegram Bot (< 80 LOC) using OpenAI API and aiogram.

Example

⬇️ Deploy

OpenAI offers some free credit for their API ($18.00 in credits for 3 month). This bot use gpt-3.5-turbo endpoint for chat completions which means that requests cost $0.002 per 1k tokens (see blog post). So you can deploy this bot on your machine and enjoy for three month your personal instance of chatGPT.

  1. Clone this repo and go in it: git clone https://github.com/S1M0N38/Telegram-GPT.git && Telegram-GPT
  2. Install dependencies: python -m pip install -r requirements.txt
  3. Create new Telegram Bot obtaining a token (e.g. 2837489710:GJjkajsJFmmjkjDJKSekj00JKKjkjahdja2)
  4. Create new OpenAI API key (e.g. sk-askldj9382kjdklqLlkaj92lLanEREybjae36HSMAnd2iudj)
  5. Create new file .env with the following env variables (use token and api-key obtain from the previous steps)
export TELEGRAM_TOKEN="2837489710:GJjkajsJFmmjkjDJKSekj00JKKjkjahdja2"
export OPENAI_TOKEN="sk-askldj9382kjdklqLlkaj92lLanEREybjae36HSMAnd2iudj"
  1. Load .env and start the bot: source .env && python bot.py

⚡ Usage

Start a conversation with your bot. You can start a new conversation with /start.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.