Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pages/docs/configuration/_meta.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@ export default {
azure: 'Azure OpenAI',
docker_override: 'Docker Override',
mod_system: 'Automated Moderation',
langfuse: 'Langfuse Tracing',
banner: 'Banner',
}
63 changes: 63 additions & 0 deletions pages/docs/configuration/langfuse.mdx
Original file line number Diff line number Diff line change
@@ -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:

<OptionTable
options={[
['LANGFUSE_PUBLIC_KEY', 'string', 'Your Langfuse public key.', 'LANGFUSE_PUBLIC_KEY=pk-lf-***'],
['LANGFUSE_SECRET_KEY', 'string', 'Your Langfuse secret key.', 'LANGFUSE_SECRET_KEY=sk-lf-***'],
['LANGFUSE_BASE_URL', 'string', 'The Langfuse API base URL.', 'LANGFUSE_BASE_URL=https://cloud.langfuse.com'],
]}
/>

### 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
```

<Callout type="note" title="Self-Hosted Langfuse">
For self-hosted Langfuse instances, set `LANGFUSE_BASE_URL` to your custom URL (e.g., `http://localhost:3000` for local development).
</Callout>

## 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&timestamp=2026-02-04T13%3A02%3A54.248Z&traceId=57b4aa20a258a2e9e2d1ce2e4eacb21c)
Loading