Router vs Relay

lsbot provides two modes for connecting to chat platforms: router and relay.

Quick Comparison

Featurerouter (Self-hosted)relay (Cloud)
ArchitectureDirect connection to platform APIsConnect to lsbot cloud (bot.lingti.com)
Server neededRequires port forwarding / tunnelNo server needed
PlatformsAll 19 platformsfeishu, slack, wechat, wecom
Data flowUser → Platform → Your PC → AIUser → Platform → Cloud → Your PC → AI

When to use router

Use router 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)
# Run router with any supported platform
lsbot gateway --provider deepseek --api-key sk-xxx \
  --telegram-token 123456:ABC-DEF

lsbot gateway --provider claude --api-key sk-ant-xxx \
  --dingtalk-client-id xxx --dingtalk-client-secret xxx

All 19 platforms are supported in router 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
# Connect to cloud relay - no public server needed
lsbot relay --platform wecom --user-id your-id \
  --provider deepseek --api-key sk-xxx

The cloud relay handles the platform connection for you. Your AI runs locally.

Platform Support by Mode

Platformrouterrelay
DingTalk (钉钉)✅ Stream Mode❌ Not needed*
Feishu (飞书)✅ WebSocket
Slack✅ Socket Mode
WeCom (企业微信)✅ Callback API
WeChat (微信公众号)✅ Cloud only
Telegram
Discord
WhatsApp
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:

DingTalk Server ←WebSocket→ lsbot (running locally)

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

Router (Self-hosted)

User → Platform API → lsbot gateway (your machine) → AI
                    ↑                              ↓
              Direct connection              Response back

You run lsbot gateway locally. The bot connects directly to the platform's API.

Relay (Cloud)

User → Platform → lsbot Cloud (bot.lingti.com) ←WebSocket→ lsbot relay (your machine) → AI

You run lsbot relay locally. The cloud server handles the platform connection and forwards messages to your local instance via WebSocket.

Summary

  • router: 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 = router only