Trace your OpenCode sessions in Laminar. Every turn of a conversation shows up as its own trace, with the LLM calls and tool calls OpenCode made along the way, grouped by session.
In your opencode.json:
{
"$schema": "https://opencode.ai/config.json",
"plugin": [
"@lmnr-ai/opencode-plugin"
]
}Set environment variable:
export LMNR_PROJECT_API_KEY="<YOUR KEY>" # in the shell where you launch opencodeYou can get a project API key in your Laminar project settings. The plugin also reads .env files from the directory where you launch OpenCode, so you can put the key there instead.
If LMNR_PROJECT_API_KEY is not set, the plugin does nothing.
- One trace per turn. Each message you send starts an
opencode turnspan. The model calls and tool calls that answer it are nested underneath, so a turn reads top to bottom. - Sessions grouped together. Turns carry the OpenCode session ID, so a whole conversation is one session in Laminar.
- Subagents linked to their parent. When OpenCode spawns a subagent with the
tasktool, the subagent's spans are nested under thetasktool call that started them.
OpenCode has an experimental config flag to enable OpenTelemetry. The plugin turns it on for you when it is loaded.
On top of raw OTEL, Laminar injects a custom span processor that saves each conversation turn as a separate trace and groups traces by session ID. It also adds attributes on spans that power Laminar-specific features.
| Variable | Default | Description |
|---|---|---|
LMNR_PROJECT_API_KEY |
(required) | Laminar project API key |
LMNR_BASE_URL |
https://api.lmnr.ai |
Point at a self-hosted Laminar instance |
LMNR_GRPC_PORT |
8443 for Laminar Cloud, SDK default otherwise |
gRPC port for the exporter |
- OpenCode integration docs
- Laminar (open source, self-hostable)