XMPP LLM Bridge is a Go service that connects XMPP chat networks with OpenAI's Large Language Models, enabling AI-powered conversations through XMPP clients. The service acts as an intelligent bot that can participate in XMPP conversations by processing incoming messages through OpenAI's API and responding with contextually relevant replies.
- XMPP Integration: Full XMPP client implementation using mellium.im/xmpp library with SASL authentication
- OpenAI LLM Integration: Seamlessly forwards chat messages to OpenAI's API and returns responses
- Configurable: YAML-based configuration with environment variable overrides
- Docker Ready: Containerized deployment with multi-stage builds
The XMPP LLM Bridge can be deployed in several ways. All methods require next essential environment variables:
XMPP_JID: Your bot's XMPP account (e.g.,bot@example.com)XMPP_PASSWORD: Password for the XMPP accountOPENAI_API_KEY: Your OpenAI API key
Pull and run the latest image:
docker run \
-e XMPP_JID=bot@example.com \
-e XMPP_PASSWORD=your_password \
-e OPENAI_API_KEY=sk-your-openai-key \
ghcr.io/mykolabilyi/xmpp-llm-bridge:latestUse this docker-compose.yml:
services:
bridge:
image: ghcr.io/mykolabilyi/xmpp-llm-bridge:latest
environment:
- XMPP_JID=bot@example.com
- XMPP_PASSWORD=your_password
- OPENAI_API_KEY=sk-your-openai-key
restart: unless-stoppedStart the service:
docker compose up -dThe service implements a hexagonal architecture pattern:
- Core Business Logic: Located in
/internal/app/with dependency injection via context-based providers - Ports: Interfaces in
/internal/ports/define contracts for external services - Adapters: External integrations in
/internal/adapters/handle XMPP, OpenAI, and HTTP communications - Entities: Domain models in
/internal/entities/represent core data structures
The application runs two concurrent services:
- XMPP Client: Handles incoming chat messages and processes them through the LLM
- HTTP Server: Provides health check endpoint on port 8080 for monitoring
xc is recommended to simplify running tasks
go run cmd/app/main.gogo test ./...golangci-lint run
yamllint .
echo "# FIXME Markdown linting is not automated yet, please use VSCode extension for that." && exit 1golangci-lint fmtrun: once inputs: TAG env: TAG=dev
docker compose buildinputs: TAG env: TAG=dev
docker compose up