Support the project by buying and listening to my music ๐ต
- Bandcamp
- Spotify
- Other platforms (Latest album)
- YouTube (Updates rarely)
- SoundCloud (Updates rarely)
- ChatGPT (ChatGPT by OpenAI): https://chat.openai.com/chat
- DALLE (DALLE by OpenAI): https://openai.com/dall-e-2/
- acheong08/ChatGPT (API): https://github.com/acheong08/ChatGPT
- python-telegram-bot (Telegram bot API): https://github.com/python-telegram-bot/python-telegram-bot
- Install Python and pip
- Download source code
- Install requirements
pip install -r requirements.txt --upgrade
- For API type 3 (recommended) (revChatGPT API V3, official chatGPT API):
- Set
chatgpt_api_type
to3
inmodules
insettings.json
file - Generate API Key https://platform.openai.com/account/api-keys and paste it into
api_key
inchatgpt_auth
insettings.json
file - Configure proxy if needed in
proxy
insettings.json
file
- Set
- For API type 1 (revChatGPT API V1, free, uses same model as official website):
- Set
chatgpt_api_type
to1
inmodules
insettings.json
file - Make sure you have access to https://chat.openai.com/
- Open https://chat.openai.com/api/auth/session
- Copy value of
accessToken
intoaccess_token
inchatgpt_auth
inchatgpt_api_1
insettings.json
file - Configure proxy if needed in
proxy
insettings.json
file
- Set
- For API type 0 (revChatGPT API V0, Official API, more "stupid" model, uses credits):
- Set
chatgpt_api_type
to0
inmodules
insettings.json
file - Generate API Key https://platform.openai.com/account/api-keys and paste it into
api_key
inchatgpt_auth
insettings.json
file - Configure proxy if needed in
proxy
insettings.json
file
- Set
- For DALL-E, generate API Key https://platform.openai.com/account/api-keys
- Type Generated OpenAI API Key into
open_ai_api_key
indalle
insettings.json
file - Create bot at https://t.me/BotFather
- Type Bot's token into
api_key
intelegram
insettings.json
file - Run main script
python main.py
Example settings.json
:
{
"modules": {
"chatgpt": true,
"chatgpt_api_type": 1,
"dalle": true
},
"chatgpt_auth": {
"api_key": "sk-XxxxxxxXXxXXXxxXXXxxXXXXXXXXXXXxxxxxxxxxxxxxxxXX",
"engine": "",
"email": "",
"password": "",
"session_token": "",
"access_token": "XXxXxXx........XxxXXx",
"base_url": ""
},
"proxy": {
"enabled": false,
"auto": true,
"manual_proxy": "",
"https_only": true,
"proxy_checks_enabled": true,
"check_interval_seconds": 600,
"check_message": "1+1",
"check_message_timeout": 240,
"check_reply_must_include": "2",
"max_number_of_processes": 5,
"initialization_timeout": 60,
"too_many_requests_wait_time_seconds": 600
},
"dalle": {
"open_ai_api_key": "sk-XxxxxxxXXxXXXxxXXXxxXXXXXXXXXXXxxxxxxxxxxxxxxxXX",
"image_size": "512x512",
"use_proxy": true
},
"telegram": {
"api_key": "1234567890:XXXxXxxXxxXXxxXXX-XXXXXXXxXxxxXxXxX",
"queue_max": 5,
"show_queue_message": true
}
}
You can edit telegram bot messages by editing file messages.json
. You can add new lines by adding \\n
Note: make shure you don't delete argumensts {0}
in message and please restart script to apply changes
- Install Python and pip
- Clone repo
- Edit
settings.json
- Install systemd
sudo apt-get install -y systemd
- Create new service file
sudo nano /etc/systemd/system/gpt-telegramus.service
[Unit] Description=GPT-Telegramus service After=multi-user.target [Service] Type=simple Restart=always WorkingDirectory=YOUR DIRECTORY HERE/GPT-Telegramus ExecStart=YOUR DIRECTORY HERE/GPT-Telegramus/run.sh RestartSec=5 [Install] WantedBy=multi-user.target
- Reload systemctl daemon
sudo systemctl daemon-reload
- Enable service
sudo systemctl enable gpt-telegramus.service
- Start service
sudo systemctl start gpt-telegramus.service
WARNING: not tested
- Install Docker
- Clone repo
- Build container
docker buildx build -t telegramus --load -f Dockerfile .
- Run the container
docker run -d --name gpt-telegramus --restart on-failure telegramus
Note: You can specify settings and messages files and chats folder location. (default location is in project folder):
docker run -d -e TELEGRAMUS_SETTINGS_FILE="PATH_TO_settings.json" -e TELEGRAMUS_MESSAGES_FILE="PATH_TO_messages.json" -e TELEGRAMUS_CHATS_DIR="PATH_TO_chats_DIRECTORY" --name gpt-telegramus --restart on-failure telegramus
It is possible to bypass geo-blocking. GPT-Telegramus includes automatic proxy-list downloading
- Set
enabled
inproxy
insettings.json
totrue
- Restart app and hope for the best.
GPT-Telegramus will have to download the proxy list itself and start trying various proxies (see console for logs). Sometimes trying can take a very long time (Usually up to half of the proxies is at least one that works)
If you have proxy that definitely works you can specify it in manual_proxy
in proxy
in settings.json
.
Make sure you set auto
to false
when using manual_proxy
proxy
settings description:
enabled
- Whether proxy login is enabled.auto
- Download proxies automatically. Otherwise, usemanual_proxy
https_only
- Don't include http proxies in listmanual_proxy
- Manual proxy server. It must support HTTPS, but you need to type it inhttp://IP:PORT
formatproxy_checks_enabled
- Enables automatic periodic proxy check by asking 1+1 questioncheck_interval_seconds
- Automatic connection check interval (in seconds)check_message
- This message will be sent as a requestcheck_message_timeout
- How long should a response take?check_reply_must_include
- The response message must contain this text to consider that the check was successfulmax_number_of_processes
- How many background processes are used for checking proxyinitialization_timeout
- How long to wait for initialization with proxy
/start
- Shows version/help
- Shows list of commands/queue
- Shows requests queue/gpt YOUR REQUEST
- Request to ChatGPT (or just type your request as message without/gpt
command)/draw YOUR REQUEST
- Request to DALLE/clears
- Clears chat history/restart
- Restart chatGPT and Telegram Bot (not tested properly)- Type any message to ask chatGPT (without
/gpt
command)
Chat histories for each telegram chat (to prevent history collision) are stored in chats
directory. You can specify it with env variable TELEGRAMUS_CHATS_DIR
- Conversation IDs will be saved into
chats.json
insidechats
directory.- File
chats.json
savesconversation_id
andparent_id
(for API V1)
- File
- For
"chatgpt_api_type": 3
conversation histories will be saved inconversations
directory insidechats
directory. - For
"chatgpt_api_type": 0
conversation histories will be saved inconversations.json
file insidechats
directory.
To remove conversation use /clear
command in telegram chat
p.s. Might not work properly =)
- Make whitelist for users and admin account