Real-time chat infrastructure for AI-powered apps.
Docs · Quick Start · API Reference · AI Bots
ChatAPI is a self-hosted messaging server for apps where AI participates in conversations. It handles real-time delivery, message history, presence, typing indicators, and LLM streaming — so you focus on your product, not the plumbing.
Users connect over WebSocket. When a message is sent in a room that has a bot, ChatAPI calls your backend webhook to get the system prompt, then calls the LLM and streams the response back token by token. Your backend stays in control of context — RAG results, customer data, escalation logic — without managing a separate agent process.
- Managed AI bots — register a bot with an LLM provider URL; ChatAPI calls the model, streams tokens back via
message.stream.*events, and stores the reply - Real-time messaging — rooms (DM or group) with presence, typing indicators, and at-least-once delivery
- JWT auth — your backend signs tokens, ChatAPI validates them; no vendor accounts, no sessions
- Offline delivery — messages queue for offline users; webhook fires so you can send push notifications
- Escalation support — webhook can return
{"skip": true}to silence a bot when a human agent takes over - Single binary — SQLite included, no external services required
- Portable — swap SQLite → PostgreSQL or local pub/sub → Redis by implementing one interface
Full setup guide, configuration reference, and API docs at docs.chatapi.cloud.
See AI Bots in the docs for a full walkthrough.
Docker Compose, single binary, and reverse proxy setup — see docs.chatapi.cloud/deploy.
Requires Go 1.22+ and gcc (for the SQLite driver).
git clone https://github.com/getchatapi/chatapi.git
cd chatapi
go build -o bin/chatapi ./cmd/chatapi
export JWT_SECRET=$(openssl rand -base64 32)
export ALLOWED_ORIGINS="*"
./bin/chatapiRun tests: go test ./...
MIT — see LICENSE.