Follow Discord
Sweep 30 Oct 2026 · 01:02Z Build v2.1.314 532 read Stable v2.1.308 Latest v2.1.314 Next v2.1.314 Feeds RSS JSON llms.txt llms-full.txt Unofficial
One change · api

spans changedapi/opentelemetry/spans

Nearest release: v2.1.314, published 6 hours after this site recorded the change. Shown because the two are within 24 hours of each other. Nothing here says the release caused the edit.

Recorded here
Lines+9added
Lines−7removed
From line 120 where the diff opens
First seen 14 Oct 2026 this site's first read of the page
Recorded edits10to this page, all time

The whole hunk

from line 120, old and new numbered
/
lines
from line 120
120120 
121121### Token usage
122122 
123The following spans have token usage attributes: [`anthropic.messages.create`](https://platform.claude.com/docs/en/api/opentelemetry/spans#anthropic-messages-create), [`anthropic.model_request`](https://platform.claude.com/docs/en/api/opentelemetry/spans#anthropic-model-request), [`anthropic.compaction`](https://platform.claude.com/docs/en/api/opentelemetry/spans#anthropic-compaction), and [`anthropic.session.outcome_evaluation`](https://platform.claude.com/docs/en/api/opentelemetry/spans#anthropic-session-outcome-evaluation). The values are for each span’s step, for example the request, the model request, or the compaction. To count each token once, see [how to count tokens in the guide](https://platform.claude.com/docs/en/manage-claude/opentelemetry#count-tokens).
123The following spans have token usage attributes: [`anthropic.messages.create`](https://platform.claude.com/docs/en/api/opentelemetry/spans#anthropic-messages-create), [`anthropic.model_request`](https://platform.claude.com/docs/en/api/opentelemetry/spans#anthropic-model-request), [`anthropic.compaction`](https://platform.claude.com/docs/en/api/opentelemetry/spans#anthropic-compaction), and [`anthropic.session.outcome_evaluation`](https://platform.claude.com/docs/en/api/opentelemetry/spans#anthropic-session-outcome-evaluation). The values are for each span’s step, for example the request, the model request, or the compaction. On the API spans for a Messages API request, the token counts are the tokens that your organization is billed for, even when the request fails or the application cancels it. The SDK’s `anthropic.messages.create` span has the counts that the response reports instead, so for a failed or canceled request they can be lower than on the API span, or absent. To count each token once, see [how to count tokens in the guide](https://platform.claude.com/docs/en/manage-claude/opentelemetry#count-tokens).
124124 
125125| Attribute | Type | Description |
126126| ---------------------------------------------------------- | ----- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
from line 162
162162| `anthropic.response.service_tier` | `string` | The service tier that served the request: the response’s [`usage.service_tier`](https://platform.claude.com/docs/en/api/messages#usage). See [how requests get assigned tiers](https://platform.claude.com/docs/en/api/service-tiers#how-requests-get-assigned-tiers). |
163163| `error.type` | `string` | A failed request’s [error type](https://platform.claude.com/docs/en/api/errors#http-errors), for example `rate_limit_error`.<br />**SDK:** Also the other values in [SDK spans for requests](https://platform.claude.com/docs/en/api/opentelemetry/spans#anthropic-resources-method).<br />**API:** `api_error` when the API ends the request without an error response. |
164164| `gen_ai.response.time_to_first_chunk` | `double` | Only on a streaming response’s spans. The seconds to the stream’s first `content_block_delta` event, if it has one. |
165| `gen_ai.usage.reasoning.output_tokens` | `int` | The response’s thinking tokens. They are part of the output tokens. Absent when the response’s usage doesn’t have details for the output tokens. |
166| `anthropic.usage.compaction.input_tokens` | `int` | Input tokens of the request’s [compactions](https://platform.claude.com/docs/en/build-with-claude/compaction), including cache reads and writes. Not part of `gen_ai.usage.input_tokens`. Absent when the response has no compaction. |
167| `anthropic.usage.compaction.output_tokens` | `int` | Output tokens of the request’s compactions. Not part of `gen_ai.usage.output_tokens`. Absent when the response has no compaction. |
165| `gen_ai.usage.reasoning.output_tokens` | `int` | The thinking tokens, which are part of the output tokens. Absent when the thinking tokens aren’t counted separately from the other output tokens, for example on a model whose responses don’t have details for the output tokens. |
166| `anthropic.usage.compaction.input_tokens` | `int` | Input tokens of the request’s [compactions](https://platform.claude.com/docs/en/build-with-claude/compaction), including cache reads and writes. Not part of `gen_ai.usage.input_tokens`. Absent when the request has no compaction. |
167| `anthropic.usage.compaction.output_tokens` | `int` | Output tokens of the request’s compactions. Not part of `gen_ai.usage.output_tokens`. Absent when the request has no compaction. |
168168| `gen_ai.request.max_tokens` | `int` | The request’s [`max_tokens`](https://platform.claude.com/docs/en/api/messages/create#create.max_tokens). |
169169| `gen_ai.request.temperature` | `double` | The request’s [`temperature`](https://platform.claude.com/docs/en/api/messages/create?version=2023-06-01#create.temperature). Absent when the request doesn’t set it. |
170170| `gen_ai.request.top_p` | `double` | The request’s [`top_p`](https://platform.claude.com/docs/en/api/messages/create?version=2023-06-01#create.top_p). Absent when the request doesn’t set it. |
from line 342
342342 
343343The span has the compaction’s [token usage attributes](https://platform.claude.com/docs/en/api/opentelemetry/spans#token-usage). On [`anthropic.messages.create`](https://platform.claude.com/docs/en/api/opentelemetry/spans#anthropic-messages-create), a compaction’s usage is in the `anthropic.usage.compaction.*` attributes instead of the `gen_ai.usage.*` totals.
344344 
345| Attribute | Type | Description |
346| ------------ | -------- | ------------------------------------------------------------------------------------------------------------------------------------ |
347| `error.type` | `string` | The request’s [error type](https://platform.claude.com/docs/en/api/errors#http-errors), if the request failed during the compaction. |
345| Attribute | Type | Description |
346| ----------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
347| `gen_ai.request.model` | `string` | The model requested for the compaction, which is the request’s [`model`](https://platform.claude.com/docs/en/api/messages/create#create.model). |
348| `gen_ai.response.model` | `string` | The model that ran the compaction. It differs from `gen_ai.request.model` when the request uses a model alias, or when a [fallback model](https://platform.claude.com/docs/en/build-with-claude/refusals-and-fallback) served the request. |
349| `error.type` | `string` | The request’s [error type](https://platform.claude.com/docs/en/api/errors#http-errors), if the request failed during the compaction. |
348350 
349351### `anthropic.session.outcome_evaluation`
350352 
Feedback