Bypass standard 50 MB upload and 20 MB download limits. Stream files up to 2,000 MB (2 GB) directly through Telegram Data Centers with 100% Bot API drop-in compatibility.
curl "https://mtproto-tgbot.mehrnet.com/v1/{app_id}:{app_hash}/bot{token}/getMe"
Get the best of both worlds: standard Bot API convenience with native MTProto high-capacity file handling.
Unlocks Telegram's maximum 2 GB bot file limit for both uploads and downloads without hosting a bulky telegram-bot-api Docker daemon.
Works out-of-the-box with python-telegram-bot, aiogram, grammY, telegraf, or raw HTTP cURL requests.
Zero cold-start login overhead. Auth keys are cached in Worker memory and persisted in Cloudflare D1 SQLite database.
Send files up to 2 GB simply by supplying a remote URL: document=https://example.com/large.zip. The edge pipes it directly to Telegram.
True serverless computing. No monthly container bills, no idle VPS memory charges—you pay only for the milliseconds your requests execute.
Runs on Cloudflare’s 300+ edge data centers worldwide for low latency and high-speed streaming directly into Telegram DCs.
Configure your Telegram credentials and test endpoints directly against mtproto-tgbot.mehrnet.com.
curl "https://mtproto-tgbot.mehrnet.com/v1/123456:0123456789abcdef0123456789abcdef/bot123456789:AAHTestBotTokenExample/getMe"
Simply change the base URL in your favorite Telegram bot framework.
from telegram.ext import ApplicationBuilder
# Configure custom base URL pointing to the MTProto gateway
APP_ID = 123456
APP_HASH = "your_app_hash"
BOT_TOKEN = "your_bot_token"
app = (
ApplicationBuilder()
.token(BOT_TOKEN)
.base_url(f"https://mtproto-tgbot.mehrnet.com/v1/{APP_ID}:{APP_HASH}/bot")
.base_file_url(f"https://mtproto-tgbot.mehrnet.com/v1/{APP_ID}:{APP_HASH}/file/bot")
.build()
)
# You can now upload files up to 2,000 MB!
# context.bot.send_document(chat_id=chat_id, document="https://example.com/2gb_file.iso")
app.run_polling()
import asyncio
from aiogram import Bot, Dispatcher
from aiogram.client.session.aiohttp import AiohttpSession
from aiogram.client.telegram import TelegramAPIServer
APP_ID = 123456
APP_HASH = "your_app_hash"
BOT_TOKEN = "your_bot_token"
# Custom Telegram API server base URL
api_server = TelegramAPIServer.from_base(
f"https://mtproto-tgbot.mehrnet.com/v1/{APP_ID}:{APP_HASH}"
)
session = AiohttpSession(api=api_server)
bot = Bot(token=BOT_TOKEN, session=session)
dp = Dispatcher()
async def main():
await dp.start_polling(bot)
if __name__ == "__main__":
asyncio.run(main())
import { Bot } from "grammy";
const APP_ID = 123456;
const APP_HASH = "your_app_hash";
const BOT_TOKEN = "your_bot_token";
const bot = new Bot(BOT_TOKEN, {
client: {
apiRoot: `https://mtproto-tgbot.mehrnet.com/v1/${APP_ID}:${APP_HASH}`,
},
});
bot.command("start", async (ctx) => {
await ctx.reply("Connected to MTProto edge gateway!");
});
bot.start();
const { Telegraf } = require("telegraf");
const APP_ID = 123456;
const APP_HASH = "your_app_hash";
const BOT_TOKEN = "your_bot_token";
const bot = new Telegraf(BOT_TOKEN, {
telegram: {
apiRoot: `https://mtproto-tgbot.mehrnet.com/v1/${APP_ID}:${APP_HASH}`,
},
});
bot.start((ctx) => ctx.reply("Running on Mehrnet MTProto Gateway"));
bot.launch();
A state-of-the-art serverless architecture eliminating traditional server bottlenecks.
Your client makes standard Telegram Bot API calls to mtproto-tgbot.mehrnet.com.
Checks in-memory L1 cache (0ms). On miss, restores the MTProto session from Cloudflare D1.
Standard calls proxy transparently; files >50MB stream via MTProto WebSockets/TCP.
Uploads 512KB chunks directly using saveBigFilePart up to 2,000 MB.