LibreChat is an open-source ChatGPT-style chat interface that you host yourself. In one interface, you can switch between models from different providers, such as OpenAI, Anthropic, and Google, or connect your own models through Ollama. LibreChat is built for multiple users: each person has their own account and chats. Everything is stored in MongoDB, and Meilisearch handles searches across all chats.
LibreChat does not include a language model. Responses come from the provider whose API key you enter, or from your own Ollama instance.
In this guide, we’ll show you two ways to get started: the easy way with the One-Click App, which gets LibreChat up and running over HTTPS in just a few minutes, and a manual installation with Docker Compose. After that, you’ll add API keys, connect Ollama, and manage users.
Running LibreChat on your own server is worthwhile if:
- you want to use multiple providers in one interface. You can switch between GPT, Claude, Gemini, and local models in the same chat window without needing a separate subscription for each provider.
- you want to give multiple people access. Each person signs in with their own account and sees only their own chats.
- you want to pay based on usage. Instead of fixed monthly subscriptions per person, the provider bills your API key only for what you actually use.
- you want chat histories stored on your server. LibreChat stores chats, accounts, and uploaded files on your VPS. Only what’s needed for each response is sent to the provider.
LibreChat is less suitable if your main goal is to try out local models. Ollama with Open WebUI is easier for that. If you want to chat with your own documents, AnythingLLM is a better fit. If you don’t need a chat interface but want shared API access to many models for your own applications, LiteLLM is the right tool.
The fastest way to get LibreChat is through your VPS’s One-Click Apps. The app is accessible over HTTPS directly through a domain, the administrator account is created during installation, and registration is disabled by default. You don’t need a reverse proxy, certificate, or command line to get started.
- A Linux VPS (Debian or Ubuntu) with One-Click Apps set up. For instructions, see Set up One-Click Apps.
- At least 2 vCPU cores, 2 GB of RAM, and 15 GB of free disk space. The app consists of five containers (LibreChat, MongoDB, Meilisearch, a file-search service, and its database). Together, they use around 0.7 to 1.3 GB of RAM while running, and the images take up around 7 GB of disk space.
- An API key from a provider such as OpenAI, Anthropic, or Google.
- Open your VPS in the ZapX dashboard and switch to the One-Click Apps tab.
- Search for LibreChat in the App catalog and click Install app.
- Use a custom subdomain or zap.cloud is already selected. Leave this option enabled and enter a custom name if needed, for example,
chat. - Open App configuration and enter the email address you want to use to sign in as the administrator in
LIBRECHAT_ADMIN_EMAIL. If you leave it blank, the account will beadmin@example.com. UseAPP_TITLEto change the name displayed at the top of LibreChat. - Click Queue installation.
The initial installation takes a few minutes. Once the app card shows “Online,” LibreChat is ready. At startup, a short-lived helper service (librechat-create-admin) creates the administrator account and then exits. It runs at every startup, but does not modify an existing account.
ALLOW_REGISTRATION is set to false. Nobody can create an account using “Sign up,” even if they know the address. You can create additional accounts with a command; see “Manage users” below. If you set ALLOW_REGISTRATION to true under App environment, anyone with the address can register. Only enable registration briefly and intentionally.
The login details are generated during installation. The app card indicates this with the Login notice.
- Open the app settings (gear icon) and switch to App environment.
- The email address is listed in
LIBRECHAT_ADMIN_EMAIL. You can find the password under Automatically generated values inSERVICE_PASSWORD_ADMIN. Click the eye icon to show it, or the icon next to it to copy it. - Open LibreChat using the Access link and sign in with your email address and password. The account has the Administrator role.
The account is created only once. If you change LIBRECHAT_ADMIN_EMAIL later, no new account will be created, and the displayed address will no longer match your login. To set a new password, use npm run reset-password; see “Manage users” below.
LibreChat uses the other values under Automatically generated values internally. LibreChat uses SERVICE_PASSWORD_64_CREDS and SERVICE_HEX_32_CREDSIV to encrypt the API keys users enter in the interface. You can’t change these values in the panel. Don’t change them on the server either, or the saved keys will no longer be readable.
Update LibreChat in the app settings (gear icon) under App update. Click Check for updates, then install a new version by clicking Apply update. If it says “The app is already up to date.”, there isn’t a newer version in the app catalog yet.
Accounts and chats are stored in the mongodb-data volume, uploaded files and images in librechat-uploads and librechat-images. Back up the entire VPS before an update, for example, using Backups in the dashboard.
The rest of this guide describes a manual installation of LibreChat with Docker Compose, for example, if you don’t use One-Click Apps on your server or want to run LibreChat with Ollama.
- A Linux VPS running Debian or Ubuntu, with SSH access; see First SSH access.
- Docker and Docker Compose (Compose v2); see Install Docker.
- A domain or subdomain whose A record points to your VPS IP address (e.g.
chat.example.com).
| Hardware | Minimum | Recommended |
|---|---|---|
| CPU | 2 vCPU cores | 4 vCPU cores |
| RAM | 2 GB | 4 GB (8 GB or more with Ollama) |
| Storage | 10 GB | 20 GB (40 GB or more with Ollama) |
LibreChat listens on port 3080. Don’t open this port; only SSH and the reverse proxy should be accessible from the outside:
ufw allow OpenSSH
ufw allow 80/tcp
ufw allow 443/tcp
ufw enable
Ports published by Docker with ports: are accessible from the outside even if ufw blocks them. For this reason, bind LibreChat to 127.0.0.1 as shown below. For more information, see Managing the firewall on Linux.
Create a directory and generate the secret keys. These commands write them directly to the .env file without displaying them:
mkdir -p /opt/librechat && cd /opt/librechat
cat > .env <<EOF
DOMAIN_CLIENT=https://chat.example.com
DOMAIN_SERVER=https://chat.example.com
CREDS_KEY=$(openssl rand -hex 32)
CREDS_IV=$(openssl rand -hex 16)
JWT_SECRET=$(openssl rand -hex 32)
JWT_REFRESH_SECRET=$(openssl rand -hex 32)
MEILI_MASTER_KEY=$(openssl rand -hex 32)
ALLOW_REGISTRATION=false
ALLOW_EMAIL_LOGIN=true
ALLOW_SOCIAL_LOGIN=false
NO_INDEX=true
SCHEDULES_SINGLE_PROCESS=true
EOF
chmod 600 .env
printf 'version: 1.2.8\ncache: true\n' > librechat.yaml
Create the docker-compose.yml file alongside it:
services:
librechat:
image: registry.librechat.ai/librechat-ai/librechat-api:v0.8.9
restart: unless-stopped
depends_on:
- mongodb
- meilisearch
ports:
- "127.0.0.1:3080:3080"
env_file: .env
environment:
- HOST=0.0.0.0
- PORT=3080
- MONGO_URI=mongodb://mongodb:27017/LibreChat
- MEILI_HOST=http://meilisearch:7700
volumes:
- ./librechat.yaml:/app/librechat.yaml
- ./images:/app/client/public/images
- ./uploads:/app/uploads
- ./logs:/app/logs
mongodb:
image: mongo:8.0.20
restart: unless-stopped
command: mongod --noauth
volumes:
- ./data-node:/data/db
meilisearch:
image: getmeili/meilisearch:v1.35.1
restart: unless-stopped
environment:
- MEILI_NO_ANALYTICS=true
- MEILI_MASTER_KEY=${MEILI_MASTER_KEY}
volumes:
- ./meili_data:/meili_data
The most important lines:
CREDS_KEYandCREDS_IVencrypt the API keys users enter in the interface. They must be exactly 64 and 32 hexadecimal characters long, respectively, as generated above. Never use example values from the internet.DOMAIN_CLIENTandDOMAIN_SERVERare the full address, includinghttps://, where LibreChat will be accessible.ALLOW_REGISTRATION=falsedisables registration. Create accounts with a command.SCHEDULES_SINGLE_PROCESS=truetells LibreChat that only one instance is running. Without this line, LibreChat 0.8.9 reports an error for scheduled tasks at startup.- MongoDB runs without a password, but is only accessible on the internal Docker network because the service doesn’t publish a port. This is also how it’s configured in LibreChat’s official Compose file.
Start LibreChat:
docker compose up -d
The images take up around 4.5 GB. After startup, LibreChat, MongoDB, and Meilisearch use around 700 MB of RAM.
Create the first account. It will be an administrator:
docker compose exec -w /app librechat npm run create-user
Then set up HTTPS and sign in at https://chat.example.com.
LibreChat listens only on 127.0.0.1:3080. A reverse proxy such as nginx makes it accessible over HTTPS using your domain. For instructions on setting up nginx, see Reverse proxy with nginx. Here’s a suitable server block:
server {
listen 80;
server_name chat.example.com;
client_max_body_size 50M;
location / {
proxy_pass http://127.0.0.1:3080;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_buffering off;
}
}
proxy_buffering off makes model responses appear word by word instead of all at once. Get the certificate with Certbot; see Create an SSL certificate.
All data is stored in the project folder: accounts and chats in data-node, the search index in meili_data, files in uploads and images, as well as .env and librechat.yaml. For a simple backup, briefly stop LibreChat and archive the folder:
cd /opt/librechat
docker compose stop
tar -czf /root/librechat-backup-$(date +%F).tar.gz -C /opt librechat
docker compose start
The .env file contains your keys, so store the backup securely.
Enter the new version in docker-compose.yml. You can find it under Releases, for example, librechat-api:v0.8.10. Read the release notes first, then run:
cd /opt/librechat
docker compose pull
docker compose up -d
Only change the Meilisearch version if the official docker-compose.yml for the new LibreChat version specifies a newer one. Back up the project folder first.
By default, OpenAI, Anthropic, Google, and Assistants are set to user_provided. Each person then enters their own key: open the model selector in the top-left, click the gear icon next to the provider, enter the API key, and choose how long it should remain valid.
If you want one key to apply to everyone, enter it centrally: for the One-Click App, under App environment, use SERVICE_OPENAI_API_KEY, SERVICE_ANTHROPIC_API_KEY, or SERVICE_GOOGLE_API_KEY; for a manual installation, add OPENAI_API_KEY, ANTHROPIC_API_KEY, or GOOGLE_KEY to .env, then run docker compose up -d.
A shared key applies to all accounts. The provider bills everything your users write to this key. Set a spending limit with the provider.
Connect Ollama as a custom endpoint in librechat.yaml. For a manual installation, add an ollama service without ports: to docker-compose.yml. This makes the Ollama API accessible only to LibreChat:
ollama:
image: ollama/ollama
restart: unless-stopped
volumes:
- ./ollama:/root/.ollama
Then add this to librechat.yaml:
version: 1.2.8
cache: true
endpoints:
custom:
- name: "Ollama"
apiKey: "ollama"
baseURL: "http://ollama:11434/v1/"
models:
default: ["llama3.2:3b"]
fetch: true
titleConvo: true
titleModel: "current_model"
modelDisplayLabel: "Ollama"
Download the model with docker compose exec ollama ollama pull llama3.2:3b and restart LibreChat with docker compose restart librechat. Ollama will then appear in the model selector. For information about which models work well on a VPS without a graphics card, see the Ollama guide.
For the One-Click App, librechat.yaml is located on the VPS at /data/coolify/services/APP_UUID/librechat.yaml. Add the endpoint there in the same way, then restart the app from its app card. However, the Ollama API for the “Ollama with Open WebUI” One-Click App is only accessible internally. For the One-Click App, enter an OpenAI-compatible endpoint that’s accessible over HTTPS with a key, such as a LiteLLM endpoint.
Create additional accounts from the command line inside the LibreChat container. This also works when registration is disabled. You need to specify the /app directory with -w /app because the commands are located there.
For the One-Click App, connect to your VPS over SSH; see First SSH access. Then find the container name:
docker ps --format '{{.Names}}' | grep '^librechat-'
Use the name without create-admin, for example, librechat-APP_UUID, and create the account:
docker exec -it -w /app librechat-APP_UUID npm run create-user
For a manual installation, the command is docker compose exec -w /app librechat npm run create-user. It will ask for an email address, name, username, and password. If you leave the password blank, LibreChat generates one and displays it. Answer Y to the question about whether the email has been verified. New accounts are assigned the User role.
There are other commands in the same directory:
| Command | Purpose |
|---|---|
npm run list-users | list all accounts |
npm run reset-password | reset an account password |
npm run ban-user | ban an account |
npm run delete-user | delete an account and its data |
- No password reset by email. Without email delivery configured, password resets by email are disabled, and
ALLOW_PASSWORD_RESETis set tofalse. Reset passwords withnpm run reset-password. - File search requires OpenAI. The service that searches uploaded files to answer questions uses OpenAI for embeddings in the One-Click App. A key entered in the interface isn’t enough; it must be set in
SERVICE_OPENAI_API_KEY. This service isn’t included in the manual installation described above. - No graphics card. Local models run on the CPU on a VPS and respond much more slowly than the large providers’ models.
With LibreChat, you get your own chat interface for multiple models and users. The fastest way to get started is with the One-Click App: enter the admin email address in the installation form, sign in with the generated password, and add API keys. Registration is disabled from the start. Manual installation is worthwhile if you want to run LibreChat and Ollama together in one project.
