Joshua Opolko

LibreChat: Self-Hosted ChatGPT Alternative With Multi-Provider AI Support

Key takeaways - LibreChat is a free, open-source chat interface that connects OpenAI, Anthropic, Google Gemini, Ollama, Groq, Mistral, Cohere, OpenRouter, and more from a single UI - Docker Compose is the recommended install method: clone the repo, copy .env.example to .env, and run docker compose up -d. The app runs at http://localhost:3080 - All endpoint configuration lives in librechat.yaml; API keys stay in .env and are referenced by variable name - User registration is controlled by the ALLOW_REGISTRATION environment variable, making it easy to lock down a private instance or open it to a team - Local models via Ollama connect using http://host.docker.internal:11434/v1/ as the base URL inside Docker. Ollama must listen on 0.0.0.0, not 127.0.0.1 - Built-in features include file uploads, RAG (retrieval-augmented generation), a code interpreter, image generation, Artifacts, and MCP (Model Context Protocol) support - The current stable release is v0.8.7 (June 24, 2026). The project has over 39,000 GitHub stars and releases roughly every two weeks - Common gotchas: .env changes require a full docker compose down && up restart; librechat.yaml must be explicitly mounted into the container via docker-compose.override.yml

How do I install LibreChat?

Docker Compose is the primary install method and takes about five minutes. You clone the repository, copy the example environment file, and start the containers.

Requirements: Docker 20.10+, Docker Compose v2, Git, and at least 4 GB RAM (8 GB recommended if you plan to run local models).

# Clone the repository
git clone https://github.com/danny-avila/LibreChat.git
cd LibreChat

# Copy the example environment file
cp .env.example .env

# Start LibreChat (pulls images on first run, takes a few minutes)
docker compose up -d

Open http://localhost:3080 once the containers are up. The first account you register becomes the admin.

To stop or update:

# Stop
docker compose down

# Update to the latest release and restart
docker compose pull && docker compose up -d

Apple Silicon (M1/M2/M3) note: The default MongoDB 7/8 image requires AVX CPU instructions that M-series chips lack. Before running docker compose up, create a docker-compose.override.yml in the project root:

services:
  mongodb:
    image: mongo:4.4.18

Then start normally. The rest of the setup is identical.

How do I configure AI providers in LibreChat?

LibreChat reads AI provider configuration from librechat.yaml in the project root. Sensitive values like API keys go in .env and are referenced in the YAML by variable name.

Step 1: Create the config file:

touch librechat.yaml

Step 2: Add your providers:

version: 1.3.5
cache: true

endpoints:
  openAI:
    apiKey: "${OPENAI_API_KEY}"
    models:
      default: ["gpt-4o", "gpt-4o-mini", "o1", "o1-mini"]
      fetch: true

  anthropic:
    apiKey: "${ANTHROPIC_API_KEY}"
    models:
      default: ["claude-opus-4-5", "claude-sonnet-4-5", "claude-haiku-3-5"]

  google:
    apiKey: "${GOOGLE_API_KEY}"
    models:
      default: ["gemini-2.5-pro", "gemini-2.5-flash"]
      fetch: true

  custom:
    - name: "Groq"
      apiKey: "${GROQ_API_KEY}"
      baseURL: "https://api.groq.com/openai/v1/"
      models:
        default: ["llama3-70b-8192", "mixtral-8x7b-32768"]
        fetch: true
      modelDisplayLabel: "Groq"

    - name: "OpenRouter"
      apiKey: "${OPENROUTER_KEY}"
      baseURL: "https://openrouter.ai/api/v1"
      models:
        default: ["meta-llama/llama-3-70b-instruct"]
        fetch: true
      modelDisplayLabel: "OpenRouter"

Step 3: Add the corresponding keys to .env:

OPENAI_API_KEY=sk-...
ANTHROPIC_API_KEY=sk-ant-...
GOOGLE_API_KEY=...
GROQ_API_KEY=...
OPENROUTER_KEY=...

Step 4: Mount librechat.yaml into the Docker container. Create docker-compose.override.yml:

services:
  api:
    volumes:
      - ./librechat.yaml:/app/librechat.yaml

Step 5: Restart to apply changes:

docker compose down && docker compose up -d

