LibreChat
Mount a LibreChat custom endpoint configuration and let users provide their own keys.
Install and prepare
Install Git, Docker and Docker Compose, then complete LibreChat’s Docker setup: clone the repository, copy .env.example to .env and start its Compose stack, including MongoDB. Open http://localhost:3080 and register your account. Each user should create their own gateway key at routerra.ai/keys before selecting this endpoint.
git clone https://github.com/LibreChat-AI/LibreChat.git
cd LibreChat
cp .env.example .env
docker compose up -d
Configure the connection
Create librechat.yaml in the repository root using the example below; version is the YAML configuration schema version, not your app version. Mount it as /app/librechat.yaml in the api service through docker-compose.override.yml. With apiKey: user_provided, each signed-in user enters YOUR_API_KEY in LibreChat when selecting routerra.ai; no shared key environment variable is needed. For a shared key instead, use apiKey: "${ROUTERRA_API_KEY}" and add ROUTERRA_API_KEY=YOUR_API_KEY to .env.
version: 1.3.17
endpoints:
custom:
- name: routerra.ai
apiKey: user_provided
baseURL: https://routerra.ai/v1
models:
default: [YOUR_MODEL_ID]
fetch: false
Mount the configuration
Add this volume to docker-compose.override.yml in the repository root, merging it with any existing api overrides.
services:
api:
volumes:
- ./librechat.yaml:/app/librechat.yaml:ro
Select a model and resolve errors
Recreate the stack with docker compose up -d --force-recreate. Choose routerra.ai, enter your key, select YOUR_MODEL_ID and send a short chat. fetch: false uses the explicit default list; change it to true for server model discovery. If the endpoint disappears, check the mount and all required fields (name, baseURL, apiKey, models), YAML indentation and unique name. Read docker compose logs api for startup errors. Configuration edits require a restart.