Quickstart

Unified entry point for Respan tracing in TypeScript.

@respan/respan is the main package for Respan tracing. It provides the Respan class that initializes OpenTelemetry, auto-discovers installed instrumentation packages, and exposes decorators for structured traces.

Install

npm install @respan/respan @respan/respan-sdk @respan/tracing

Quick start

When you omit the instrumentations option, Respan auto-discovers any installed @respan/instrumentation-* package and activates it — no manual imports required.

import { Respan } from "@respan/respan";
const respan = new Respan({ apiKey: process.env.RESPAN_API_KEY });
await respan.initialize();
// Any installed LLM SDK (OpenAI, Anthropic, etc.) is now traced automatically.
import OpenAI from "openai";
await new OpenAI().chat.completions.create({
model: "gpt-4o",
messages: [{ role: "user", content: "Hello" }],
});

Explicit instrumentation (optional)

Pass instrumentations to pin a specific plugin. Providing this option disables auto-discovery — only the plugins you list are activated.

import { Respan } from "@respan/respan";
import { OpenAIInstrumentor } from "@respan/instrumentation-openai";
const respan = new Respan({
apiKey: process.env.RESPAN_API_KEY,
instrumentations: [new OpenAIInstrumentor()],
});
await respan.initialize();

See initialize() for the full configuration reference.

Configuration

ParameterTypeDefaultDescription
apiKeystringRESPAN_API_KEY env varRespan API key
baseURLstringhttps://api.respan.aiAPI base URL
appNamestring"default"Application name for traces
instrumentationsInstrumentation[]auto-discoverPlugins to activate. Omit for auto-discovery.
traceContentbooleantrueCapture input/output content
logLevelstring"error"Log level (debug, info, warn, error)