opentelemetry-instrumentation-anthropic
OpenTelemetry Anthropic instrumentation
What it is and what it does
This package integrates the Anthropic Python SDK with OpenTelemetry, automatically capturing LLM interactions as distributed traces. When you call the Anthropic API through your instrumented code, the library records prompts, completions, and metadata as span attributes, giving you visibility into what your LLM application is doing without code changes beyond a single instrument() call.
By default it logs all content to spans, which aids debugging and quality evaluation but may expose sensitive user data. You can disable content logging via the TRACELOOP_TRACE_CONTENT environment variable to reduce trace size and privacy risk. The package depends on opentelemetry-api, opentelemetry-instrumentation, and two semantic-conventions packages to define standard attribute names for AI workloads.
Use it for:
- Debug LLM application behavior by inspecting actual prompts and completions sent to Anthropic in your traces.
- Monitor token usage and latency of Anthropic API calls in production via OpenTelemetry exporters.
- Evaluate output quality by correlating trace data with application metrics and user feedback.
- Reduce trace verbosity in privacy-sensitive deployments by disabling content logging while keeping call metadata.
- Integrate Anthropic observability into existing OpenTelemetry pipelines without custom instrumentation code.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Adds OpenTelemetry tracing to Anthropic API calls, capturing prompts, completions, and request/response metadata as span attributes for observability and debugging.
Yes, if you use Anthropic and already run OpenTelemetry. The instrumentation is actively maintained, has no known vulnerabilities, and requires only a permissive license. Install it to add LLM tracing to your observability stack with minimal setup. Skip it if you don't use Anthropic or have no OpenTelemetry backend configured.
Install
opentelemetry-instrumentation-anthropic on PyPI
pip
pip install opentelemetry-instrumentation-anthropicuv
uv add opentelemetry-instrumentation-anthropicpoetry
poetry add opentelemetry-instrumentation-anthropicInstalling opentelemetry-instrumentation-anthropic
Before you install
Low friction installation with four runtime dependencies on stable OpenTelemetry packages. Actively maintained with a recent release (4 days old) and no known vulnerabilities.
License in practice
Licensed under Apache-2.0 (permissive), allowing use in both open-source and commercial projects with minimal restrictions.
Quickstart
pip install opentelemetry-instrumentation-anthropic
from opentelemetry.instrumentation.anthropic import AnthropicInstrumentor
AnthropicInstrumentor().instrument()
Requires Python 3.10 or later; requires an active OpenTelemetry SDK and exporter configured separately to send traces to a backend.
Verify before relying
- Whether this instrumentation works with all Anthropic SDK versions or has specific compatibility constraints.
- Performance overhead of tracing on typical Anthropic API call latency.
- Whether TRACELOOP_TRACE_CONTENT environment variable is the only privacy control available.
Package facts
| License | Apache-2.0 (permissive) |
| Python support | supports the current Python release (<4,>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 4 — opentelemetry-api, opentelemetry-instrumentation, opentelemetry-semantic-conventions-ai, opentelemetry-semantic-conventions |
| Maintenance | actively maintained — 4 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 4,809,714/month — #2,224 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: opentelemetry_instrumentation_anthropic-0.62.3-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
opentelemetry-instrumentation-replicateAdds OpenTelemetry tracing to Replicate API…
permissive · top 5,000 on PyPI
opentelemetry-instrumentation-groqAutomatically captures traces of Groq SDK API…
permissive · top 5,000 on PyPI
anthropicProvides Python bindings to the Claude API,…
permissive · top 1,000 on PyPI
opentelemetry-instrumentation-openaiCaptures traces of OpenAI API calls (prompts,…
permissive · top 5,000 on PyPI
opentelemetry-instrumentation-writerAutomatically traces calls to Writer's API…
permissive · top 5,000 on PyPI
opentelemetry-instrumentation-ollamaAdds distributed tracing to Ollama Python…
permissive · top 5,000 on PyPI
openinference-instrumentation-anthropicAutomatically captures and exports traces from…
permissive · top 15,000 on PyPI
opentelemetry-instrumentation-haystackAdds distributed tracing to Haystack LLM…
permissive · top 5,000 on PyPI
opentelemetry-instrumentation-litellmAdds OpenTelemetry tracing to LiteLLM,…
permissive · top 15,000 on PyPI
opentelemetry-instrumentation-llamaindexAdds distributed tracing to LlamaIndex…
permissive · top 5,000 on PyPI