Skip to content

respanai/respan

Repository files navigation

Observability, prompt management, and evals for LLM engineering teams.

Y Combinator W24 Platform Documentation Twitter Discord

Respan Tracing

Respan's library for sending telemetries of LLM applications in OpenLLMetry format.

Integrations

OpenAI Agents SDK LangGraph Vercel AI SDK

Configuration

1. Install

Python

pip install respan respan-tracing respan-instrumentation-openai

TypeScript/JavaScript

npm install @respan/respan @respan/tracing @respan/instrumentation-openai openai @traceloop/instrumentation-openai

2. Set Environment Variables

Variable Required Description
RESPAN_API_KEY Yes Your Respan API key. Authenticates both proxy and tracing. Get it from the platform.
RESPAN_BASE_URL No Defaults to https://api.respan.ai/api.

The Respan API key is used for both LLM inference (proxy) and telemetry export (tracing). Vendor-specific keys (OPENAI_API_KEY, etc.) are derived from the Respan key in code.

Quickstart

3. Run Script

Python

import os
from openai import OpenAI
from respan import Respan
from respan_instrumentation_openai import OpenAIInstrumentor

respan = Respan(instrumentations=[OpenAIInstrumentor()])

# Respan API key authenticates both proxy and tracing
respan_api_key = os.environ["RESPAN_API_KEY"]
respan_base_url = os.getenv("RESPAN_BASE_URL", "https://api.respan.ai/api")

client = OpenAI(api_key=respan_api_key, base_url=respan_base_url)

response = client.chat.completions.create(
    model="gpt-4.1-nano",
    messages=[{"role": "user", "content": "Say hello in three languages."}],
)
print(response.choices[0].message.content)
respan.flush()

TypeScript/JavaScript

import OpenAI from "openai";
import { Respan } from "@respan/respan";
import { OpenAIInstrumentor } from "@respan/instrumentation-openai";

// Respan API key authenticates both proxy and tracing
const respan = new Respan({
  apiKey: process.env.RESPAN_API_KEY,
  baseURL: process.env.RESPAN_BASE_URL,
  instrumentations: [new OpenAIInstrumentor()],
});
await respan.initialize();

const client = new OpenAI({
  apiKey: process.env.RESPAN_API_KEY,
  baseURL: process.env.RESPAN_BASE_URL,
});

const response = await client.chat.completions.create({
  model: "gpt-4.1-nano",
  messages: [{ role: "user", content: "Say hello in three languages." }],
});
console.log(response.choices[0].message.content);
await respan.flush();

4. View Dashboard

See your traces in the Respan platform.

Further Reading

Examples

Supported Integrations

The plugin system supports 50+ tools via OTEL instrumentation wrappers:

Package Python TypeScript
OpenAI SDK respan-instrumentation-openai @respan/instrumentation-openai
OpenAI Agents SDK respan-instrumentation-openai-agents @respan/instrumentation-openai-agents
Anthropic SDK respan-instrumentation-anthropic @respan/instrumentation-anthropic
OpenInference (Arize) respan-instrumentation-openinference @respan/instrumentation-openinference
Any OTEL instrumentor OTELInstrumentor(cls) new OTELInstrumentor(cls)

Auto-discovery also supports: Azure OpenAI, Cohere, Bedrock, Vertex AI, LangChain, LlamaIndex, Pinecone, ChromaDB, Qdrant, Together AI, and more.

Workflow and Task Decorators

Structure traces with @workflow / @task (Python) or withWorkflow / withTask (TypeScript). See the decorators example for details.

Propagate Attributes

Attach customer_identifier, thread_identifier, and metadata to all spans in scope. See the attributes example.

Star us

Please star us if you found this helpful!

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors