Observability with Langfuse

Send every generation to your Langfuse project as a trace, with model, tokens, costs in USD, user, session and metadata, without your own mapping.

Set up a Langfuse destination

  1. In Langfuse, open the project settings and create an API key pair (pk-lf-…, sk-lf-…).
  2. In the observability settings choose Langfuse as the destination kind, the region and both keys, then save and send a test trace. The test appears in Langfuse as Tokenlane connection test.
  3. Switch the export on. New usage receipts are delivered from then on; older receipts are not sent.

Tokenlane builds the URL (/api/public/otel/v1/traces), the Basic credential and the ingestion header itself. The secret key is encrypted, never shown again and never audited.

  • EU (cloud.langfuse.com) is the default. US (us.cloud.langfuse.com) processes your data outside the EU.
  • Self-hosted Langfuse needs a public HTTPS base URL; private and local addresses are refused.

What appears in Langfuse

Each generation is one observation of type generation (embedding for embeddings, otherwise span) with:

  • model (langfuse.observation.model.name), input, output, cached and reasoning tokens from the OpenTelemetry GenAI attributes
  • time to first token for streamed requests (langfuse.observation.completion_start_time)
  • level ERROR with the error type as status message for failed requests, WARNING for cancelled ones
  • trace name from your trace.trace_name, otherwise operation and model
  • user (user), session (session_id), tags from trace.tags when it is a list of strings, your metadata as filterable langfuse.trace.metadata.<key> and the environment from metadata.environment

Prompts and responses appear only with the consented content export; see privacy and compliance.

Costs in USD

Langfuse stores and shows costs only in USD. Tokenlane converts the EUR amount of each generation at the public ECB reference rate recorded with the receipt and sends it as langfuse.observation.cost_details (total). The internal rate used for billing in other currencies is never sent. The observation metadata always carry the EUR amount (cost_eur) and, with a rate, fx_usd_per_eur, fx_version and fx_as_of.

Without an ECB rate for the request, or with unknown costs, no USD cost is sent and only the EUR metadata remain. Langfuse may then estimate costs from its own model definitions. To switch that off, add a model definition in Langfuse that matches the model names you use and has price 0.

Join the calling trace

Langfuse destinations start with Join the calling trace off: each generation is the root of its own trace and Langfuse shows it completely. Switch it on only if your application sends its own OpenTelemetry spans to the same Langfuse project; then a valid W3C traceparent makes the generation a child of your span.