Skip to main content
  1. Sign up — Create an account at platform.respan.ai
  2. Create an API key — Generate one on the API keys page
  3. Add credits or a provider key — Add credits on the Credits page or connect your own provider key on the Integrations page
Add the Docs MCP to your AI coding tool to get help building with Respan. No API key needed.
{
  "mcpServers": {
    "respan-docs": {
      "url": "https://docs.respan.ai/mcp"
    }
  }
}

What is OpenCode?

OpenCode is an open-source terminal-based AI coding assistant. It supports multiple LLM providers, can edit files, run commands, and handle multi-step coding tasks directly from your terminal.

Setup

Prerequisite: OpenCode must be installed before integrating with Respan.
go install github.com/opencode-ai/opencode@latest
1

Install the Respan CLI

npm install -g @respan/cli
2

Set your API key

export RESPAN_API_KEY="YOUR_RESPAN_API_KEY"
3

Integrate

respan integrate opencode
This automatically configures OpenCode’s hooks to send traces to Respan.
4

Use OpenCode normally

opencode "Optimize the database queries in the user service"
All conversations are now traced automatically — no changes to your workflow.
5

View your traces

Open the Traces page to see your OpenCode conversations with full hierarchy — thinking, tool calls, and responses.

Configuration

Customize the integration with flags:
respan integrate opencode --customer-id "frank" --project-id "proj-123"
FlagEnv varDefaultDescription
--globalWrite user-level config (~/.config/opencode/plugins/otel.json).
--localLocalWrite per-project config (.opencode/plugins/otel.json).
--customer-idRESPAN_CUSTOMER_IDCustomer/user identifier for traces.
--project-idRESPAN_PROJECT_IDRespan project ID.
--attrsCustom attributes JSON (e.g. '{"env":"prod"}').
--base-urlRESPAN_BASE_URLhttps://api.respan.ai/apiRespan API base URL.
--dry-runPreview changes without writing files.
OpenCode uses the opencode-otel community plugin. The respan integrate command installs the plugin and configures OTLP endpoints automatically.

Captured Data

DataDescription
User promptThe user’s input text
Assistant responseOpenCode’s final response
Thinking blocksThinking / reasoning content
Tool callsTool name, input, and output (file operations, shell commands, etc.)
Token usageInput, output, and cache tokens (when available)
TimingStart time, end time, latency
ModelModel name used (varies by configured provider)

Span Types

Spanlog_typeDescription
RootagentThe complete conversation turn
ThinkinggenerationThinking / reasoning blocks
TooltoolTool invocations (file reads, writes, shell commands, etc.)

Uninstall

To remove the integration:
respan integrate opencode --remove