Skip to content
All projects
2024AI superpowers inside any Telegram chat

SakaiBot

A Telegram userbot on your own account: type a slash command in any chat to ask an LLM, translate, summarize/analyze history, generate images, or do voice — with key rotation and provider failover so it never goes down.

Gallery

The problem

Telegram has no built-in AI. SakaiBot runs as a userbot on your own account (via Telethon), so you can drop AI into any conversation — private or group — just by typing a command, instead of copy-pasting into another app.

My role

Built the userbot end-to-end in Python on Telethon — the command routing, the multi-modal handlers, and the resilience layer.

How it works

01Slash command
02Route
03Pick provider / key
04LLM · image · voice
05Edit reply in place

Engineering highlights

Runs on your own account

A Telethon userbot, not a Bot-API bot — so commands work inside any chat you're already in, and it edits your own message in place with the answer.

A toolbox of commands

/prompt (with optional deep-reasoning and web-grounded modes), /translate (with Persian phonetics), /analyze and /tellme over recent chat history, /image, and two-way voice (/tts, /stt).

Stays up under quota limits

Rotates across multiple API keys, fails over Gemini → OpenRouter, and drops from the Pro to the Flash tier when a model is exhausted — with circuit breakers and per-user rate limiting.

A local web control panel

A loopback-only FastAPI panel (bearer-token auth) reuses the same Telethon session, so you can browse chats and run every command from a browser — and it's read-only toward Telegram, so no accidental sends.

Outcomes

  • Brings ask-anything, translate, summarize, image, and voice into any Telegram chat — no extra app.
  • Keeps answering through rate limits and key exhaustion with no manual restarts.