Anthropic Claude
Required Anthropic Claude Attributes
The following cost calculation tags are required for traces originating from Anthropic Claude API calls.
For a complete, runnable example of Claude instrumentation, see Quill — Beakpoint's reference application for multi-model LLM cost attribution. Quill's tracing.py shows the full OTel setup, and analyzer.py shows instrumented Anthropic API calls in action.
Always Required Fields
These fields are always required for Beakpoint to calculate Claude costs:
| Attribute Name | Example Value | Allowed Values |
|---|---|---|
gen_ai.system | anthropic | anthropic (must be this exact value) |
gen_ai.request.model | claude-sonnet-4-6 | Any valid Anthropic model name |
gen_ai.usage.input_tokens | 512 | Non-negative integer |
gen_ai.usage.output_tokens | 128 | Non-negative integer |
gen_ai.system requires a SpanProcessorThe Anthropic auto-instrumentor sets gen_ai.provider.name but not gen_ai.system. Beakpoint requires gen_ai.system for pricing. Use a custom SpanProcessor to copy gen_ai.provider.name → gen_ai.system on span start. See the _GenAiSystemProcessor in Quill for the pattern, or the Track LLM Costs guide for a full walkthrough.
Optional Enrichment Attributes
These fields are optional but improve cost accuracy when provided:
| Attribute Name | Example Value | Description |
|---|---|---|
gen_ai.response.model | claude-sonnet-4-6-20250514 | The exact model version returned in the response. When present, this takes precedence over gen_ai.request.model for pricing lookups. |
gen_ai.usage.input_tokens.cache_creation | 256 | Tokens written into the prompt cache. Cache creation tokens are billed at a premium rate above standard input pricing. |
gen_ai.usage.input_tokens.cache_read | 128 | Tokens read from the prompt cache. Cache read tokens are billed at a significantly reduced rate. |
cloud.provider | anthropic | Provider identification. Set automatically by the _GenAiSystemProcessor pattern. |
Claude's prompt caching uses two distinct token counters — cache_creation and cache_read — rather than the single cached counter used by OpenAI. Provide both when available to ensure accurate cost attribution.
Supported Models
Beakpoint calculates costs for the following Anthropic Claude models. Prices are per 1 million tokens (USD).
| Model | Input ($/M) | Cache Creation ($/M) | Cache Read ($/M) | Output ($/M) |
|---|---|---|---|---|
claude-sonnet-5 | $3.00 | $3.75 | $0.30 | $15.00 |
claude-sonnet-4-6 | $3.00 | $3.75 | $0.30 | $15.00 |
claude-sonnet-4 | $3.00 | $3.75 | $0.30 | $15.00 |
claude-opus-4 | $15.00 | $18.75 | $1.50 | $75.00 |
claude-haiku-4-5 | $0.80 | $1.00 | $0.08 | $4.00 |
claude-haiku-3-5 | $0.80 | $1.00 | $0.08 | $4.00 |
Prices reflect Anthropic list pricing and may change. Beakpoint keeps these rates up to date, but check the Anthropic pricing page for the latest figures.
Python Example
The quickest way to emit the required attributes is with the opentelemetry-instrumentation-anthropic package paired with a SpanProcessor that sets gen_ai.system. This example is adapted from Quill:
pip install opentelemetry-instrumentation-anthropic
from opentelemetry.instrumentation.anthropic import AnthropicInstrumentor
import anthropic
# Instrument before creating the client (see Track LLM Costs guide
# for the full TracerProvider setup including _GenAiSystemProcessor)
AnthropicInstrumentor().instrument()
client = anthropic.Anthropic()
message = client.messages.create(
model="claude-sonnet-4-6",
max_tokens=4096,
system="You are a helpful assistant.",
messages=[{"role": "user", "content": "Hello!"}],
)
The instrumentation automatically sets gen_ai.provider.name, gen_ai.request.model, gen_ai.usage.input_tokens, gen_ai.usage.output_tokens, and the optional cache token counters whenever they are available in the API response. The _GenAiSystemProcessor copies gen_ai.provider.name to gen_ai.system and cloud.provider.
For full setup instructions, including how to configure the OpenTelemetry exporter for Beakpoint, see the Track LLM Costs guide.