AnoSys SDK for Anthropic
Automatically capture and send Anthropic (Claude) API calls to AnoSys for monitoring, analytics, and observability.
Features
✨ Native Instrumentation - Uses the OpenTelemetry spans the Anthropic SDK emits itself; no third-party instrumentor
✨ Streaming Support - messages.stream() and stream=True calls are captured with final usage
✨ OpenTelemetry Semantic Conventions - Follows Gen AI standards, same columns as the OpenAI integration
✨ Prompt Caching & Thinking - Cache read/write tokens and extended thinking are tracked
✨ Zero Configuration - Works out of the box with just your API key
Installation
pip install anosys-sdk-anthropic
Requires anthropic>=2.0.0.
Quick Start
import os
import anthropic
from anosys_sdk_anthropic import AnosysAnthropicLogger
os.environ["ANTHROPIC_API_KEY"] = "your-anthropic-key"
os.environ["ANOSYS_API_KEY"] = "your-anosys-key"
# Initialize (do once at startup, before creating clients)
AnosysAnthropicLogger()
# Use Anthropic normally - all calls are automatically logged
client = anthropic.Anthropic()
message = client.messages.create(
model="claude-sonnet-5-5",
max_tokens=1024,
system="You are a helpful assistant.",
messages=[{"role": "user", "content": "Hello!"}],
)
print(message.content[0].text)
Options
AnosysAnthropicLogger(
get_user_context=lambda: {"session_id": "abc", "token": "user-token"},
capture_content=True, # record prompts and completions (default)
use_batch_processor=False, # BatchSpanProcessor instead of SimpleSpanProcessor
)
capture_content sets ANTHROPIC_OPEN_TELEMETRY_TRACES_CONTENT_MODE=content when it is not already set. The SDK reads it when a client is constructed, so create clients after the logger. A client given its own open_telemetry option uses that option instead, and the SDK treats it as complete: open_telemetry={"tracer_provider": provider} alone silently switches the client to metadata-only. When you need to pass an option, start from get_anthropic_open_telemetry_options(), which keeps the active provider and your capture_content choice:
from anosys_sdk_anthropic import get_anthropic_open_telemetry_options
client = anthropic.Anthropic(open_telemetry={**get_anthropic_open_telemetry_options(), "conversation_id": "abc"})
If your application already registers an OpenTelemetry TracerProvider, the logger attaches to it. It sends the Anthropic SDK's spans plus any GenAI spans your code creates around them (spans with a gen_ai.operation.name, such as an agent loop or tool calls, as in the support-copilot notebook); other spans on the provider are skipped.
What Data is Captured?
Following OpenTelemetry Gen AI standards:
gen_ai.system/gen_ai.provider.name- Always "anthropic"gen_ai.request.model,gen_ai.request.max_tokens,gen_ai.request.stop_sequencesgen_ai.response.model,gen_ai.response.id,gen_ai.response.finish_reasons(stop reason)gen_ai.usage.input_tokens(including cached tokens),gen_ai.usage.output_tokens,gen_ai.usage.total_tokens- Prompt cache tokens (
cvn4read,cvn5write) and extended thinking (cvb3) - System instructions, input and output messages
- Timestamps, duration, errors
Records are tagged cvs200 = "AnthropicTelemetry". See MAPPINGS.md for the column map.
Environment Variables
| Variable | Required | Description |
|---|---|---|
ANOSYS_API_KEY |
Yes | Your AnoSys API key |
ANTHROPIC_API_KEY |
Yes | Your Anthropic API key |
License
Apache 2.0
Metadata
Release files for anosys-sdk-anthropic 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| anosys_sdk_anthropic-1.0.0.tar.gz | 18.8 kB | Without provenance | Details for anosys_sdk_anthropic-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| anosys_sdk_anthropic-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for anosys_sdk_anthropic-1.0.0-py3-none-any.whl |
Total release size: 35.2 kB
Release files / anosys_sdk_anthropic-1.0.0.tar.gz
| Download URL | anosys_sdk_anthropic-1.0.0.tar.gz |
|---|---|
| Size | 18.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fc049bc2e7fe7b0de093ec983de83e93043a440e7f1327b8ac9468bf3b1b27fd
|
|
BLAKE2b-256 checksum How to use checksums |
68cf8ff642064db4a562f624edc17b5c3eb5c05fd4da0aee8b9cb302a70d9615
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / anosys_sdk_anthropic-1.0.0-py3-none-any.whl
| Download URL | anosys_sdk_anthropic-1.0.0-py3-none-any.whl |
|---|---|
| Size | 16.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d8173ddf632a64b79edab93a75d748cdcf1fc99fca5bdbd5a41b7ca2a696fcce
|
|
BLAKE2b-256 checksum How to use checksums |
b57f3003389e284dca1784c77e3721855426894e2be96ff7d61b2e85678a68b8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Security for anosys-sdk-anthropic 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.