Langfuse

Redirect Langfuse traces to Respan with OTEL instrumentation.
  1. Sign up — Create an account at platform.respan.ai
  2. Create an API key — Generate one on the API keys page
  3. Add credits or a provider key — Add credits on the Credits page or connect your own provider key on the Integrations page

Add the Docs MCP to your AI coding tool to get help building with Respan. No API key needed.

1{
2 "mcpServers": {
3 "respan-docs": {
4 "url": "https://mcp.respan.ai/mcp/docs"
5 }
6 }
7}

What is Langfuse?

Langfuse is an open-source LLM observability platform. The Respan instrumentor patches Langfuse’s OTLP exporter to redirect traces to Respan — your existing @observe decorators and langfuse.trace() calls continue to work unchanged.

Example project: GitHub Link

Setup

1

Install packages

$pip install langfuse respan-instrumentation-langfuse
2

Set environment variables

$export RESPAN_API_KEY="YOUR_RESPAN_API_KEY"
$export LANGFUSE_PUBLIC_KEY="YOUR_LANGFUSE_PUBLIC_KEY"
$export LANGFUSE_SECRET_KEY="YOUR_LANGFUSE_SECRET_KEY"
3

Instrument before importing Langfuse

LangfuseInstrumentor().instrument() must be called before importing langfuse. The instrumentor patches the OTLP exporter at import time.

1import os
2from respan_instrumentation_langfuse import LangfuseInstrumentor
3
4# Instrument BEFORE importing langfuse
5LangfuseInstrumentor().instrument()
6
7# Now import and use langfuse normally
8from langfuse.decorators import observe
9from openai import OpenAI
10
11client = OpenAI()
12
13@observe()
14def generate_joke():
15 response = client.chat.completions.create(
16 model="gpt-4o-mini",
17 messages=[{"role": "user", "content": "Tell me a joke about AI"}],
18 )
19 return response.choices[0].message.content
20
21@observe()
22def joke_pipeline():
23 joke = generate_joke()
24 return joke
25
26result = joke_pipeline()
27print(result)
4

View your trace

Open the Traces page to see your Langfuse traces in Respan.

Langfuse trace in Respan

Configuration

See the Langfuse Instrumentor SDK reference for the full API.