-
Notifications
You must be signed in to change notification settings - Fork 580
Open
Description
How do you use Sentry?
Sentry Saas (sentry.io)
Version
2.51.0
Steps to Reproduce
import os
import sys
from anthropic import Anthropic
import sentry_sdk
from sentry_sdk.integrations.anthropic import AnthropicIntegration
sentry_sdk.init(
dsn=...,
traces_sample_rate=1.0,
integrations=[AnthropicIntegration(include_prompts=True)],
send_default_pii=True,
)
client = Anthropic(api_key="...")
messages = [{"role": "user", "content": "Say hello in exactly 5 words."}]
with sentry_sdk.start_transaction() as transaction:
with client.messages.create(
max_tokens=1024,
messages=[{"role": "user", "content": "Hello"}],
model="claude-sonnet-4-5",
stream=True,
) as stream:
for text in stream:
passExpected Result
RawMessageDeltaEvent is used for billing.
Actual Result
Input tokens from RawMessageStartEvent are inappropriately added.