diff --git a/pages/docs/configuration/_meta.ts b/pages/docs/configuration/_meta.ts index 3ef27a786..040ddbafb 100644 --- a/pages/docs/configuration/_meta.ts +++ b/pages/docs/configuration/_meta.ts @@ -12,5 +12,6 @@ export default { azure: 'Azure OpenAI', docker_override: 'Docker Override', mod_system: 'Automated Moderation', + langfuse: 'Langfuse Tracing', banner: 'Banner', } diff --git a/pages/docs/configuration/langfuse.mdx b/pages/docs/configuration/langfuse.mdx new file mode 100644 index 000000000..b1954fd06 --- /dev/null +++ b/pages/docs/configuration/langfuse.mdx @@ -0,0 +1,63 @@ +--- +title: Langfuse Tracing +description: This document explains how to integrate Langfuse tracing with LibreChat to get full observability into your AI conversations. +--- + +# Langfuse Tracing + +[Langfuse](https://langfuse.com) is an open-source LLM observability platform that helps you trace, monitor, and debug your LLM applications. By integrating Langfuse with LibreChat, you get full visibility into your AI conversations. + +## Prerequisites + +Before you begin, ensure you have: + +1. A running LibreChat instance (see [Quick Start](/docs/quick_start)) +2. A Langfuse account ([sign up for free](https://cloud.langfuse.com)) +3. Langfuse API keys from your project settings + +## Setup + +Add the following Langfuse-related environment variables to your `.env` file in your LibreChat installation directory: + + + +### Example Configuration + +```sh filename=".env" +# Langfuse Configuration +LANGFUSE_PUBLIC_KEY=pk-lf-*** +LANGFUSE_SECRET_KEY=sk-lf-*** + +# πŸ‡ͺπŸ‡Ί EU Data Region +LANGFUSE_BASE_URL=https://cloud.langfuse.com + +# πŸ‡ΊπŸ‡Έ US Data Region +# LANGFUSE_BASE_URL=https://us.cloud.langfuse.com +``` + + +For self-hosted Langfuse instances, set `LANGFUSE_BASE_URL` to your custom URL (e.g., `http://localhost:3000` for local development). + + +## Restart LibreChat + +After adding the environment variables, restart your LibreChat instance to apply the changes: + +```sh +docker compose down +docker compose up -d +``` + +## See Traces in Langfuse + +Once LibreChat is restarted with Langfuse configured, you will see a new trace for every chat message response in the Langfuse UI: + +![LibreChat example trace](https://langfuse.com/images/cookbook/integration_librechat/librechat-example-trace.png) + +[Link to trace in the Langfuse UI](https://cloud.langfuse.com/project/cloramnkj0002jz088vzn1ja4/traces/57b4aa20a258a2e9e2d1ce2e4eacb21c?observation=06f5341a68d723b1×tamp=2026-02-04T13%3A02%3A54.248Z&traceId=57b4aa20a258a2e9e2d1ce2e4eacb21c)