Check for YAML errors in the API logs if endpoints do not appear: docker compose logs api. LibreChat exits with code 1 on a config validation failure, so errors are easy to spot.

What can LibreChat do that ChatGPT can't?

LibreChat lets you switch between multiple AI providers in a single interface and compare them on the same prompt, which no commercial product offers out of the box.

Multi-provider switching. One UI covers OpenAI, Anthropic Claude, Google Gemini, Groq, Mistral, Cohere, OpenRouter, Ollama, Azure OpenAI, AWS Bedrock, and any OpenAI-compatible API. Switch providers from a dropdown mid-conversation without logging into separate services.

Local models with full privacy. Connect Ollama to run Llama 3, Mistral, Phi-3, CodeLlama, or any locally-running model. Conversations stay on your server and never touch an external API.

Agents and MCP support. LibreChat supports the Model Context Protocol, letting agents call external tools, databases, web search, and custom APIs. You can build agents with dynamic skills directly in the UI.

File uploads and RAG. Upload PDFs, Word documents, images, and spreadsheets. LibreChat indexes them using LangChain and PostgreSQL with PGVector. Ask questions across your documents with the model drawing on the content.

Code interpreter. Run Python code inside conversations without leaving the chat.

Artifacts. LibreChat renders interactive artifacts inline in the chat window, including React components, HTML pages, and SVG diagrams, similar to Claude's native artifact view.

Image generation. DALL-E 3, Stable Diffusion (via API), and other image providers work out of the box.

Full-text chat history search. Search across all your past conversations.

No per-seat subscription. You pay only for the API calls you make to external providers, or nothing at all when using local models.

How do I set up LibreChat for multiple users?

LibreChat supports multi-user setups out of the box. The first account registered automatically becomes the admin. You control who can sign up through environment variables in .env.

Open registration (anyone can create an account):

ALLOW_REGISTRATION=true
ALLOW_EMAIL_LOGIN=true

Closed registration (admin creates accounts manually):

ALLOW_REGISTRATION=false
ALLOW_EMAIL_LOGIN=true

With registration closed, the admin can still add users via the built-in script:

docker compose exec api npm run create-user

Social login via OAuth:

# Google OAuth example
GOOGLE_CLIENT_ID=your-client-id
GOOGLE_CLIENT_SECRET=your-client-secret
GOOGLE_CALLBACK_URL=https://your-domain.com/oauth/google/callback

ALLOW_SOCIAL_LOGIN=true
ALLOW_SOCIAL_REGISTRATION=true

LibreChat also supports GitHub, Discord, and any OpenID Connect provider including Azure AD and AWS Cognito. Each user gets their own conversation history. In the admin panel you can choose whether users supply their own API keys or use keys you provide centrally.

How do I add local models with Ollama?

Ollama connects to LibreChat through the OpenAI-compatible API that Ollama exposes on port 11434. Add an Ollama endpoint to librechat.yaml pointing to http://host.docker.internal:11434/v1/.

Step 1: Pull the models you want on the host machine:

ollama pull llama3
ollama pull mistral
ollama pull codellama

Step 2: Make Ollama listen on all interfaces. On Linux with systemd, add this under [Service] in /etc/systemd/system/ollama.service:

Environment="OLLAMA_HOST=0.0.0.0"

Then reload and restart:

sudo systemctl daemon-reload && sudo systemctl restart ollama

Step 3: Add the Ollama endpoint to librechat.yaml:

endpoints:
  custom:
    - name: "Ollama"
      apiKey: "ollama"
      baseURL: "http://host.docker.internal:11434/v1/"
      models:
        default: ["llama3", "mistral", "codellama"]
        fetch: true
      titleConvo: true
      titleModel: "current_model"
      modelDisplayLabel: "Ollama"

The apiKey field is required by the config schema but ignored by Ollama. Any placeholder string works. Setting fetch: true means LibreChat will auto-discover new models you pull without editing the config again.

Step 4: Restart LibreChat:

docker compose down && docker compose up -d

How do I expose LibreChat on the internet?

