- 🔄 Session Conversion: Convert between Telethon and Pyrogram session formats
- 🔐 String Sessions: Generate portable string sessions from existing session files
- ✅ Session Validation: Verify the validity of session files
- 👤 New Sessions: Create new Telethon or Pyrogram sessions with login
- 🔢 API Management: Easy API credentials handling (file storage or direct input)
- 🖥️ Multi-platform: Works on Windows, macOS, and Linux
- 🎨 User-friendly Interface: Colorful, intuitive console interface
# Clone the repository
git clone https://github.com/yourusername/TGSessionsConverter.git
# Navigate to the project directory
cd TGSessionsConverter
# Install dependencies
pip install -r requirements.txtpip install TGSessionsConverterThe project requires the following dependencies:
| Dependency | Description | Required |
|---|---|---|
| Telethon | Telegram client library for Python | Yes |
| Pyrogram | Modern Telegram client library | Yes |
| tgcrypto | Cryptography for Pyrogram | Yes |
| colorama | Colored terminal output | Optional |
| tqdm | Progress bars | Optional |
| nest_asyncio | Fix asyncio nested event loops | Optional |
| stream-sqlite | Stream SQLite databases | Optional |
The easiest way to use TGSessionsConverter is through its interactive console interface:
python tg_client_converter.pyThis will launch the main menu where you can select various operations:
1. Create new Telethon session (login)
2. Create new Pyrogram session (login)
3. Convert Telethon session to Pyrogram
4. Convert Pyrogram session to Telethon
5. Convert session to String session
6. Check session validity
7. Delete session file
8. Create API credentials file
0. Exit
TGSessionsConverter also offers a command-line interface for automation:
# Convert Telethon session to Pyrogram
python tg_client_converter.py convert --from telethon --to pyrogram --input telethon_session --output pyrogram_session --api-id YOUR_API_ID --api-hash YOUR_API_HASH
# Create a new Telethon session
python tg_client_converter.py login --type telethon --api-id YOUR_API_ID --api-hash YOUR_API_HASH --phone +1234567890
# Check session validity
python tg_client_converter.py check --session session_name --api-id YOUR_API_ID --api-hash YOUR_API_HASH
# Create API credentials file
python tg_client_converter.py config --api-id YOUR_API_ID --api-hash YOUR_API_HASHpython tg_client_converter.py convert --from pyrogram --to telethon --input my_pyrogram_session --output my_telethon_sessionpython tg_client_converter.py convert --from telethon --to string --input my_telethon_sessionpython tg_client_converter.py config| Issue | Solution |
|---|---|
| "Unknown DC ID" error | Make sure your session file is not corrupted and contains valid data |
| SQLite database is locked | Close any applications using the session file and try again |
| Import errors | Ensure all required dependencies are installed |
| Session validation fails | Your session may have expired or been revoked; create a new one |
To enable detailed logging for troubleshooting:
import logging
logging.basicConfig(level=logging.DEBUG)IMPORTANT:
- Session files and string sessions contain authentication data. Keep them secure.
- Never share your API ID, API Hash, or session files with others.
- Creating too many sessions in a short time may result in your account being limited.
- Use this tool responsibly and in accordance with Telegram's Terms of Service.
This project is licensed under the MIT License - see the LICENSE file for details.