Skip to main content
To trace Anthropic with HoneyHive, install honeyhive[openinference-anthropic], call HoneyHiveTracer.init(), run AnthropicInstrumentor().instrument(tracer_provider=tracer.provider), and use your existing Anthropic client unchanged. See the tracing quickstart and tracer initialization guides for setup details. Anthropic provides Claude models for chat, tool use, and vision. HoneyHive integrates with Anthropic via the OpenInference instrumentor, automatically capturing all API calls, tool use, and token usage.

How do I trace Anthropic with HoneyHive?

Add HoneyHive tracing in just 4 lines of code. Add this to your existing Anthropic app and all message calls, tool use, and streaming are automatically traced.
To see where to initialize the tracer for your environment, including AWS Lambda and long-running servers, see Tracer Initialization.

Tested Versions

HoneyHive’s Anthropic integration is tested against the following versions on PyPI, as of April 2026. Newer patch releases are generally safe; if you hit an issue, pin to these versions to reproduce a known-good configuration. Requires Python 3.11+.

What Gets Traced

The instrumentor automatically captures:
  • Message completions - client.messages.create() with inputs, outputs, and token usage
  • Tool use - Each tool call with arguments and results
  • Streaming responses - Streamed messages with aggregated tokens
No manual instrumentation required.

Example: Message Creation


Environment Configuration


Troubleshooting

Traces not appearing

  1. Check environment variables - Ensure HH_API_KEY is set
  2. Pass the tracer provider - The instrumentor must receive tracer_provider=tracer.provider:
  1. Initialize before making calls - Call instrument() before creating the Anthropic client

Enrich Your Traces

Add user IDs and custom metadata to traces

Custom Spans

Create spans for business logic around API calls

Distributed Tracing

Trace calls across service boundaries

Using Traceloop (OpenLLMetry) Instead

If your project already uses Traceloop / OpenLLMetry, you can use its Anthropic instrumentor instead of OpenInference. The setup is identical - only the install and import paths differ.
Tested version: opentelemetry-instrumentation-anthropic 0.58.0 (April 2026).

Resources