Skip to main content
The SDK allows you to monitor Anthropic’s Claude models with zero code changes to your logic.

Setup

Enable instrumentation with a single function call. This automatically tracks all subsequent calls to both Anthropic and AsyncAnthropic clients.
A single instrument() call instruments both synchronous and asynchronous clients. You don’t need to call it twice.

Usage

Once instrumented, use the Anthropic client as you normally would. All messages.create calls are automatically traced.

Synchronous

Asynchronous

Streaming

Streaming responses are supported for both sync and async. The trace is recorded once the stream completes.

Sync Streaming

Async Streaming

Captured Data

The integration automatically records:
FieldDescription
gen_ai.systemanthropic
gen_ai.request.modelModel ID (e.g., claude-3-5-sonnet-20241022)
gen_ai.promptSystem and user messages
gen_ai.completionResponse text
gen_ai.usage.input_tokensInput token count
gen_ai.usage.output_tokensOutput token count
durationRequest latency