Configuration Overview
LibreChat offers flexible configuration options through environment variables and YAML configuration files. This section guides you through setting up and customizing your LibreChat instance.Configuration Methods
Environment Variables
Configure server settings, database connections, and API keys through .env file
YAML Configuration
Advanced configuration for endpoints, interface customization, and feature settings
Key Configuration Areas
Server Configuration
Server host address
Server port number
MongoDB connection string
Domain Configuration
Client-facing domain URL
Server domain URL for backend services
Configuration File Locations
Quick Start
Configuration Hierarchy
LibreChat loads configuration in the following priority order:- Environment Variables - Highest priority, set in
.envfile or system environment - YAML Configuration - Settings from
librechat.yaml - Default Values - Built-in defaults when no configuration is provided
Environment variables take precedence over YAML configuration. You can reference environment variables in YAML using
${VARIABLE_NAME} syntax.Configuration Categories
Server & Database
Server & Database
- Server host and port
- MongoDB connection settings
- Redis configuration (optional)
- Session and security settings
AI Endpoints
AI Endpoints
- OpenAI, Anthropic, Google
- Custom endpoints (Groq, Mistral, etc.)
- Azure OpenAI
- AWS Bedrock
- Model configuration
Authentication
Authentication
- Email/password login
- OAuth2 providers (Google, GitHub, Discord, etc.)
- OpenID Connect
- SAML
- LDAP
File Storage
File Storage
- Local storage
- AWS S3
- Firebase Storage
- Azure Blob Storage
- Granular storage strategies
Features
Features
- Search (MeiliSearch)
- RAG (Retrieval-Augmented Generation)
- Web Search
- Speech-to-Text / Text-to-Speech
- Image Generation
- MCP Servers
User System
User System
- Registration settings
- User roles and permissions
- Rate limiting
- Token balance system
- Moderation
Environment-Specific Configuration
- Development
- Production
- Docker
Development configuration for local testing:
.env
Security Considerations
Required Security Configuration
Secret key for JWT token signing. Generate a secure random string:
Secret key for refresh token signing. Use a different value than JWT_SECRET:
Encryption key for stored credentials (32 bytes hex):
Initialization vector for credential encryption (16 bytes hex):
Validation
After configuring LibreChat, you can validate your configuration:Next Steps
AI Endpoints
Configure OpenAI, Anthropic, Google, and custom AI providers
Authentication
Set up OAuth, LDAP, or email authentication
File Storage
Configure S3, Firebase, or local file storage
Environment Variables
Complete reference of all environment variables
Troubleshooting
Server won't start
Server won't start
- Verify MongoDB is running and accessible
- Check
MONGO_URIis correctly formatted - Ensure no other process is using the configured port
- Review server logs for specific error messages
API keys not working
API keys not working
- Verify API keys are valid and have proper permissions
- Check for extra spaces or quotes in
.envfile - Ensure you’ve restarted the server after updating
.env - Some providers require additional configuration in
librechat.yaml
Configuration not loading
Configuration not loading
- Check file paths are correct
- Verify YAML syntax is valid (use a YAML validator)
- Ensure
CONFIG_PATHpoints to the correct file if using custom path - Check file permissions