JSPM

opencode-plugin-langfuse

0.1.8
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2769
  • Score
    100M100P100Q125028F
  • License MIT

Langfuse observability plugin for OpenCode - LLM tracing, prompt versioning, and cost tracking

Package Exports

  • opencode-plugin-langfuse
  • opencode-plugin-langfuse/dist/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (opencode-plugin-langfuse) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

OpenCode Langfuse Plugin

npm version License: MIT

Automatic LLM observability for OpenCode using Langfuse via OpenTelemetry.

Zero-config tracing of sessions, messages, tool calls, costs, and performance.


Installation

npm install opencode-plugin-langfuse
# or
bun add opencode-plugin-langfuse

Setup

1. Get Langfuse Credentials

Sign up at cloud.langfuse.com and create a project.

Go to Settings → API Keys and copy your keys.

2. Configure Environment

export LANGFUSE_PUBLIC_KEY="pk-lf-..."
export LANGFUSE_SECRET_KEY="sk-lf-..."
export LANGFUSE_BASEURL="https://cloud.langfuse.com"  # Optional

3. Enable Plugin + OTEL

In .opencode/opencode.json:

{
  "experimental": {
    "openTelemetry": true
  },
  "plugin": ["opencode-plugin-langfuse"]
}

4. Run OpenCode

That's it! All traces appear automatically in your Langfuse dashboard.


How It Works

This plugin initializes a LangfuseSpanProcessor that captures all OpenTelemetry spans emitted by OpenCode when experimental.openTelemetry is enabled.

OpenCode (OTEL spans) → LangfuseSpanProcessor → Langfuse Dashboard

Environment Variables

Variable Required Default Description
LANGFUSE_PUBLIC_KEY Yes - Langfuse public key
LANGFUSE_SECRET_KEY Yes - Langfuse secret key
LANGFUSE_BASEURL No https://cloud.langfuse.com Self-hosted instance

Self-Hosting

export LANGFUSE_BASEURL="https://langfuse.yourcompany.com"

See Langfuse self-hosting docs.


Troubleshooting

No traces appearing

  1. Verify experimental.openTelemetry: true is set
  2. Check credentials: echo $LANGFUSE_PUBLIC_KEY
  3. Check Langfuse health: curl https://cloud.langfuse.com/api/public/health

Plugin not loading

  • Ensure opencode-plugin-langfuse is in dependencies (not devDependencies)
  • Verify .opencode/opencode.json syntax

License

MIT © omercnet