Skip to content

OpenCode

OpenCode has native OpenTelemetry support with the same event structure as Claude Code.

Automatic Setup

bash
flowstate-telemetry install --tool opencode

This configures plugins and environment in ~/.config/opencode/opencode.json.

Manual Setup

Add the OTel environment variables to your shell profile (~/.zshrc or ~/.bashrc):

bash
export OTEL_EXPORTER_OTLP_ENDPOINT="https://otel.flowstate.inc"
export OTEL_EXPORTER_OTLP_HEADERS="x-flowstate-key=YOUR_TELEMETRY_KEY"

What Gets Captured

EventOTel NameData Collected
User promptopencode.user_promptPrompt text, session ID
API requestopencode.api_requestModel, input/output/cache tokens, cost, duration
Tool resultopencode.tool_resultTool name, success/failure, duration
API erroropencode.api_errorError details

TIP

OpenCode captures prompt content by default — there is no opt-in flag. It mirrors the Claude Code OTel event structure, providing the same rich metadata for session aggregation and classification.

Flowstate Documentation