Put LibreChat behind a reverse proxy with HTTPS. A minimal Caddy configuration (Caddy handles TLS automatically via Let's Encrypt):

librechat.yourdomain.com {
    reverse_proxy localhost:3080
}

Or with Nginx (assuming Certbot has issued a certificate):

server {
    listen 443 ssl;
    server_name librechat.yourdomain.com;

    ssl_certificate /etc/letsencrypt/live/librechat.yourdomain.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/librechat.yourdomain.com/privkey.pem;

    location / {
        proxy_pass http://localhost:3080;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header Host $host;
    }
}

Once behind HTTPS, update these in .env to match your public domain:

DOMAIN_SERVER=https://librechat.yourdomain.com
DOMAIN_CLIENT=https://librechat.yourdomain.com

If this is a public-facing instance, set ALLOW_REGISTRATION=false unless you intend it to be open to anyone.

Common problems and fixes

  1. Models not appearing after configuring librechat.yaml What you see: The provider dropdown does not show your new endpoint after restarting. What it is: Either librechat.yaml is not mounted into the container, or there is a YAML syntax error that caused the API to reject the config on startup. The fix: Confirm the volume mount exists in docker-compose.override.yml, then check logs with docker compose logs api. LibreChat exits with code 1 on a validation failure and logs the specific error.

  2. Ollama models time out or return connection refused What you see: Selecting an Ollama model returns "connection refused" or the request hangs indefinitely. What it is: Ollama is only listening on 127.0.0.1 (localhost), which Docker containers cannot reach through host.docker.internal. The fix: Set OLLAMA_HOST=0.0.0.0 and restart Ollama. Verify connectivity from inside the container: docker compose exec api curl http://host.docker.internal:11434/api/tags.

  3. MongoDB container exits on startup (AVX error or version mismatch) What you see: The mongodb container exits immediately. Logs mention missing AVX support or a featureCompatibilityVersion error. What it is: MongoDB 7+ requires AVX CPU instructions, which are absent on some virtual machines and all Apple Silicon Macs. The fix: Pin MongoDB to a compatible version in docker-compose.override.yml using image: mongo:4.4.18. For a version mismatch after an upgrade, back up and recreate the data volume with docker compose down -v && docker compose up -d (this removes conversation history, so back up first).

  4. Port 3080 already in use What you see: Docker fails to start with "address already in use" on port 3080. What it is: Another application on the host is bound to that port. The fix: Change the host-side port in docker-compose.override.yml:

services:
  api:
    ports:
      - "3090:3080"

Access LibreChat at http://localhost:3090 instead.

  1. API key changes in .env are not picked up What you see: You add or update a key in .env but LibreChat still returns authentication errors for that provider. What it is: Docker Compose reads environment variables only at container start. A plain docker compose restart does not re-read .env. The fix: Always use docker compose down && docker compose up -d after any .env change.

Frequently asked questions

Is LibreChat free and open source? Yes. LibreChat is released under the MIT license and costs nothing to self-host. You pay only for the API usage of whichever external providers you connect. Local models via Ollama cost nothing beyond the hardware.

What AI providers does LibreChat support? Out of the box: OpenAI (GPT-4o, o1, GPT-5), Anthropic (Claude Haiku, Sonnet, Opus), Google Gemini, Azure OpenAI, AWS Bedrock, Groq, Mistral, Cohere, OpenRouter, and any OpenAI-compatible API including Ollama, LM Studio, and Together AI. New providers are added as custom endpoints in librechat.yaml.

What is the difference between LibreChat and Open WebUI? Both are self-hosted AI chat interfaces, but they focus on different things. LibreChat emphasizes connecting many cloud and local AI providers in one polished UI with enterprise-grade authentication, agents, MCP, and RAG. Open WebUI is more Ollama-native, with a larger community (140k+ GitHub stars versus LibreChat's 39k), stronger pipeline-based extensibility, and tighter team collaboration tools. LibreChat wins on multi-provider breadth; Open WebUI wins for users who primarily want a local-model-first setup.

Does LibreChat support RAG? Yes. Upload documents (PDF, DOCX, TXT, images, and more) into a conversation and LibreChat indexes them using LangChain backed by PostgreSQL with PGVector. A web search plugin is also available for pulling in live information.

Can I let users bring their own API keys? Yes. In the admin panel you can configure LibreChat to let each user enter their own API keys in their profile. Alternatively, supply keys centrally in .env and have all users share them.

Resources

Last updated: June 27, 2026.