skillfed

openinference-instrumentation-anthropic

OpenInference Anthropic Instrumentation

openinference-instrumentation-anthropic v1.1.2 651.1K downloads/30d#5,553 on PyPI1,147
Permissive license Apache-2.0 Active released

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 on this page — 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

openinference-instrumentation-anthropic on PyPI

pip

pip install openinference-instrumentation-anthropic

uv

uv add openinference-instrumentation-anthropic

poetry

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 the current Python release (<3.15,>=3.10)
Install friction low — pure-Python wheel
Runtime dependencies 7 — openinference-instrumentation, openinference-semantic-conventions, opentelemetry-api, opentelemetry-instrumentation, opentelemetry-semantic-conventions, typing-extensions, wrapt
Maintenance actively maintained — 7 days since the last release
Last repo commit
First released
Downloads 651,145/month — #5,553 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: openinference_instrumentation_anthropic-1.1.2-py3-none-any.whl

Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: Apache Software LicenseProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14

Tags

anthropic api tracingopentelemetry instrumentationllm observabilitytrace anthropic messagesphoenix tracing integrationopeninference instrumentation
llm-observabilityopentelemetryanthropic-integration

More Monitoring packages

tqdm

Wraps any iterable to display a real-time…

copyleft · top 100 on PyPI

opentelemetry-semantic-conventions

Provides generated Python code for…

permissive · top 100 on PyPI

opentelemetry-sdk

Provides the reference implementation of the…

permissive · top 100 on PyPI

opentelemetry-api

Provides the abstract API and interfaces for…

permissive · top 100 on PyPI

opentelemetry-exporter-otlp-proto-http

Exports OpenTelemetry observability data to an…

permissive · top 1,000 on PyPI

opentelemetry-instrumentation

Provides automatic instrumentation commands and…

permissive · top 1,000 on PyPI

openinference-instrumentation-agno

Auto-instruments Agno Agent applications to…

permissive · top 15,000 on PyPI

openinference-instrumentation-haystack

Auto-instruments Haystack LLM pipelines and…

permissive · top 15,000 on PyPI

openinference-instrumentation-llama-index

Auto-instruments LlamaIndex applications to…

permissive · top 15,000 on PyPI

openinference-instrumentation-bedrock

Automatically instruments AWS Bedrock API calls…

permissive · top 15,000 on PyPI

openinference-instrumentation-litellm

Auto-instruments LiteLLM function calls…

permissive · top 15,000 on PyPI

openinference-instrumentation-pydantic-ai

Auto-instruments PydanticAI agents to emit…

permissive · top 15,000 on PyPI

openinference-instrumentation-openai

Auto-instruments OpenAI Python SDK calls to…

permissive · top 5,000 on PyPI

openinference-instrumentation-dspy

Auto-instruments DSPy applications to generate…

permissive · top 15,000 on PyPI

arize

Arize is a Python client library for…

permissive · top 5,000 on PyPI

arize-phoenix-client

Phoenix Client provides a Python interface to…

permissive · top 5,000 on PyPI