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 1 (recommended) (revChatGPT API V1, free, uses same model as official website):
- Create account at OpenAI. 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
- For API type 0 (Official API, more "stupid" model, uses credits):
- Generate API Key https://platform.openai.com/account/api-keys and paste it into
open_ai_api_key
inchatgpt_api_0
insettings.json
file
- Generate API Key https://platform.openai.com/account/api-keys and paste it into
- 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_api_0": {
"open_ai_api_key": "sk-2xxxxxxXXxXXXxxXXXxxXXXXXXXXXXXxxxxxxxxxxxxxxxXX",
"engine": "text-davinci-003",
"proxy": ""
},
"chatgpt_api_1": {
"chatgpt_auth": {
"email": "",
"password": "",
"session_token": "",
"access_token": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.........."
},
"proxy": {
"enabled": true,
"auto": true,
"https_only": true,
"manual_proxy": "http://111.222.123.111:443",
"check_interval_seconds": 300,
"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-2xxxxxxXXxXXXxxXXXxxXXXXXXXXXXXxxxxxxxxxxxxxxxXX",
"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 and not recommended
- Install Docker
- Clone repo
- Build container
docker buildx build -t telegramus --load -f Dockerfile .
- Run the container
docker run -d -e TELEGRAMUS_SETTINGS_FILE=you_settings_file_location -e TELEGRAMUS_MESSAGES_FILE=you_messages_file_location --name gpt-telegramus --restart on-failure telegramus
Note: You can specify settings, messages and chats file location. (default location is in project folder):
ENV TELEGRAMUS_SETTINGS_FILE "settings.json"
ENV TELEGRAMUS_MESSAGES_FILE "messages.json"
ENV TELEGRAMUS_MESSAGES_FILE "chats.json"
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
formatcheck_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)
File chats.json
saves conversation_id
and parent_id
for each telegram chat to prevent history collision
It only works properly if chatgpt_api_type
is set to 1
- Make whitelist for users and admin account