Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/leafduo/chatgpt-telegram-bot
Telegram bot for ChatGPT
https://github.com/leafduo/chatgpt-telegram-bot
chatgpt chatgpt-bot go golang telegram telegram-bot
Last synced: about 2 months ago
JSON representation
Telegram bot for ChatGPT
- Host: GitHub
- URL: https://github.com/leafduo/chatgpt-telegram-bot
- Owner: leafduo
- License: mit
- Created: 2023-03-04T09:34:57.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-07-29T10:38:40.000Z (5 months ago)
- Last Synced: 2024-08-02T00:23:24.315Z (5 months ago)
- Topics: chatgpt, chatgpt-bot, go, golang, telegram, telegram-bot
- Language: Go
- Homepage:
- Size: 122 KB
- Stars: 166
- Watchers: 3
- Forks: 26
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-ai-client - leafduo/chatgpt-telegram-bot - Run your own ChatGPT Telegram bot! (🔧 Others)
- awesome-chatgpt-api - leafduo/chatgpt-telegram-bot
README
# ChatGPT Telegram bot
Run your own ChatGPT Telegram bot!
## Setup
1. Get your OpenAI API key
You can create an account on the OpenAI website and [generate your API key](https://platform.openai.com/account/api-keys).
2. Get your telegram bot token
Create a bot from Telegram [@BotFather](https://t.me/BotFather) and obtain an access token.
3. Install using `go install`
If you have a Go environment, you can install it with the following command:
```bash
go install github.com/leafduo/chatgpt-telegram-bot@latest
```4. Install using binary
You can get prebuilt binaries from [GitHub Releases](https://github.com/leafduo/chatgpt-telegram-bot/releases) and put it in `$PATH`
5. Install using Docker-compose
Check out [docker-compose.yml](docker-compose.yml) for sample config
6. Set the environment variables and run
```bash
export OPENAI_API_KEY=
export TELEGRAM_APITOKEN=
# Optional, default is empty. Only allow these users to use the bot. Empty means allow all users.
export ALLOWED_TELEGRAM_ID=,
# Optional, default is 1.0. Higher temperature means more random responses.
# See https://platform.openai.com/docs/api-reference/chat/create#chat/create-temperature
export MODEL_TEMPERATURE=1.0
# Optional, default is 900. Max idle duration for a certain conversation.
# After this duration, a new conversation will be started.
export CONVERSATION_IDLE_TIMEOUT_SECONDS=900
# Optional, defaults to gpt-3.5-turbo. Specify which model to use.
# Currently, only `gpt-3.5-turbo` and `gpt-4` are supported.
export OPENAI_MODEL=gpt-3.5-turbo
# Optional, defaults to https://api.openai.com.
# You can use this to set a custom OpenAI API endpoint to use third party relay services like https://api2d.com/.
export OPENAI_BASE_URL=https://api.openai.comchatgpt-telegram-bot
```