LibreChat is an open-source chat interface that can connect to multiple AI providers. OpenRouter is an API aggregator that gives you access to 50+ models through a single endpoint.

Connecting them gives your team a self-hosted AI chat that can switch between Claude, GPT-4o, Gemini, Mistral, and open-source models — all managed from one interface, with one API key, and full control over your data.

Quick Answer: Connect OpenRouter to LibreChat by adding OpenRouter as a custom endpoint in LibreChat’s configuration file (.env or librechat.yaml). Set the base URL to https://openrouter.ai/api/v1, add your OpenRouter API key, and list the models you want available. LibreChat treats OpenRouter like an OpenAI-compatible endpoint — the setup takes under 30 minutes.

Why connect these two tools

LibreChat without OpenRouter: You configure each AI provider separately (OpenAI, Anthropic, Google). Each has its own API key, billing, and rate limits to manage. You can’t easily compare models in the same interface.

OpenRouter without LibreChat: You access models programmatically via API. Great for automation, not ideal for team members who want a chat interface without building one.

LibreChat + OpenRouter: One API key manages all models. One billing account. Team members get a familiar chat interface with model switching. You maintain full control of the infrastructure.

This combination is particularly useful for small teams (3–20 people) who want a shared AI chat without paying per-seat for Claude or ChatGPT Enterprise, and who have a team member comfortable running a Docker container.

Prerequisites

  • A server or machine to run LibreChat (VPS, local server, or Docker on a developer’s machine)
  • An OpenRouter API key (free account, load credits as needed)
  • Basic comfort with Docker and environment variables

Step 1 — Install LibreChat

The fastest setup uses Docker Compose. On your server:

git clone https://github.com/danny-avila/LibreChat.git
cd LibreChat
cp .env.example .env

Edit the .env file to set basic configuration:

  • DOMAIN — your server’s IP or domain
  • MONGO_URI — MongoDB connection string (Docker Compose sets this up automatically)
  • JWT_SECRET — a random 32+ character string

Start the stack:

docker compose up -d

LibreChat will be accessible at http://your-server-ip:3080 after about 60 seconds.

Step 2 — Configure OpenRouter as a provider

LibreChat supports OpenRouter via its custom endpoint feature. Two configuration methods:

Method A — Environment variables (simpler)

In your .env file, add:

OPENROUTER_API_KEY=your_openrouter_api_key_here

Then in librechat.yaml, add OpenRouter as a custom endpoint:

endpoints:
  custom:
    - name: "OpenRouter"
      apiKey: "${OPENROUTER_API_KEY}"
      baseURL: "https://openrouter.ai/api/v1"
      models:
        default: ["anthropic/claude-sonnet-4-6", "openai/gpt-4o", "google/gemini-flash-1.5"]
        fetch: true
      titleConvo: true
      titleModel: "anthropic/claude-haiku-4-5-20251001"
      summarize: false
      modelDisplayLabel: "OpenRouter"

models.fetch: true tells LibreChat to fetch the full model list from OpenRouter automatically. models.default sets which models appear by default for new conversations.

Method B — Full model control

If you want to curate exactly which models your team sees (recommended for teams — fewer options reduces decision fatigue):

endpoints:
  custom:
    - name: "OpenRouter"
      apiKey: "${OPENROUTER_API_KEY}"
      baseURL: "https://openrouter.ai/api/v1"
      models:
        default:
          - "anthropic/claude-sonnet-4-6"
          - "anthropic/claude-haiku-4-5-20251001"
          - "openai/gpt-4o"
          - "openai/gpt-4o-mini"
          - "google/gemini-flash-1.5"
          - "mistralai/mistral-small"
        fetch: false
      titleConvo: true
      titleModel: "anthropic/claude-haiku-4-5-20251001"
      modelDisplayLabel: "OpenRouter"

Step 3 — Add HTTP headers for OpenRouter

OpenRouter recommends adding a site URL and app name in headers for usage tracking. In librechat.yaml:

      headers:
        HTTP-Referer: "https://your-team-domain.com"
        X-Title: "Team LibreChat"

This doesn’t affect functionality but helps OpenRouter’s usage analytics for your account.

Step 4 — Restart and verify

After editing configuration:

docker compose restart librechat

Log in to LibreChat. In the model selector, you should see “OpenRouter” as a provider. Select it and choose a model. Send a test message — if it responds, the integration is working.

Team setup considerations

User management

LibreChat has built-in user registration. For a private team instance, disable public registration in .env:

ALLOW_REGISTRATION=false

Create accounts manually for team members via the admin panel, or enable SSO if your team uses an identity provider.

Cost tracking

OpenRouter’s dashboard shows usage by API key. You have one key for the entire LibreChat instance — everyone’s usage is pooled. Load credits in advance and monitor monthly usage to avoid running out.

For cost allocation by team member, OpenRouter doesn’t provide per-user breakdowns for a shared key. If per-user tracking matters, create separate OpenRouter keys and configure separate LibreChat users with different keys — though this adds management overhead.

Model selection for teams

Most teams benefit from a curated model list rather than exposing all 50+ OpenRouter models. Recommend a default (Claude Sonnet for most tasks) and 3–4 alternatives. Too many options creates decision paralysis and inconsistent usage.

For the OpenRouter pricing context that affects your team’s API costs, see the OpenRouter pricing breakdown. The OpenRouter tool page covers broader evaluation criteria.

Frequently Asked Questions

Is LibreChat free to use? LibreChat is open-source and free. Your costs are server infrastructure (typically $5–20/month for a basic VPS) and API usage via OpenRouter.

Can LibreChat handle file uploads and image analysis? Yes — LibreChat supports file uploads for models with vision capabilities (Claude, GPT-4o, Gemini). Enable this in the configuration and ensure you’re routing to a model that supports vision.

Does this work on a home server or is a VPS required? Works on both. A home server requires exposing a port through your router or using a tunnel (ngrok, Cloudflare Tunnel) for external access. A VPS is simpler for team access and has better uptime.

How do I update LibreChat when new versions release?

git pull
docker compose pull
docker compose up -d

LibreChat releases updates frequently. Check the GitHub releases page for breaking changes before updating in production.

What happens if OpenRouter has an outage? All models routed through OpenRouter will be unavailable. If uptime is critical, configure direct provider endpoints (OpenAI, Anthropic) as fallbacks in addition to OpenRouter.


Evaluate OpenRouter for your team

If you’re assessing OpenRouter’s fit for your team’s AI infrastructure — alongside a tool like LibreChat or in other automation contexts — the OpenRouter tool overview covers the practical setup decisions operators face.