A high-performance Rust AI gateway. Configure your provider and channel, then run.
Chinese version: README.zh.md
- Features
- Quick Start (Recommended: MiniMax + Telegram)
- Documentation Index
- Runtime Modes
- Configuration Overview
- Optional: Hybrid Memory (SQLite + zvec sidecar)
- HTTP API
- Plugin Extensions (Provider / Channel)
- Local Development
- Performance Smoke Test
- Security Notes (Before Open Source)
- OpenAI-compatible provider abstraction (MiniMax/OpenAI/other compatible APIs)
- Message channels: HTTP + Telegram
- Telegram dual mode:
polling(default) andwebhook(optional) - Telegram streaming replies (incremental updates via
editMessageText) <think>...</think>auto-rendered as collapsible Telegram spoiler content- Memory backends:
sqlite-only(default) andhybrid-sqlite-zvec(optional) - Plugin-style extension API for Provider/Channel/Memory
- Rust (stable recommended)
- Telegram bot token (from
@BotFather) - MiniMax API key (OpenAI-compatible endpoint)
cp .env.realtest.example .env.realtestEdit .env.realtest and fill at least:
MINIMAX_API_KEYTELEGRAM_BOT_TOKEN
./scripts/run_mvp_minimax_telegram.shThis script uses:
- config:
config/xiaomaolv.minimax-telegram.toml - database:
sqlite://xiaomaolv.db - Telegram mode:
polling(no public URL required)
curl -sS http://127.0.0.1:8080/health
curl -sS http://127.0.0.1:8080/v1/channels/telegram/modeThen send a message to your Telegram bot.
After MVP is running, use these docs in order:
docs/real-test-minimax-telegram.md: real MiniMax + Telegram integration (webhook setup/verification included)docs/zvec-sidecar.md: zvec sidecar protocol, startup, compatibility detailsconfig/xiaomaolv.minimax-telegram.toml: recommended MVP configconfig/xiaomaolv.example.toml: generic template for custom provider/channel setupsscripts/perf_smoke.sh: machine sizing smoke test script
- No public URL required
- Service pulls updates via Telegram
getUpdates - Startup calls
deleteWebhookto prevent webhook/polling conflicts
Recommended for public production deployments.
- Enable webhook in config:
[channels.telegram]
enabled = true
bot_token = "${TELEGRAM_BOT_TOKEN}"
mode = "webhook"
webhook_secret = "${TELEGRAM_WEBHOOK_SECRET}"
streaming_enabled = true
streaming_edit_interval_ms = 900- Fill in
.env.realtest:
TELEGRAM_WEBHOOK_SECRETPUBLIC_BASE_URL(public HTTPS URL)
- Register webhook:
set -a
source .env.realtest
set +a
./scripts/set_telegram_webhook.shWebhook endpoint:
POST /v1/telegram/webhook/{webhook_secret}
Default template files:
config/xiaomaolv.example.toml(generic template)config/xiaomaolv.minimax-telegram.toml(MVP template)
Key settings:
- Provider config:
[providers.<name>] - Default provider:
[app].default_provider - Telegram streaming:
streaming_enabled = truestreaming_edit_interval_ms = 900
- Memory mode:
backend = "sqlite-only"(default)backend = "hybrid-sqlite-zvec"(optional)
./scripts/run_mvp_minimax_telegram.sh --hybrid-memory./scripts/run_zvec_sidecar.shDetails: docs/zvec-sidecar.md
Core endpoints:
GET /healthPOST /v1/messagesGET /v1/channels/{channel}/modePOST /v1/channels/{channel}/inboundPOST /v1/channels/{channel}/inbound/{secret}POST /v1/telegram/webhook/{secret}
Example:
curl -X POST http://127.0.0.1:8080/v1/messages \
-H 'content-type: application/json' \
-d '{"session_id":"demo-1","user_id":"u1","text":"hello"}'You can extend xiaomaolv like a classic plugin system:
- Provider: implement
ProviderFactory, register inProviderRegistry - Channel: implement
ChannelFactory, register inChannelRegistry - Custom router boot:
build_router_with_registries(...) - Runtime with background workers:
build_app_runtime_with_registries(...)
Reference tests:
tests/provider_plugin_api.rstests/channel_plugin_api.rstests/telegram_channel_mode.rs
cargo fmt --all
cargo test -- --nocaptureQuickly estimate whether a machine can run xiaomaolv reliably:
./scripts/perf_smoke.shThe script will:
- start a local mock provider (no real AI key needed)
- start
xiaomaolvin release mode - benchmark
/healthand/v1/messages - print throughput, latency, failure rate, and machine sizing hints
Benchmark an already running service:
./scripts/perf_smoke.sh --running http://127.0.0.1:8080Customize load:
MSG_C=32 MSG_N=2000 HEALTH_C=200 ./scripts/perf_smoke.sh- Never commit real secrets (for example
.env.realtest) - Keep
.env.realtest.exampleas your safe template - If any key appeared in local git history, rotate it before publishing