Skip to main content

Langfuse Cheatsheet

Langfuse is an open-source LLM observability platform offering trace/span tracking, token usage statistics, scoring, prompt version management, and dataset management. Supports self-hosting and cloud with deep LangChain and OpenAI integration.

Updated: 2026-07-20·14 commands

Quick Start

``bash pip install langfuse export LANGFUSE_PUBLIC_KEY=pk-lf-xxx export LANGFUSE_SECRET_KEY=sk-lf-xxx export LANGFUSE_HOST=https://cloud.langfuse.com ``

Core Concepts

Traces represent end-to-end LLM operations. Spans break traces into sub-steps. Generations track LLM calls with prompt/completion tokens. Scores enable human or automated evaluation. Datasets hold test cases for eval runs.

Startup & Modes(12)

CommandLevel
langfuse --help
Show Langfuse CLI help
Basic
pip install langfuse
Install Langfuse Python SDK
Basic
git clone langfuse
Clone Langfuse source
Basic
export LANGFUSE_PUBLIC_KEY
Set Langfuse public key
Basic
export LANGFUSE_SECRET_KEY
Set Langfuse secret key
Basic
export LANGFUSE_HOST
Set Langfuse server URL
Basic
langfuse trace
Create a Langfuse trace
Intermediate
langfuse span
Create a span (sub-step of a trace)
Intermediate
langfuse generation
Track LLM generation (with token counting)
Intermediate
langfuse score
Add a score to a trace
Expert
langfuse prompt
Get managed prompt template from Langfuse
Intermediate
langfuse dataset
Create or get an evaluation dataset
Expert

ai-server(2)

CommandLevel
langfuse server
Start Langfuse local server (Docker)
Intermediate
docker compose langfuse
Start Langfuse with Docker Compose
Intermediate

FAQ

This cheatsheet is compiled from official tool documentation. Last updated: 2026-07-20.