Installation
Pick a language in the tabs or in the navbar; every tab on the site follows the choice.
pip install opentele2Python 3.8+ · abi3 wheels · works over Telethon
npm install opentele2Node 18+ · subpaths opentele2/mtcute and opentele2/telethon
cargo add opentele2-coreAlso opentele2-browser, opentele2-versions and opentele2-grammers
Requirements
| Python | Node | Rust | |
|---|---|---|---|
| Runtime | Python 3.8 or newer (CPython) | Node 18 or newer | Rust 1.89 or newer, edition 2024 |
| Package | opentele2 on PyPI | opentele2 on npm | opentele2-core, opentele2-browser, opentele2-versions, opentele2-grammers |
| Binary | abi3 wheels (one wheel per platform for every Python from 3.8) and free-threaded 3.14 wheels, for manylinux, musllinux, Windows and macOS | a prebuilt Node-API addon for Windows, macOS and Linux (glibc and musl), x64 and arm64 | built from source by Cargo |
| Dependencies | telethon 1.45 or newer; typing_extensions below Python 3.10 | none; @mtcute/node 0.32+ as an optional peer | grammers 0.11 crates for opentele2-grammers |
| Client library | Telethon | mtcute | grammers |
Install
pip install opentele2The wheel pulls in Telethon. Nothing else is needed: the tdata reader, the device catalogs, the browser networks and the crypto are inside the wheel.
npm install opentele2
# For opentele2/mtcute: the mtcute client, 0.32 or newer
npm install @mtcute/nodeThe root entry point opentele2 holds tdata, sessions, profiles, devices, fingerprint checks,
versions and browser generation. Two subpaths add the client integrations:
opentele2/mtcute: the mtcute string session,initConnectionOptions, the crypto provider and the client flows (QR login with 2FA, session admin, consistency checks). Needs@mtcute/node.opentele2/telethon: Telethon.session+.jsonpairs, written and read with the SQLite bundled in the addon. Needs nothing else.
cargo add opentele2-core # tdata, crypto, sessions, devices, API profiles
cargo add opentele2-browser # browser headers and fingerprints
cargo add opentele2-versions # current official client and browser versions
cargo add opentele2-grammers # grammers 0.11 sessions and connection paramsOptional features:
# Telethon .session files (session::telethon_file::write_session_file / read_session_file),
# over a bundled SQLite
cargo add opentele2-core --features telethon-sqlite
# The client flows over grammers-client: qr_login, sessions, sessions_table,
# terminate_session, run_consistency_checks, tdata_from_client
cargo add opentele2-grammers --features client
cargo add grammers-clientRust crate features
| Crate | Feature | Default | What it adds |
|---|---|---|---|
opentele2-core | parallel | on | batch loads many folders on a dedicated rayon pool; results are identical without it |
opentele2-core | telethon-sqlite | off | Telethon .session files over a bundled SQLite; off so the default core links no C code |
opentele2-grammers | client | off | QR login with 2FA, session admin, consistency checks and tdata from a client, over grammers-client |
opentele2-versions uses blocking HTTP (ureq with rustls) and needs no async runtime.
opentele2-core never depends on grammers; opentele2-grammers is the bridge.
The Telethon crypto bridge
Import opentele2 before telethon. Telethon binds its AES-IGE implementation the first time
telethon.crypto.aes is imported, so opentele2 must register its core-backed cryptg first.
import opentele2 registers the core’s AES-IGE as the top-level cryptg module when no real
cryptg is installed (an installed cryptg stays in charge), and rebinds Telethon’s AES-CTR, PQ
factorisation, SHA-1, SHA-256 and password hashing to the core. The rebinding works whichever of the
two was imported first; only the cryptg registration depends on the order.
import opentele2 # first: registers the core's cryptg
import telethonSee MTProto crypto core for what runs on the core.
Offline imports
Importing the Python package fetches the current official client versions once per process. Set
OPENTELE_NO_FETCH to skip the fetch and use the built-in versions:
OPENTELE_NO_FETCH=1 python main.pyNode and Rust never fetch on import: fetchVersions() and opentele2_versions::fetch_all run
only when called. See Client versions.
Check the install
Each snippet prints the TL schema layer opentele2 advertises, 230.
from opentele2.fingerprint import LAYER
print(LAYER)import { LAYER } from 'opentele2'
console.log(LAYER)fn main() {
println!("{}", opentele2_core::api::LAYER);
}Next: Quick start.