Skip to main content
Langfuse can trace Phala calls through its OpenAI SDK wrapper. It records latency, usage, errors, and, by default, model inputs and outputs.
Langfuse is a separate observability destination. Traced prompts and responses leave Phala’s trust boundary and are subject to your Langfuse deployment, retention, and access controls.

Configure tracing

Install the current Python SDKs and set both services’ credentials:
Use your own LANGFUSE_BASE_URL for a self-hosted deployment.

Trace a request

Import OpenAI from langfuse.openai, then configure Phala as the API endpoint:
The wrapper accepts the same streaming and async calls as the OpenAI SDK. Add trace names, session identifiers, and low-sensitivity metadata only when they are useful for debugging or aggregation.

Decide what to export

Before enabling tracing in production:
  1. Classify prompts, responses, tool arguments, retrieved documents, and metadata.
  2. Configure Langfuse masking before those values leave the application, or omit content entirely.
  3. Set retention and access controls for the Langfuse project.
  4. Use a self-hosted Langfuse deployment when its data must remain inside your own boundary.
Masking changes telemetry only; it does not change the request sent to Phala. If another OpenTelemetry exporter is active, configure its redaction separately.

Costs and receipts

Langfuse cost estimates depend on a matching model definition. Phala model IDs or prices may need a custom definition under Project Settings > Models. Treat the Phala dashboard as the billing source of truth. Langfuse does not verify Phala’s signed receipts. Fetch and verify a receipt separately when the serving path is part of your security decision.