LibreChat Integration
Connect LibreChat to LLM API for AI-powered capabilities
LibreChat is an open-source, self-hosted AI chat platform that supports multiple providers including OpenAI, Anthropic, Google, and any OpenAI-compatible endpoint. It features multi-model conversations, plugins, and file handling.
LibreChat's configuration file supports custom OpenAI-compatible endpoints, making it easy to add LLM API.
Prerequisites
- An LLM API account with an API key
- LibreChat installed or accessible
Setup
Get Your LLM API Key
- Log in to your LLM API dashboard
- Click Create Key to Start
- Copy your new API key immediately — it will only be shown once
- Store the key securely (e.g., in a password manager or
.envfile)
LLM API is an OpenAI-compatible gateway that gives you access to dozens of AI models through a single API key and endpoint.
Configure LLM API in LibreChat
- Open the librechat.yaml configuration file.
- Add LLM API as a custom endpoint:
endpoints:
custom:
\- name: "LLM API"
apiKey: "\${LLM_API_KEY}"
baseURL: "https://api.llmapi.ai/v1"
models:
default: ["openai/gpt-4o", "anthropic/claude-3-5-sonnet"]- Set the environment variable:
export LLM_API_KEY="your-llm-api-key-here"- Restart LibreChat --- LLM API will appear as a provider in the UI.
Test the Integration
Verify that LibreChat can successfully communicate with LLM API by sending a test request. All requests will now be routed through LLM API.
LibreChat can show multiple providers side by side, letting you compare LLM API models with other services.
Benefits of Using LLM API with LibreChat
- Multi-Provider Access: Use models from OpenAI, Anthropic, Google, and more through a single API
- Cost Control: Track and limit your AI spending with detailed usage analytics
- Unified Billing: One account for all providers instead of managing multiple API keys
- Caching: Reduce costs with response caching for repeated requests
View all available models on the models page.
How is this guide?