Spanlens Docs

LLM observability in 60 seconds. Record every OpenAI, Anthropic, and Gemini call with cost, latency, full request/response, agent traces, PII detection, and cheaper-model suggestions.

Drop this into your app

import { createOpenAI } from '@spanlens/sdk/openai'

const openai = createOpenAI() // reads SPANLENS_API_KEY from env

const res = await openai.chat.completions.create({
  model: 'gpt-4o-mini',
  messages: [{ role: 'user', content: 'Hi' }],
})
ts

Already have OpenAI / Anthropic / Gemini calls in your code? npx @spanlens/cli init rewrites them in one pass. See the Quick start for both paths.

What's in the docs

Frequently asked

Does Spanlens add latency to my requests?

Typical overhead is 10–50ms per call, a thin pass-through proxy. Your requests flow to OpenAI / Anthropic / Gemini and responses stream back. Logging is fire-and-forget via Vercel's waitUntil, so it never blocks the response.

Is my provider key safe?

Yes. Provider keys are AES-256-GCM encrypted at rest in your Supabase. They're only decrypted in memory when forwarding a request, never logged. For extra control, self-host.

Can I run Spanlens alongside my existing Langfuse / Helicone setup?

Yes. Spanlens is a drop-in replacement at the baseURL level. Keep both running side-by-side during migration, then turn the other off. Why Spanlens vs Helicone / Langfuse →

Looking for Privacy, Terms, DPA, or Subprocessors? All four live in the footer of every page. For a countersigned DPA or a security questionnaire, email support@spanlens.io.