Why self-host LibreChat on a VPS
LibreChat is a chat interface, not an inference engine: its value is to centralize several LLM providers behind a polished UI, with authentication, user management, presets, and a RAG module to chat with your documents. For a company, distributing individual ChatGPT accounts is expensive and scatters the data. With LibreChat on a VPS, you pool access: a single API key per provider, internal accounts that you manage, and all conversation history in your own MongoDB. You decide which models are available, you can plug in a local Ollama for zero-cloud, and you keep full control of the data exchanged.
The concrete benefits of a self-hosted LibreChat
- A single interface for OpenAI, Anthropic, Google and your local models.
- Internal accounts and roles managed by you, without individual subscriptions per employee.
- Conversation history stored in your MongoDB, never with a third party.
- Pooled API keys: a single provider access shared by the whole team.
- Built-in RAG module to query your own documents.
- Fine control over the exposed models and the default parameters.
Hardware and software requirements
LibreChat relies on several services (the app, MongoDB, Meilisearch for search, and the RAG API). Count on 2 vCPU and 4 GB of RAM for a modest team using cloud APIs; move to 4 vCPU / 8 GB if you enable RAG with local embeddings or an Ollama on the same machine. Plan for 15 to 20 GB of disk for MongoDB and the indexes. Docker and Docker Compose are indispensable because LibreChat deploys as a multi-container stack. Add a subdomain (e.g. chat.your-domain.com), port 443 open, and the API keys of the providers you plan to offer.
Deploy LibreChat with Docker, MongoDB and HTTPS
Clone the repository and prepare the config
Over SSH: git clone https://github.com/danny-avila/LibreChat && cd LibreChat. Copy the environment example: cp .env.example .env. The project already provides a docker-compose.yml orchestrating the app, MongoDB and Meilisearch.
Configure the .env
Fill in your keys (OPENAI_API_KEY, ANTHROPIC_API_KEY, etc.), generate the JWT_SECRET and CREDS_KEY secrets, and set ALLOW_REGISTRATION=false if you want to create accounts manually rather than opening registration.
Launch the stack
Start with docker compose up -d. Check that all containers are healthy via docker compose ps. The app listens internally on port 3080.
Configure librechat.yaml (models and RAG)
To add custom endpoints (local Ollama, groq, etc.) or enable RAG, create a librechat.yaml file. For example, point a custom endpoint to http://host.docker.internal:11434/v1 to connect your Ollama.
Set up the reverse proxy
Route chat.your-domain.com to localhost:3080 via Caddy or Nginx, with Let's Encrypt. Enable WebSocket support and increase the timeouts so as not to cut off long streaming responses.
Create the accounts and test
Create the first user, log in, select a model and send a message. If RAG is enabled, upload a document in a conversation and check that the answers rely on it.
LibreChat or AnythingLLM: which to choose?
| Criterion | LibreChat | AnythingLLM |
|---|---|---|
| Main purpose | Multi-provider chat interface | RAG engine over documents |
| Multi-models in one UI | Excellent (OpenAI, Anthropic, Google, local) | Good, but centered on one provider per workspace |
| RAG over documents | Additional module to configure | Core of the product, ready to use |
| Multi-user management | Native accounts and roles | Multi-user mode and partitioned workspaces |
| Deployment architecture | Multi-container stack (Mongo, Meili, RAG) | Single container + vector database |
| Data storage | Self-hosted MongoDB | storage volume + LanceDB/Qdrant |
| Ideal use case | Team conversational assistant | Queryable knowledge base |
| Resource footprint | Heavier (several services) | Lighter at startup |
For a zero-cloud deployment, combine LibreChat with an Ollama hosted on the same VPS: declare a custom endpoint in librechat.yaml pointing to Ollama's OpenAI-compatible API. You thus get LibreChat's ergonomics with 100% local models, without any external key or data leaving the server. Remember to set the proxy timeouts accordingly, as CPU inference is slower.