Anthropic client instance with wrapAnthropic(). Every messages.create call is traced automatically, including tool use and streaming responses.
Installation
Setup
Example
What gets captured
| Field | Details |
|---|---|
| Model | claude-opus-4-7, claude-sonnet-4-6, claude-haiku-4-5, etc. |
| Input tokens | From usage.input_tokens |
| Output tokens | From usage.output_tokens |
| Cost | Calculated from token counts and Anthropic pricing |
| Latency | Total time from request to first token (streaming) or full response |
| Stop reason | end_turn, max_tokens, tool_use, stop_sequence |
Tool use
Tool calls and tool results are captured as child spans under the message span.Streaming
Streaming responses are traced end-to-end. Token counts accumulate frommessage_delta events.
Prompt and completion text is stored by default with PII redaction applied before transmission. Set
storePrompts: false in zespan.init() to disable prompt storage.Next steps
- Agent tracing — trace multi-turn Claude conversations as agents
- Guardrails — enforce safety policies on Claude outputs

