Files
OmniRoute/examples/plugins/langfuse/README.md
Chirag Singhal 5e5fb61fcc feat(plugins): add langfuse plugin (#6577)
feat(plugins): add langfuse example plugin Integrated into release/v3.8.47. (thanks @chirag127)
2026-07-07 19:32:28 -03:00

2.7 KiB

Langfuse Plugin

Emits Langfuse generation traces for every LLM completion routed through OmniRoute.

Records prompt, response, model, provider, token usage, latency, and error details to Langfuse cloud (cloud.langfuse.com or us.cloud.langfuse.com) or a self-hosted Langfuse instance.

Install

Copy the examples/plugins/langfuse/ directory to your OmniRoute plugins path, or install directly from the marketplace UI.

Configuration

Fill these fields in the plugin config panel:

Key Required Default Notes
publicKey Yes "" Langfuse public key (pk-lf-...)
secretKey Yes "" Langfuse secret key (sk-lf-...)
host No https://cloud.langfuse.com Also https://us.cloud.langfuse.com or self-hosted URL
enabled No true Set to false to make the plugin a no-op without uninstalling
sampleRate No 1.0 0.1 = trace 10% of requests
flushAt No 15 Events to buffer before flushing
flushInterval No 10000 Max ms between flushes
redactBody No false Set true to strip prompt + completion from traces (metadata still recorded)

Get keys at cloud.langfuse.com → Settings → API keys.

What gets traced

Each LLM completion emits one Langfuse generation observation inside a per-request trace:

  • Trace: omniroute:<model> with userId, provider, requestId metadata
  • Generation: chat.completion with:
    • model — full model ID
    • modelParameterstemperature, max_tokens, top_p
    • input — messages array (redacted if redactBody: true)
    • output — assistant message (redacted if redactBody: true)
    • usage.promptTokens, usage.completionTokens, usage.totalTokens
    • startTime, endTime — for latency

Errors emit a generation with level: "ERROR" and statusMessage.

Runtime dependency

The plugin lazy-loads the langfuse npm SDK on first request. Install it in the plugin's own directory so a broken SDK cannot crash the gateway:

cd examples/plugins/langfuse
npm install langfuse

Privacy

  • Prompts and completions are sent to Langfuse cloud (or your self-host) in cleartext unless redactBody: true
  • API keys are stored in the plugin config, encrypted at rest by OmniRoute
  • Set sampleRate < 1.0 to reduce data volume
  • Set enabled: false to disable without removing configuration