TelePi
Telegram bridge for the Pi coding agent. Send messages to a Telegram bot, get streamed responses from pi CLI. Built on teloxide + tokio. Supports per-chat sessions, voice transcription, image processing, and background service management.
π§ Quick Start Β· π‘ Commands Β· βοΈ Configuration Β· ποΈ Architecture Β· π§ Building
Quick Start
# Install from crates.io
# Create config
# Run
Or run as a background service:
Commands
CLI
| Command | Description |
|---|---|
telepi start |
Start the Telegram bot (default) |
telepi gateway start |
Install and start as background service |
telepi gateway stop |
Stop the background service |
telepi gateway restart |
Restart the background service |
telepi status |
Show version, config, service status |
telepi setup |
Show config template |
Telegram Bot
| Command | Description |
|---|---|
/start, /help |
Welcome message and command list |
/new |
Create a fresh session |
/sessions |
List and switch sessions |
/handback |
Resume session in terminal |
/abort |
Cancel running operation |
/retry |
Re-send last prompt |
/model |
Show/set current AI model |
/context |
Show session stats |
/tree |
View conversation tree |
Configuration
TelePi loads config from (in order of priority):
TELEPI_CONFIGenvironment variable./telepi.toml(current directory)~/.config/telepi/config.toml
Environment variables override individual TOML fields.
# HTTP proxy for Telegram API (http/https/socks5)
= "http://127.0.0.1:7890"
# Log level: trace, debug, info, warn, error
= "info"
[]
= "your-bot-token"
= [123456789]
[]
= "summary" # all, summary, errors-only, none
[]
= "openai-whisper" # openai-whisper, parakeet, sherpa-onnx
[]
= false
= 5
Architecture
βββββββββββββββββββββββββββββββββββββββββββββββ
β Telegram β
ββββββββββββββββββββ¬βββββββββββββββββββββββββββ
β
ββββββββββββββββββββΌβββββββββββββββββββββββββββ
β Bot Layer β
β commands/ handler state transport β
β prompt_inbox/ model picker streaming β
ββββββββββββββββββββ¬βββββββββββββββββββββββββββ
β PiSession trait
ββββββββββββββββββββΌβββββββββββββββββββββββββββ
β Session Layer β
β CliSession (CLI subprocess + JSON stream) β
β SessionRegistry (per-context isolation) β
ββββββββββββββββββββ¬βββββββββββββββββββββββββββ
β
ββββββββββββββββββββΌβββββββββββββββββββββββββββ
β Support Modules β
β config paths error install voice formatβ
βββββββββββββββββββββββββββββββββββββββββββββββ
Three-layer design: CLI entry β Bot layer (Telegram handling) β Session layer (Pi agent abstraction). The PiSession trait enables swapping implementations without touching the bot layer.
Building
- Rust β₯ 1.85 (edition 2024)
- No C library required β TelePi is pure Rust
# Debug build
# Release build
# Run tests
# Docker
Features
- Per-chat sessions β isolated conversation state per Telegram chat
- Streaming responses β real-time progress updates as Pi generates output
- Voice transcription β send voice messages, get transcribed and processed
- Image processing β send photos for visual analysis
- Model picker β switch AI models via inline keyboard
- Prompt inbox β inject prompts from filesystem (
.txtpolling) - Background service β launchd (macOS) / systemd (Linux) integration
- Conversation tree β view full session history with box-drawing rendering
License
MIT