Metrics
This document explains how to add a metrics exporter for Prometheus to LibreChat.
Archived documentation
You are reading the frozen documentation for v0.8.7, which is no longer maintained. Go to the latest docs.
General

You can use Prometheus or any other OpenMetrics compatible monitoring tool to get metrics about active usage of LibreChat. This includes technical information like the usage of tokens, but also information about end users like the number of total or active users.
LibreChat also exposes built-in Prometheus metrics from the API server at /metrics when METRICS_SECRET is configured. Scrape it with Authorization: Bearer <METRICS_SECRET>. Browser RUM proxy outcomes are reported as rum_proxy_requests_total{endpoint,result}, where endpoint is traces, logs, or unknown, and result can be success, auth_drop, auth_error, bad_request, not_configured, collector_4xx, collector_5xx, collector_error, or collector_timeout.
The metrics exporter is available at virtUOS/librechat_exporter. It is a separate tool you deploy alongside LibreChat.
Setup
To deploy the exporter, just add the necessary container to your compose configuration like this:
services:
metrics:
image: ghcr.io/virtuos/librechat_exporter:main
depends_on:
- mongodb
ports:
- '8000:8000'
restart: unless-stoppedYou can optionally also configure the exporter. But usually, the defaults should be just fine.
services:
metrics:
environment:
- MONGODB_URI=mongodb://mongodb:27017/
- LOGGING_LEVEL=infoUsage
You can now add the exporter to your Prometheus scrape configuration:
- job_name: librechat
static_configs:
- targets:
- 'librechat.example.com:8000'Once scraping the metrics has started, look for librechat_* metrics (e.g., librechat_registered_users).
The exporter provides several metrics.
Have fun building your Grafana dashboard!
Logging System
This doc explains how to use the logging feature of LibreChat, which saves error and debug logs in the `/api/logs` folder. You can use these logs to troubleshoot issues, monitor your server, and report bugs. You can also disable debug logs if you want to save space.
Meilisearch
Set up Meilisearch to enable conversation search in LibreChat