--- id: openinference-instrumentation-anthropic version: "1.1.2" license: Apache-2.0 license_treatment: permissive maintenance: active --- # openinference-instrumentation-anthropic — OpenInference Anthropic Instrumentation License: permissive · Maintenance: active · Downloads: 651.1K/mo ## What it is and what it does This package wraps Anthropic's Python client to automatically capture detailed traces of all API calls—including Messages, Completions, and their async variants—and exports them to any OpenTelemetry-compatible backend. It sits between your code and the Anthropic client, intercepting requests and responses without requiring code changes beyond a single instrumentation call. The traces include request parameters, response data, and execution timing, formatted according to OpenInference conventions so they integrate seamlessly with observability platforms. It's designed for developers building LLM applications who need visibility into what their Anthropic calls are doing—latency, token usage, errors, and behavior patterns—without manually logging each interaction. Use it for: - Debug Anthropic API calls in development by viewing detailed traces and attributes. - Monitor production LLM application performance and identify slow or failing Anthropic requests. - Track token usage and cost across Anthropic API calls for billing and optimization. - Analyze conversation patterns and model behavior across multiple Anthropic client instances. - Correlate Anthropic traces with other application metrics in a unified observability platform. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Automatically captures and exports traces from Anthropic API calls to OpenTelemetry-compatible collectors like Arize Phoenix, enabling observability of LLM interactions. Yes. The package is actively maintained, has no known vulnerabilities, installs with low friction, and solves a real observability gap for Anthropic users. If you're already using or considering OpenTelemetry and an OTLP-compatible collector, this is a straightforward way to gain visibility into LLM interactions. ## Install pip install openinference-instrumentation-anthropic uv add openinference-instrumentation-anthropic poetry add openinference-instrumentation-anthropic ## Installing openinference-instrumentation-anthropic Before you install: Low friction installation with a pure-Python wheel. Actively maintained with a release 7 days ago and no known vulnerabilities. Depends on well-established OpenTelemetry and OpenInference libraries. License in practice: Apache-2.0 permissive license allows commercial use, modification, and distribution with minimal restrictions. Quickstart: pip install openinference-instrumentation-anthropic from anthropic import Anthropic from openinference.instrumentation.anthropic import AnthropicInstrumentor from opentelemetry.sdk import trace as trace_sdk from opentelemetry.sdk.trace.export import SimpleSpanProcessor tracer_provider = trace_sdk.TracerProvider() AnthropicInstrumentor().instrument(tracer_provider=tracer_provider) client = Anthropic() response = client.messages.create(model="claude-3-opus-20240229", max_tokens=1024, messages=[{"role": "user", "content": "Hello"}]) Requires an OpenTelemetry collector endpoint to receive traces; ANTHROPIC_API_KEY environment variable must be set. Verify before relying: - Performance overhead of instrumentation on production Anthropic API calls. - Whether custom span attributes and session tracking work as documented. ## Package facts - License: Apache-2.0 (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 651.1K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags anthropic api tracing, opentelemetry instrumentation, llm observability, trace anthropic messages, phoenix tracing integration, openinference instrumentation, llm-observability, opentelemetry, anthropic-integration [View on SkillFed](https://skillfed.io/packages/openinference-instrumentation-anthropic) · [View on PyPI](https://pypi.org/project/openinference-instrumentation-anthropic/)