Skip to content

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

Python intent
Layer 228 schema
Rust fast paths
Packet Loom mark
MTProto

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.

01Python intent

Lifecycle, authorization, peers, updates, messages, media, sessions, retries, and typed errors remain inspectable Python APIs.

02Layer 228 schema

Generated constructors expose Telegram's complete raw surface, with source metadata and cross-linked result and error relationships.

03Measured Rust paths

Transport framing, cryptography, and hot TL constructors select native paths when available and verified, then fall back explicitly.

import asyncio
import os
from miniproto import Client, ClientConfig, InMemorySessionStorage
from 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.

Explicit by design

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.

Fast paths with fallbacks

Native acceleration is capability-checked and benchmarked. The Python surface remains available when a native symbol or wheel is unavailable.

Reference you can search

Handwritten guides and generated Python, Telegram, and Rust pages share one local Pagefind index with language, kind, module, namespace, layer, and visibility facets.

A narrow package boundary

`miniproto` is the protocol SDK. Routers, filters, middleware, plugins, commands, and broad application-framework ergonomics belong to the future `mpgram` package.

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.