examples/plugins/langfuse/README.md
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.
Copy the examples/plugins/langfuse/ directory to your OmniRoute plugins path, or install directly from the marketplace UI.
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.
Each LLM completion emits one Langfuse generation observation inside a per-request trace:
omniroute:<model> with userId, provider, requestId metadatachat.completion with:
model — full model IDmodelParameters — temperature, max_tokens, top_pinput — messages array (redacted if redactBody: true)output — assistant message (redacted if redactBody: true)usage.promptTokens, usage.completionTokens, usage.totalTokensstartTime, endTime — for latencyErrors emit a generation with level: "ERROR" and statusMessage.
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
redactBody: truesampleRate < 1.0 to reduce data volumeenabled: false to disable without removing configurationdocs/frameworks/PLUGIN_SDK.md