Skip to content

Repository files navigation

ChatAPI

Real-time chat infrastructure for AI-powered apps.

Go version License Release CI

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.

Features

  • 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

Get started

Full setup guide, configuration reference, and API docs at docs.chatapi.cloud.

See AI Bots in the docs for a full walkthrough.

Deploy

Docker Compose, single binary, and reverse proxy setup — see docs.chatapi.cloud/deploy.

Contributing

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/chatapi

Run tests: go test ./...

License

MIT — see LICENSE.

About

Messaging server for apps where AI participates in conversations

Resources

Contributing

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages