Hami Kainyفارسی
Work

Astolfo

A self-hosted Telegram persona bot with multi-provider AI routing.

Back to all projects

What it does

Handles text, photos, stickers, video and voice input, with text-only replies. The current system includes a Telegram owner panel, provider failover, persistent model health, usage limits and basic offline replies when APIs are unavailable.

Technical approach

Routing starts with low-cost heuristics; ambiguous messages reach a small dispatcher with cached decisions. A shared client supports thirteen API providers, while provider health, quota handling and spending limits are kept separate from the conversation logic.

System architecture

Telegram input is normalised, routed by cost and health, then answered by an available provider or a basic offline path.

  1. TelegramText and media input
  2. Input handlersPython bot pipeline
  3. ffmpegVoice and video handling
  4. Owner panelControls in Telegram
  5. Routing layerHeuristics and dispatcher
  6. Provider pool13 API providers
  7. Offline pathBasic fallback replies
  8. SQLite stateHealth, cache and limits