Langfuse Integration
Export Pixeltable OpenTelemetry spans to Langfuse. One insert is one trace; LLM generations nest under UDF spans with tokens and cost.
Challenge
Computed columns hide the HTTP call inside insert. That is the point of the table, and it is a problem for an observability product that expects a trace around each generation. If you only patch the OpenAI client, you get generations with no Pixeltable operation, row, or UDF path. If you only log locally, Langfuse never sees the prompt. The bridge is OpenTelemetry: Pixeltable emits spans, Langfuse accepts OTLP/HTTP at /api/public/otel. You choose whether that is enough, or whether you also want the Langfuse SDK for @observe, tags, and one trace around a batch.
Solution
pip install pixeltable[otel] openai langfuse openinference-instrumentation-openai. Set LANGFUSE_PUBLIC_KEY, LANGFUSE_SECRET_KEY, and LANGFUSE_BASE_URL to the region that holds the project (US, EU, Japan, or HIPAA hosts in the Langfuse docs). Call pxt_otel.init() once per process with that host plus /api/public/otel, Basic auth from the two keys, and span_level debug if you want row and UDF spans. Instrument OpenAI so generations carry model, tokens, and cost. Then insert. One Pixeltable operation is one trace. Do not install openinference-instrumentation-anthropic beside the Anthropic SDK 2.x spans: that pair records each call twice. This page matches Pixeltable 0.7.19+, Langfuse SDK 5.x, and openinference-instrumentation-openai as the Langfuse docs state.
Integration Steps
Step 1 of 4Keys belong to one Langfuse project and one region. A key sent to another host returns 401.
pip install 'pixeltable[otel]' openai langfuse openinference-instrumentation-openaiexport LANGFUSE_PUBLIC_KEY=pk-lf-...export LANGFUSE_SECRET_KEY=sk-lf-...export LANGFUSE_BASE_URL=https://us.cloud.langfuse.comexport OPENAI_API_KEY=sk-...
💡 pixeltable[otel] installs the Pixeltable bridge, the OpenTelemetry SDK, and OTLP exporters. openai is the client chat_completions() uses. LANGFUSE_BASE_URL is the regional host, not the OTLP path.
Key Benefits
Use Cases
Technical Requirements
Learn More
Related articles
Ready to Integrate Langfuse?
Get started with Pixeltable and Langfuse in minutes.
pip install pixeltable