wzgram
wzgram: The Fastest Telegram Library
wzgram is a modern, asynchronous MTProto framework for Python. It works with Telegram’s main API as a user account or as a bot. It is a drop-in replacement for Pyrogram, updated for the latest Telegram features and built for speed.
#1 on the Speed Benchmark
wzgram holds first place on tglib-bench, a public benchmark of Telegram client libraries. The test moves a 2 GB file over Telegram’s DC1.
| # | Library | Download | Upload |
|---|---|---|---|
| 1 | wzgram | 19.5 MB/s | 20.3 MB/s |
| 2 | MTKruto | 17.6 MB/s | 17.3 MB/s |
| 3 | mtcute | 17.7 MB/s | 17.0 MB/s |
| 4 | PyrogramMod | 16.7 MB/s | 17.1 MB/s |
| 5 | TDLib | 17.1 MB/s | 16.8 MB/s |
wzgram beats libraries written in faster languages than Python, including TDLib, Telegram’s own C++ library.
Key Features
- Drop-in replacement:
from pyrogram import ...resolves to the same module, so existing Pyrogram code runs unchanged. - Up to date: supports Gifts, Stories, Topics, Business Accounts, Giveaways and the latest Telegram layer.
- Async native:
async/awaitthroughout, withapp.run()for simple scripts. - Type-hinted: every type and method is annotated for good editor support.
- Fast crypto: powered by WarpCrypto, my Rust rewrite of TgCrypto.
Try It
pip install wzgram
from wzgram import Client, filters
app = Client("my_account")
@app.on_message(filters.private)
async def hello(client, message):
await message.reply("Hello from wzgram!")
app.run()