openinference-instrumentation-anthropic
OpenInference Anthropic Instrumentation
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-anthropicuv
uv add openinference-instrumentation-anthropicpoetry
poetry add openinference-instrumentation-anthropicInstalling 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
Tags
More Monitoring packages
Wraps any iterable to display a real-time…
copyleft · top 100 on PyPI
opentelemetry-semantic-conventionsProvides generated Python code for…
permissive · top 100 on PyPI
opentelemetry-sdkProvides the reference implementation of the…
permissive · top 100 on PyPI
opentelemetry-apiProvides the abstract API and interfaces for…
permissive · top 100 on PyPI
opentelemetry-exporter-otlp-proto-httpExports OpenTelemetry observability data to an…
permissive · top 1,000 on PyPI
opentelemetry-instrumentationProvides automatic instrumentation commands and…
permissive · top 1,000 on PyPI
openinference-instrumentation-agnoAuto-instruments Agno Agent applications to…
permissive · top 15,000 on PyPI
openinference-instrumentation-haystackAuto-instruments Haystack LLM pipelines and…
permissive · top 15,000 on PyPI
openinference-instrumentation-llama-indexAuto-instruments LlamaIndex applications to…
permissive · top 15,000 on PyPI
openinference-instrumentation-bedrockAutomatically instruments AWS Bedrock API calls…
permissive · top 15,000 on PyPI
openinference-instrumentation-litellmAuto-instruments LiteLLM function calls…
permissive · top 15,000 on PyPI
openinference-instrumentation-pydantic-aiAuto-instruments PydanticAI agents to emit…
permissive · top 15,000 on PyPI
openinference-instrumentation-openaiAuto-instruments OpenAI Python SDK calls to…
permissive · top 5,000 on PyPI
openinference-instrumentation-dspyAuto-instruments DSPy applications to generate…
permissive · top 15,000 on PyPI
arizeArize is a Python client library for…
permissive · top 5,000 on PyPI
arize-phoenix-clientPhoenix Client provides a Python interface to…
permissive · top 5,000 on PyPI