Custom Config
Create, mount, and configure the librechat.yaml file for custom AI endpoints and advanced LibreChat settings
What is librechat.yaml?
The librechat.yaml file is LibreChat's main configuration file for custom AI endpoints, model settings, interface options, and advanced features like MCP servers and agents. It is optional -- LibreChat works with sensible defaults if the file does not exist.
Follow the steps below to create the file, mount it for your deployment type, and verify it works.
Setup
Locate or Create the File
Create a new librechat.yaml in your project root (the same directory as your .env file):
You can also copy the example config as a starting point:
Alternative File Path
You can set a custom file path using the CONFIG_PATH environment variable:
Mount the Config File
Docker needs a volume mount to access your librechat.yaml file inside the container.
Copy the example override file:
Edit docker-compose.override.yml and ensure the librechat.yaml volume mount is uncommented:
This uses the docker-compose.override.yml pattern -- Docker Compose automatically merges it with the main docker-compose.yml, so your customizations survive updates.
Verify It Works
Open LibreChat in your browser. If your configuration includes custom endpoints, you should see them in the model selector dropdown.
If the server fails to start, check the logs for validation errors:
Example: Adding OpenRouter
This example walks through adding OpenRouter as a custom endpoint -- one of the most popular configurations.
1. Get an API key from openrouter.ai/keys.
2. Add the key to your .env file:
Environment Variable Name
Use OPENROUTER_KEY, not OPENROUTER_API_KEY. Using OPENROUTER_API_KEY will override the OpenAI endpoint to use OpenRouter as well.
3. Add the endpoint to librechat.yaml:
4. Restart LibreChat (see restart commands above) and select OpenRouter from the model selector.
For the full annotated config file with more endpoint examples, see the example configuration.
Reference
For detailed field-level documentation, see the reference pages below.
AI Endpoints
Compatible AI providers and example endpoint configurations
Object Structure
Complete field reference for every librechat.yaml option
Troubleshooting
Configuration Validation
Configuration Validation
LibreChat exits with an error (exit code 1) if librechat.yaml contains validation errors. This fail-fast behavior catches configuration issues early.
To validate your YAML syntax before restarting, use the YAML Validator or yamlchecker.com.
Server Exits Immediately on Startup
If your server exits immediately after starting, this is likely a configuration validation error.
To diagnose:
- Check server logs:
docker compose logs api - Validate your YAML syntax with the YAML Validator
- Common errors: incorrect indentation, missing colons, unknown keys, invalid values
Temporary workaround (not recommended for production):
Warning
CONFIG_BYPASS_VALIDATION=true causes the server to skip validation and use default configuration. Always fix the validation errors instead.
How is this guide?