Lifecycle, authorization, peers, updates, messages, media, sessions, retries, and typed errors remain inspectable Python APIs.
0.1.0 Alpha
MTProto, without the framework tax.
A compact, async-first Telegram client core with explicit state, generated Layer 228 bindings, secure sessions, and bundled Rust acceleration where measurements justify it.
Python 3.13–3.14 · CPython 3.14t · Linux, macOS, Windows · x86-64 and ARM64
One protocol core. Three source languages.
Section titled “One protocol core. Three source languages.”miniproto turns Python intent into Telegram MTProto traffic through a deliberately small boundary: Python owns the public async API and policy, the pinned Telegram schema owns raw request and result shapes, and Rust accelerates measured hot paths without becoming a correctness requirement.
Generated constructors expose Telegram's complete raw surface, with source metadata and cross-linked result and error relationships.
Transport framing, cryptography, and hot TL constructors select native paths when available and verified, then fall back explicitly.
Start from a secure default
Section titled “Start from a secure default”import asyncioimport os
from miniproto import Client, ClientConfig, InMemorySessionStoragefrom miniproto.raw import functions
async def main() -> None: config = ClientConfig( api_id=int(os.environ["MINIPROTO_API_ID"]), api_hash=os.environ["MINIPROTO_API_HASH"], session_storage=InMemorySessionStorage(), ) async with Client(config) as client: await client.sign_in_bot(os.environ["MINIPROTO_BOT_TOKEN"]) me = await client.get_me() telegram_config = await client.invoke(functions.HelpGetConfig()) print(me.id, telegram_config.this_dc)
asyncio.run(main())Credentials stay outside source control. This introductory call uses explicit in-memory storage, so it does not retain the bot authorization after shutdown. Durable sessions use encrypted SQLite storage and require a constructor key or MINIPROTO_SESSION_KEY; the quickstart walks through that boundary before the first persistent authorization.
Connection ownership, replay safety, flood waits, datacenter migration, update recovery, media scheduling, and cancellation behavior are documented as contracts rather than hidden behind a framework.
Native acceleration is capability-checked and benchmarked. The Python surface remains available when a native symbol or wheel is unavailable.
Handwritten guides and generated Python, Telegram, and Rust pages share one local Pagefind index with language, kind, module, namespace, layer, and visibility facets.
`miniproto` is the protocol SDK. Routers, filters, middleware, plugins, commands, and broad application-framework ergonomics belong to the future `mpgram` package.
Choose your route
Section titled “Choose your route”Complete reference, committed with the code
Section titled “Complete reference, committed with the code”The generated Markdown is reviewed and versioned with the source. The website build needs Node.js, Python, and a pinned Rust nightly, but the deployed output is plain static HTML, CSS, JavaScript, and a self-hosted search index.