https://github.com/omercnet/opencode-plugin-langfuse
https://github.com/omercnet/opencode-plugin-langfuse
Last synced: 6 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/omercnet/opencode-plugin-langfuse
- Owner: omercnet
- License: mit
- Created: 2026-01-11T09:21:52.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2026-01-11T11:21:30.000Z (6 months ago)
- Last Synced: 2026-01-11T15:33:24.370Z (6 months ago)
- Language: TypeScript
- Size: 64.5 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# OpenCode Langfuse Plugin
[](https://www.npmjs.com/package/opencode-plugin-langfuse)
[](https://opensource.org/licenses/MIT)
**Automatic LLM observability for OpenCode using Langfuse via OpenTelemetry.**
Zero-config tracing of sessions, messages, tool calls, costs, and performance.
---
## Installation
```bash
npm install opencode-plugin-langfuse
# or
bun add opencode-plugin-langfuse
```
---
## Setup
### 1. Get Langfuse Credentials
Sign up at [cloud.langfuse.com](https://cloud.langfuse.com) and create a project.
Go to **Settings → API Keys** and copy your keys.
### 2. Configure Environment
```bash
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`:
```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
```bash
export LANGFUSE_BASEURL="https://langfuse.yourcompany.com"
```
See [Langfuse self-hosting docs](https://langfuse.com/docs/deployment/self-host).
---
## 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
---
## Related
- [OpenCode](https://opencode.ai/)
- [Langfuse](https://langfuse.com/)
- [Langfuse OTEL Integration](https://langfuse.com/docs/integrations/opentelemetry)