Langfuse pricing
Quick answer
Langfuse offers a free tier with limited usage for AI API observability and tracing. Paid plans scale based on usage, including the number of tracked requests and data retention, with detailed pricing available on the official Langfuse website. Use the Langfuse Python SDK to integrate and monitor costs effectively.
PREREQUISITES
Python 3.8+Langfuse API keypip install langfuse
Setup
Install the langfuse Python package and set your API keys as environment variables to start tracking AI API usage and costs.
pip install langfuse Step by step
Use the Langfuse client to initialize with your API keys and start tracing your AI API calls. This example shows basic initialization and a traced function call.
import os
from langfuse import Langfuse
from langfuse.decorators import observe
langfuse = Langfuse(
public_key=os.environ["LANGFUSE_PUBLIC_KEY"],
secret_key=os.environ["LANGFUSE_SECRET_KEY"],
host="https://cloud.langfuse.com"
)
@observe()
def call_ai_model(prompt: str) -> str:
# Simulate AI call
return f"Response to: {prompt}"
result = call_ai_model("Hello Langfuse pricing")
print(result) output
Response to: Hello Langfuse pricing
Common variations
You can customize Langfuse usage by enabling auto-tracing for OpenAI calls or integrating with other AI SDKs. Adjust your plan based on volume and retention needs.
from langfuse.openai import openai # drop-in replacement for OpenAI SDK
client = openai.OpenAI(api_key=os.environ["OPENAI_API_KEY"])
response = client.chat.completions.create(
model="gpt-4o-mini",
messages=[{"role": "user", "content": "Hello"}]
)
print(response.choices[0].message.content) output
Hello
Troubleshooting
- If you see authentication errors, verify your
LANGFUSE_PUBLIC_KEYandLANGFUSE_SECRET_KEYenvironment variables are set correctly. - For unexpected missing traces, ensure your functions are decorated with
@observe()or that auto-tracing is enabled. - Check Langfuse dashboard for usage limits to avoid hitting free tier caps.
Key Takeaways
- Langfuse provides a free tier with usage-based paid plans for AI API observability.
- Use the Langfuse Python SDK with environment variables for secure API key management.
- Decorate functions with @observe() to trace AI calls and monitor costs effectively.