An open API service indexing awesome lists of open source software.

https://github.com/ababaee1/llm_api_telegram_bot

Python Telegram bot with Large Language Models (OpenAI) integration for dynamic conversations.
https://github.com/ababaee1/llm_api_telegram_bot

large-language-models openai python-bot telegram-bot-api

Last synced: about 2 months ago
JSON representation

Python Telegram bot with Large Language Models (OpenAI) integration for dynamic conversations.

Awesome Lists containing this project

README

          

# Telegram Bot with OpenAI

A simple Telegram bot that chats using OpenAI's Large language model (LLM) ! THe code can be also used for any other LLM like claude or gemini ai with slight changes.

Follow these steps to set it up and start chatting.

## 🚀 Features

- Connects directly to OpenAI's API for dynamic responses.
- Easy setup with minimal configuration.

## 🛠 Setup

### 1. Create Your Telegram Bot
- Message [BotFather](https://core.telegram.org/bots#botfather) on Telegram, send `/newbot`, and follow the steps.
- Copy your bot's token.

### 2. Get OpenAI API Key
- Sign up at [OpenAI](https://openai.com/) and grab an API key from the API keys section. (there is a free trial credits I believe)

### 3. Clone This Project
```bash
git clone https://github.com/ababaee1/LLM_API_Telegram_bot.git
cd LLM_API_Telegram_bot
```
### 4. Install Requirements
pip install -r requirements.txt

### 5. Set Up Environment Variables
enter the token values.

TELEGRAM_BOT_TOKEN=your_telegram_token
OPENAI_API_KEY=your_openai_key

### 6. 🚲 Run the Bot
python bot.py