Drop-in proxy for the Anthropic Messages API. One line of code, every Claude call captured.
Spanlens captures every Anthropic API call your app makes — Claude Opus, Sonnet, and Haiku, plus tool use, vision, and prompt caching — without changing your business logic. The Anthropic SDK keeps working unchanged with full observability layered underneath.
Sign up at spanlens.io and create a project. Copy the sl_live_* API key from the project dashboard.
The drop-in SDK mirrors the Anthropic surface area exactly.
# TypeScript
npm install @spanlens/sdk @anthropic-ai/sdk
# Python
pip install spanlens anthropicReplace the Anthropic client constructor with the Spanlens drop-in. No other code changes needed.
// Before
import Anthropic from '@anthropic-ai/sdk'
const anthropic = new Anthropic()
// After
import { createAnthropic } from '@spanlens/sdk/anthropic'
const anthropic = createAnthropic() // reads SPANLENS_API_KEY from envFor languages without an SDK, point the Anthropic base URL at the Spanlens proxy and put your Spanlens key in the Authorization header. The x-api-key header for Anthropic auth is still passed through.
curl https://api.spanlens.io/proxy/anthropic/v1/messages \
-H "Authorization: Bearer sl_live_..." \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{"model":"claude-sonnet-4-5","max_tokens":1024,"messages":[{"role":"user","content":"hi"}]}'Every Claude call lands in /requests within ~1 second with input + output + cache token breakdown, latency, model variant, and cost.
Yes. Anthropic streams differ from OpenAI — usage data arrives in the message_delta event rather than the final chunk. Spanlens has provider-specific parsers that handle this, so token counts and cost are correct for streamed Claude responses.
Yes. cache_creation_input_tokens and cache_read_input_tokens are captured separately so you see the cache hit rate and the cost saved from caching. Cost calculation uses the discounted cache-read rate.
Yes. Bedrock Claude calls route through the same proxy with SigV4 auth handled by your SDK. The provider key field stores your AWS credentials encrypted with AES-256-GCM.
Reasoning tokens are captured as a separate field in the request detail view. They are billed by Anthropic as output tokens, and Spanlens reflects that in cost — but the visible split lets you see how much of your spend is reasoning vs final output.
Yes. Tool input, tool result, and parallel tool use are all captured. For multi-step agent flows (e.g. Claude with a chain of tool calls), Spanlens renders a waterfall span tree with critical-path highlighting.
Yes. The Anthropic key is encrypted at rest with AES-256-GCM and never logged. It is decrypted only at proxy time and immediately discarded after the upstream call.
See every Anthropic call in your dashboard within 60 seconds.