Gateway vs Relay
lsbot provides two modes for connecting to chat platforms: gateway and relay.
Quick Comparison
| Feature | gateway (Self-hosted) | relay (Cloud) |
|---|---|---|
| Architecture | Direct connection to platform APIs | Connect to lsbot cloud (bot.lingti.com) |
| Server needed | Requires port forwarding / tunnel | No server needed |
| Platforms | All 19 platforms | feishu, slack, wechat, wecom |
| Data flow | User → Platform → Your PC → AI | User → Platform → Cloud → Your PC → AI |
When to use gateway
Use gateway when:
- You want full control over the connection
- The platform is not supported by relay
- You need to run multiple platforms simultaneously
- You have a server with public IP or use a tunnel (frp, ngrok, Cloudflare Tunnel)
All 19 platforms are supported in gateway mode.
When to use relay
Use relay when:
- You don't have a server with public IP
- You want the easiest setup (no firewall, no tunnel)
- The platform is supported: feishu, slack, wechat, wecom
The cloud relay handles the platform connection for you. Your AI runs locally.
Platform Support by Mode
| Platform | gateway | relay |
|---|---|---|
| DingTalk (钉钉) | ✅ Stream Mode | ❌ Not needed* |
| Feishu (飞书) | ✅ WebSocket | ✅ |
| Slack | ✅ Socket Mode | ✅ |
| WeCom (企业微信) | ✅ Callback API | ✅ |
| WeChat (微信公众号) | ❌ | ✅ Cloud only |
| Telegram | ✅ | ❌ |
| Discord | ✅ | ❌ |
| ✅ | ❌ | |
| LINE | ✅ | ❌ |
| Teams | ✅ | ❌ |
| Others... | ✅ | ❌ |
* DingTalk uses Stream Mode (WebSocket) which is inherently "serverless" — same benefit as cloud relay, so relay is not needed.
Why DingTalk has no relay
DingTalk already supports Stream Mode, a native WebSocket connection that works without a public server:
This achieves the same goal as cloud relay — no need to buy a server or configure a tunnel. Therefore, DingTalk doesn't need relay support.
How each mode works
Gateway (Self-hosted)
You run lsbot gateway locally. The bot connects directly to the platform's API.
Relay (Cloud)
You run lsbot relay locally. The cloud server handles the platform connection and forwards messages to your local instance via WebSocket.
After channels add — which command to run?
lsbot channels add saves platform credentials to ~/.lingti.yaml. After that:
| Platform | Command |
|---|---|
| Telegram, Discord, DingTalk, WhatsApp, LINE, Teams, etc. | lsbot gateway |
| WeCom (企业微信) | lsbot relay --platform wecom |
| WeChat (微信公众号) | lsbot relay --platform wechat |
| Feishu (飞书) | lsbot gateway or lsbot relay --platform feishu |
| Slack | lsbot gateway or lsbot relay --platform slack |
gateway reads all credentials from ~/.lingti.yaml automatically — no extra flags needed:
relay requires --platform because the cloud relay needs to know which platform to connect:
If you've also run lsbot agents add, you don't need --provider or --api-key flags — the default agent's config is used automatically.
Summary
- gateway: Full control, all platforms, may need a server/tunnel
- relay: Easiest setup for supported platforms, no server needed
- DingTalk: Uses Stream Mode = no server needed = gateway only