diff --git a/.chloggen/genai_cache_tokens.yaml b/.chloggen/genai_cache_tokens.yaml
new file mode 100644
index 0000000000..7255f8e523
--- /dev/null
+++ b/.chloggen/genai_cache_tokens.yaml
@@ -0,0 +1,9 @@
+change_type: enhancement
+component: gen-ai
+note: Add cache token attributes and provider-specific normalization guidance for GenAI usage metrics
+issues: [1959]
+subtext: |
+ - Add `gen_ai.usage.cache_read.input_tokens` attribute for tokens served from provider cache
+ - Add `gen_ai.usage.cache_creation.input_tokens` attribute for tokens written to provider cache
+ - Add provider-specific token handling notes to OpenAI span
+ - Add Anthropic span with computation guidance for `gen_ai.usage.input_tokens`
diff --git a/docs/gen-ai/README.md b/docs/gen-ai/README.md
index 19921b967e..69f056d87b 100644
--- a/docs/gen-ai/README.md
+++ b/docs/gen-ai/README.md
@@ -36,9 +36,10 @@ Semantic conventions for Generative AI operations are defined for the following
Technology specific semantic conventions are defined for the following GenAI system:
+* [Anthropic](./anthropic.md): Semantic Conventions for Anthropic.
* [Azure AI Inference](./azure-ai-inference.md): Semantic Conventions for Azure AI Inference.
-* [OpenAI](./openai.md): Semantic Conventions for OpenAI.
* [AWS Bedrock](./aws-bedrock.md): Semantic Conventions for AWS Bedrock.
+* [OpenAI](./openai.md): Semantic Conventions for OpenAI.
See also:
diff --git a/docs/gen-ai/anthropic.md b/docs/gen-ai/anthropic.md
new file mode 100644
index 0000000000..e613cf634f
--- /dev/null
+++ b/docs/gen-ai/anthropic.md
@@ -0,0 +1,246 @@
+
+
+# Semantic conventions for Anthropic client operations
+
+**Status**: [Development][DocumentStatus]
+
+
+
+- [Spans](#spans)
+ - [Inference](#inference)
+ - [Embedding](#embedding)
+- [Metrics](#metrics)
+
+
+
+> [!IMPORTANT]
+>
+> Existing GenAI instrumentations that are using
+> [v1.36.0 of this document](https://github.com/open-telemetry/semantic-conventions/blob/v1.36.0/docs/gen-ai/README.md)
+> (or prior):
+>
+> * SHOULD NOT change the version of the GenAI conventions that they emit by default.
+> Conventions include, but are not limited to, attributes, metric, span and event names,
+> span kind and unit of measure.
+> * SHOULD introduce an environment variable `OTEL_SEMCONV_STABILITY_OPT_IN`
+> as a comma-separated list of category-specific values. The list of values
+> includes:
+> * `gen_ai_latest_experimental` - emit the latest experimental version of
+> GenAI conventions (supported by the instrumentation) and do not emit the
+> old one (v1.36.0 or prior).
+> * The default behavior is to continue emitting whatever version of the GenAI
+> conventions the instrumentation was emitting (1.36.0 or prior).
+>
+> This transition plan will be updated to include stable version before the
+> GenAI conventions are marked as stable.
+
+The Semantic Conventions for [Anthropic](https://www.anthropic.com/) extend and override the [GenAI Semantic Conventions](README.md).
+
+## Spans
+
+### Inference
+
+`gen_ai.provider.name` MUST be set to `"anthropic"` and SHOULD be provided **at span creation time**.
+
+
+
+
+
+
+**Status:** 
+
+Semantic Conventions for [Anthropic](https://www.anthropic.com/) client spans extend and override the semantic conventions for [Gen AI Spans](gen-ai-spans.md).
+
+`gen_ai.provider.name` MUST be set to `"anthropic"` and SHOULD be provided **at span creation time**.
+
+**Span name** SHOULD be `{gen_ai.operation.name} {gen_ai.request.model}`.
+
+**Span kind** SHOULD be `CLIENT`.
+
+**Span status** SHOULD follow the [Recording Errors](/docs/general/recording-errors.md) document.
+
+**Attributes:**
+
+| Key | Stability | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Value Type | Description | Example Values |
+| --- | --- | --- | --- | --- | --- |
+| [`gen_ai.operation.name`](/docs/registry/attributes/gen-ai.md) |  | `Required` | string | The name of the operation being performed. [1] | `chat`; `generate_content`; `text_completion` |
+| [`error.type`](/docs/registry/attributes/error.md) |  | `Conditionally Required` if the operation ended in an error | string | Describes a class of error the operation ended with. [2] | `timeout`; `java.net.UnknownHostException`; `server_certificate_invalid`; `500` |
+| [`gen_ai.conversation.id`](/docs/registry/attributes/gen-ai.md) |  | `Conditionally Required` when available | string | The unique identifier for a conversation (session, thread), used to store and correlate messages within this conversation. [3] | `conv_5j66UpCpwteGg4YSxUnt7lPY` |
+| [`gen_ai.output.type`](/docs/registry/attributes/gen-ai.md) |  | `Conditionally Required` [4] | string | Represents the content type requested by the client. [5] | `text`; `json`; `image` |
+| [`gen_ai.request.choice.count`](/docs/registry/attributes/gen-ai.md) |  | `Conditionally Required` if available, in the request, and !=1 | int | The target number of candidate completions to return. | `3` |
+| [`gen_ai.request.model`](/docs/registry/attributes/gen-ai.md) |  | `Conditionally Required` If available. | string | The name of the GenAI model a request is being made to. [6] | `gpt-4` |
+| [`gen_ai.request.seed`](/docs/registry/attributes/gen-ai.md) |  | `Conditionally Required` if applicable and if the request includes a seed | int | Requests with same seed value more likely to return same result. | `100` |
+| [`server.port`](/docs/registry/attributes/server.md) |  | `Conditionally Required` If `server.address` is set. | int | GenAI server port. [7] | `80`; `8080`; `443` |
+| [`gen_ai.request.frequency_penalty`](/docs/registry/attributes/gen-ai.md) |  | `Recommended` | double | The frequency penalty setting for the GenAI request. | `0.1` |
+| [`gen_ai.request.max_tokens`](/docs/registry/attributes/gen-ai.md) |  | `Recommended` | int | The maximum number of tokens the model generates for a request. | `100` |
+| [`gen_ai.request.presence_penalty`](/docs/registry/attributes/gen-ai.md) |  | `Recommended` | double | The presence penalty setting for the GenAI request. | `0.1` |
+| [`gen_ai.request.stop_sequences`](/docs/registry/attributes/gen-ai.md) |  | `Recommended` | string[] | List of sequences that the model will use to stop generating further tokens. | `["forest", "lived"]` |
+| [`gen_ai.request.temperature`](/docs/registry/attributes/gen-ai.md) |  | `Recommended` | double | The temperature setting for the GenAI request. | `0.0` |
+| [`gen_ai.request.top_p`](/docs/registry/attributes/gen-ai.md) |  | `Recommended` | double | The top_p sampling setting for the GenAI request. | `1.0` |
+| [`gen_ai.response.finish_reasons`](/docs/registry/attributes/gen-ai.md) |  | `Recommended` | string[] | Array of reasons the model stopped generating tokens, corresponding to each generation received. | `["stop"]`; `["stop", "length"]` |
+| [`gen_ai.response.id`](/docs/registry/attributes/gen-ai.md) |  | `Recommended` | string | The unique identifier for the completion. | `chatcmpl-123` |
+| [`gen_ai.response.model`](/docs/registry/attributes/gen-ai.md) |  | `Recommended` | string | The name of the model that generated the response. [8] | `gpt-4-0613` |
+| [`gen_ai.usage.cache_creation.input_tokens`](/docs/registry/attributes/gen-ai.md) |  | `Recommended` | int | The number of input tokens written to a provider-managed cache. [9] | `25` |
+| [`gen_ai.usage.cache_read.input_tokens`](/docs/registry/attributes/gen-ai.md) |  | `Recommended` | int | The number of input tokens served from a provider-managed cache. [10] | `50` |
+| [`gen_ai.usage.input_tokens`](/docs/registry/attributes/gen-ai.md) |  | `Recommended` | int | The number of tokens used in the GenAI input (prompt). [11] | `100` |
+| [`gen_ai.usage.output_tokens`](/docs/registry/attributes/gen-ai.md) |  | `Recommended` | int | The number of tokens used in the GenAI response (completion). | `180` |
+| [`server.address`](/docs/registry/attributes/server.md) |  | `Recommended` | string | GenAI server address. [12] | `example.com`; `10.1.2.80`; `/tmp/my.sock` |
+| [`gen_ai.input.messages`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | The chat history provided to the model as an input. [13] | [
{
"role": "user",
"parts": [
{
"type": "text",
"content": "Weather in Paris?"
}
]
},
{
"role": "assistant",
"parts": [
{
"type": "tool_call",
"id": "call_VSPygqKTWdrhaFErNvMV18Yl",
"name": "get_weather",
"arguments": {
"location": "Paris"
}
}
]
},
{
"role": "tool",
"parts": [
{
"type": "tool_call_response",
"id": " call_VSPygqKTWdrhaFErNvMV18Yl",
"result": "rainy, 57°F"
}
]
}
] |
+| [`gen_ai.output.messages`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | Messages returned by the model where each message represents a specific model response (choice, candidate). [14] | [
{
"role": "assistant",
"parts": [
{
"type": "text",
"content": "The weather in Paris is currently rainy with a temperature of 57°F."
}
],
"finish_reason": "stop"
}
] |
+| [`gen_ai.system_instructions`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | The system message or instructions provided to the GenAI model separately from the chat history. [15] | [
{
"type": "text",
"content": "You are an Agent that greet users, always use greetings tool to respond"
}
]; [
{
"type": "text",
"content": "You are a language translator."
},
{
"type": "text",
"content": "Your mission is to translate text in English to French."
}
] |
+| [`gen_ai.tool.definitions`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | The list of source system tool definitions available to the GenAI agent or model. [16] | [
{
"type": "function",
"name": "get_current_weather",
"description": "Get the current weather in a given location",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city and state, e.g. San Francisco, CA"
},
"unit": {
"type": "string",
"enum": [
"celsius",
"fahrenheit"
]
}
},
"required": [
"location",
"unit"
]
}
}
] |
+
+**[1] `gen_ai.operation.name`:** If one of the predefined values applies, but specific system uses a different name it's RECOMMENDED to document it in the semantic conventions for specific GenAI system and use system-specific name in the instrumentation. If a different name is not documented, instrumentation libraries SHOULD use applicable predefined value.
+
+**[2] `error.type`:** The `error.type` SHOULD match the error code returned by the Generative AI provider or the client library,
+the canonical name of exception that occurred, or another low-cardinality error identifier.
+Instrumentations SHOULD document the list of errors they report.
+
+**[3] `gen_ai.conversation.id`:** Instrumentations SHOULD populate conversation id when they have it readily available
+for a given operation, for example:
+
+- when client framework being instrumented manages conversation history
+(see [LlamaIndex chat store](https://docs.llamaindex.ai/en/stable/module_guides/storing/chat_stores/))
+- when instrumenting GenAI client libraries that maintain conversation on the backend side
+(see [AWS Bedrock agent sessions](https://docs.aws.amazon.com/bedrock/latest/userguide/agents-session-state.html),
+[OpenAI Assistant threads](https://platform.openai.com/docs/api-reference/threads))
+
+Application developers that manage conversation history MAY add conversation id to GenAI and other
+spans or logs using custom span or log record processors or hooks provided by instrumentation
+libraries.
+
+**[4] `gen_ai.output.type`:** when applicable and if the request includes an output format.
+
+**[5] `gen_ai.output.type`:** This attribute SHOULD be used when the client requests output of a specific type. The model may return zero or more outputs of this type.
+This attribute specifies the output modality and not the actual output format. For example, if an image is requested, the actual output could be a URL pointing to an image file.
+Additional output format details may be recorded in the future in the `gen_ai.output.{type}.*` attributes.
+
+**[6] `gen_ai.request.model`:** The name of the GenAI model a request is being made to. If the model is supplied by a vendor, then the value must be the exact name of the model requested. If the model is a fine-tuned custom model, the value should have a more specific name than the base model that's been fine-tuned.
+
+**[7] `server.port`:** When observed from the client side, and when communicating through an intermediary, `server.port` SHOULD represent the server port behind any intermediaries, for example proxies, if it's available.
+
+**[8] `gen_ai.response.model`:** If available. The name of the GenAI model that provided the response. If the model is supplied by a vendor, then the value must be the exact name of the model actually used. If the model is a fine-tuned custom model, the value should have a more specific name than the base model that's been fine-tuned.
+
+**[9] `gen_ai.usage.cache_creation.input_tokens`:** Anthropic reports this separately from `input_tokens`. This value MUST be added to the Anthropic `input_tokens` to compute `gen_ai.usage.input_tokens`.
+
+**[10] `gen_ai.usage.cache_read.input_tokens`:** Anthropic reports this separately from `input_tokens`. This value MUST be added to the Anthropic `input_tokens` to compute `gen_ai.usage.input_tokens`.
+
+**[11] `gen_ai.usage.input_tokens`:** Anthropic `input_tokens` excludes cached tokens. Compute: `gen_ai.usage.input_tokens = input_tokens + cache_read_input_tokens + cache_creation_input_tokens`
+
+**[12] `server.address`:** When observed from the client side, and when communicating through an intermediary, `server.address` SHOULD represent the server address behind any intermediaries, for example proxies, if it's available.
+
+**[13] `gen_ai.input.messages`:** Instrumentations MUST follow [Input messages JSON schema](/docs/gen-ai/gen-ai-input-messages.json).
+When the attribute is recorded on events, it MUST be recorded in structured
+form. When recorded on spans, it MAY be recorded as a JSON string if structured
+format is not supported and SHOULD be recorded in structured form otherwise.
+
+Messages MUST be provided in the order they were sent to the model.
+Instrumentations MAY provide a way for users to filter or truncate
+input messages.
+
+> [!Warning]
+> This attribute is likely to contain sensitive information including user/PII data.
+
+See [Recording content on attributes](/docs/gen-ai/gen-ai-spans.md#recording-content-on-attributes)
+section for more details.
+
+**[14] `gen_ai.output.messages`:** Instrumentations MUST follow [Output messages JSON schema](/docs/gen-ai/gen-ai-output-messages.json)
+
+Each message represents a single output choice/candidate generated by
+the model. Each message corresponds to exactly one generation
+(choice/candidate) and vice versa - one choice cannot be split across
+multiple messages or one message cannot contain parts from multiple choices.
+
+When the attribute is recorded on events, it MUST be recorded in structured
+form. When recorded on spans, it MAY be recorded as a JSON string if structured
+format is not supported and SHOULD be recorded in structured form otherwise.
+
+Instrumentations MAY provide a way for users to filter or truncate
+output messages.
+
+> [!Warning]
+> This attribute is likely to contain sensitive information including user/PII data.
+
+See [Recording content on attributes](/docs/gen-ai/gen-ai-spans.md#recording-content-on-attributes)
+section for more details.
+
+**[15] `gen_ai.system_instructions`:** This attribute SHOULD be used when the corresponding provider or API
+allows to provide system instructions or messages separately from the
+chat history.
+
+Instructions that are part of the chat history SHOULD be recorded in
+`gen_ai.input.messages` attribute instead.
+
+Instrumentations MUST follow [System instructions JSON schema](/docs/gen-ai/gen-ai-system-instructions.json).
+
+When recorded on spans, it MAY be recorded as a JSON string if structured
+format is not supported and SHOULD be recorded in structured form otherwise.
+
+Instrumentations MAY provide a way for users to filter or truncate
+system instructions.
+
+> [!Warning]
+> This attribute may contain sensitive information.
+
+See [Recording content on attributes](/docs/gen-ai/gen-ai-spans.md#recording-content-on-attributes)
+section for more details.
+
+**[16] `gen_ai.tool.definitions`:** The value of this attribute matches source system tool definition format.
+
+It's expected to be an array of objects where each object represents a tool definition. In case a serialized string is available
+to the instrumentation, the instrumentation SHOULD do the best effort to
+deserialize it to an array. When recorded on spans, it MAY be recorded as a JSON string if structured format is not supported and SHOULD be recorded in structured form otherwise.
+
+Since this attribute could be large, it's NOT RECOMMENDED to populate
+it by default. Instrumentations MAY provide a way to enable
+populating this attribute.
+
+---
+
+`error.type` has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used.
+
+| Value | Description | Stability |
+| --- | --- | --- |
+| `_OTHER` | A fallback error value to be used when the instrumentation doesn't define a custom value. |  |
+
+---
+
+`gen_ai.operation.name` has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used.
+
+| Value | Description | Stability |
+| --- | --- | --- |
+| `chat` | Chat completion operation such as [OpenAI Chat API](https://platform.openai.com/docs/api-reference/chat) |  |
+| `create_agent` | Create GenAI agent |  |
+| `embeddings` | Embeddings operation such as [OpenAI Create embeddings API](https://platform.openai.com/docs/api-reference/embeddings/create) |  |
+| `execute_tool` | Execute a tool |  |
+| `generate_content` | Multimodal content generation operation such as [Gemini Generate Content](https://ai.google.dev/api/generate-content) |  |
+| `invoke_agent` | Invoke GenAI agent |  |
+| `retrieval` | Retrieval operation such as [OpenAI Search Vector Store API](https://platform.openai.com/docs/api-reference/vector-stores/search) |  |
+| `text_completion` | Text completions operation such as [OpenAI Completions API (Legacy)](https://platform.openai.com/docs/api-reference/completions) |  |
+
+---
+
+`gen_ai.output.type` has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used.
+
+| Value | Description | Stability |
+| --- | --- | --- |
+| `image` | Image |  |
+| `json` | JSON object with known or unknown schema |  |
+| `speech` | Speech |  |
+| `text` | Plain text |  |
+
+
+
+
+
+### Embedding
+
+See [common embedding span definition](./gen-ai-spans.md#embeddings).
+
+## Metrics
+
+Anthropic metrics follow generic [Generative AI metrics](gen-ai-metrics.md).
+
+[DocumentStatus]: https://opentelemetry.io/docs/specs/otel/document-status
diff --git a/docs/gen-ai/aws-bedrock.md b/docs/gen-ai/aws-bedrock.md
index 5f60f9ba6e..e26f7a655a 100644
--- a/docs/gen-ai/aws-bedrock.md
+++ b/docs/gen-ai/aws-bedrock.md
@@ -75,13 +75,15 @@ Describes an AWS Bedrock operation span.
| [`gen_ai.response.finish_reasons`](/docs/registry/attributes/gen-ai.md) |  | `Recommended` | string[] | Array of reasons the model stopped generating tokens, corresponding to each generation received. | `["stop"]`; `["stop", "length"]` |
| [`gen_ai.response.id`](/docs/registry/attributes/gen-ai.md) |  | `Recommended` | string | The unique identifier for the completion. | `chatcmpl-123` |
| [`gen_ai.response.model`](/docs/registry/attributes/gen-ai.md) |  | `Recommended` | string | The name of the model that generated the response. [9] | `gpt-4-0613` |
-| [`gen_ai.usage.input_tokens`](/docs/registry/attributes/gen-ai.md) |  | `Recommended` | int | The number of tokens used in the GenAI input (prompt). | `100` |
+| [`gen_ai.usage.cache_creation.input_tokens`](/docs/registry/attributes/gen-ai.md) |  | `Recommended` | int | The number of input tokens written to a provider-managed cache. [10] | `25` |
+| [`gen_ai.usage.cache_read.input_tokens`](/docs/registry/attributes/gen-ai.md) |  | `Recommended` | int | The number of input tokens served from a provider-managed cache. [11] | `50` |
+| [`gen_ai.usage.input_tokens`](/docs/registry/attributes/gen-ai.md) |  | `Recommended` | int | The number of tokens used in the GenAI input (prompt). [12] | `100` |
| [`gen_ai.usage.output_tokens`](/docs/registry/attributes/gen-ai.md) |  | `Recommended` | int | The number of tokens used in the GenAI response (completion). | `180` |
-| [`server.address`](/docs/registry/attributes/server.md) |  | `Recommended` | string | GenAI server address. [10] | `example.com`; `10.1.2.80`; `/tmp/my.sock` |
-| [`gen_ai.input.messages`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | The chat history provided to the model as an input. [11] | [
{
"role": "user",
"parts": [
{
"type": "text",
"content": "Weather in Paris?"
}
]
},
{
"role": "assistant",
"parts": [
{
"type": "tool_call",
"id": "call_VSPygqKTWdrhaFErNvMV18Yl",
"name": "get_weather",
"arguments": {
"location": "Paris"
}
}
]
},
{
"role": "tool",
"parts": [
{
"type": "tool_call_response",
"id": " call_VSPygqKTWdrhaFErNvMV18Yl",
"result": "rainy, 57°F"
}
]
}
] |
-| [`gen_ai.output.messages`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | Messages returned by the model where each message represents a specific model response (choice, candidate). [12] | [
{
"role": "assistant",
"parts": [
{
"type": "text",
"content": "The weather in Paris is currently rainy with a temperature of 57°F."
}
],
"finish_reason": "stop"
}
] |
-| [`gen_ai.system_instructions`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | The system message or instructions provided to the GenAI model separately from the chat history. [13] | [
{
"type": "text",
"content": "You are an Agent that greet users, always use greetings tool to respond"
}
]; [
{
"type": "text",
"content": "You are a language translator."
},
{
"type": "text",
"content": "Your mission is to translate text in English to French."
}
] |
-| [`gen_ai.tool.definitions`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | The list of source system tool definitions available to the GenAI agent or model. [14] | [
{
"type": "function",
"name": "get_current_weather",
"description": "Get the current weather in a given location",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city and state, e.g. San Francisco, CA"
},
"unit": {
"type": "string",
"enum": [
"celsius",
"fahrenheit"
]
}
},
"required": [
"location",
"unit"
]
}
}
] |
+| [`server.address`](/docs/registry/attributes/server.md) |  | `Recommended` | string | GenAI server address. [13] | `example.com`; `10.1.2.80`; `/tmp/my.sock` |
+| [`gen_ai.input.messages`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | The chat history provided to the model as an input. [14] | [
{
"role": "user",
"parts": [
{
"type": "text",
"content": "Weather in Paris?"
}
]
},
{
"role": "assistant",
"parts": [
{
"type": "tool_call",
"id": "call_VSPygqKTWdrhaFErNvMV18Yl",
"name": "get_weather",
"arguments": {
"location": "Paris"
}
}
]
},
{
"role": "tool",
"parts": [
{
"type": "tool_call_response",
"id": " call_VSPygqKTWdrhaFErNvMV18Yl",
"result": "rainy, 57°F"
}
]
}
] |
+| [`gen_ai.output.messages`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | Messages returned by the model where each message represents a specific model response (choice, candidate). [15] | [
{
"role": "assistant",
"parts": [
{
"type": "text",
"content": "The weather in Paris is currently rainy with a temperature of 57°F."
}
],
"finish_reason": "stop"
}
] |
+| [`gen_ai.system_instructions`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | The system message or instructions provided to the GenAI model separately from the chat history. [16] | [
{
"type": "text",
"content": "You are an Agent that greet users, always use greetings tool to respond"
}
]; [
{
"type": "text",
"content": "You are a language translator."
},
{
"type": "text",
"content": "Your mission is to translate text in English to French."
}
] |
+| [`gen_ai.tool.definitions`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | The list of source system tool definitions available to the GenAI agent or model. [17] | [
{
"type": "function",
"name": "get_current_weather",
"description": "Get the current weather in a given location",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city and state, e.g. San Francisco, CA"
},
"unit": {
"type": "string",
"enum": [
"celsius",
"fahrenheit"
]
}
},
"required": [
"location",
"unit"
]
}
}
] |
**[1] `gen_ai.operation.name`:** If one of the predefined values applies, but specific system uses a different name it's RECOMMENDED to document it in the semantic conventions for specific GenAI system and use system-specific name in the instrumentation. If a different name is not documented, instrumentation libraries SHOULD use applicable predefined value.
@@ -133,9 +135,18 @@ Additional output format details may be recorded in the future in the `gen_ai.ou
**[9] `gen_ai.response.model`:** If available. The name of the GenAI model that provided the response. If the model is supplied by a vendor, then the value must be the exact name of the model actually used. If the model is a fine-tuned custom model, the value should have a more specific name than the base model that's been fine-tuned.
-**[10] `server.address`:** When observed from the client side, and when communicating through an intermediary, `server.address` SHOULD represent the server address behind any intermediaries, for example proxies, if it's available.
+**[10] `gen_ai.usage.cache_creation.input_tokens`:** The value SHOULD be included in `gen_ai.usage.input_tokens`.
-**[11] `gen_ai.input.messages`:** Instrumentations MUST follow [Input messages JSON schema](/docs/gen-ai/gen-ai-input-messages.json).
+**[11] `gen_ai.usage.cache_read.input_tokens`:** The value SHOULD be included in `gen_ai.usage.input_tokens`.
+
+**[12] `gen_ai.usage.input_tokens`:** This value SHOULD include all types of input tokens, including cached tokens.
+Instrumentations SHOULD make a best effort to populate this value, using a total
+provided by the provider when available or, depending on the provider API,
+by summing different token types parsed from the provider output.
+
+**[13] `server.address`:** When observed from the client side, and when communicating through an intermediary, `server.address` SHOULD represent the server address behind any intermediaries, for example proxies, if it's available.
+
+**[14] `gen_ai.input.messages`:** Instrumentations MUST follow [Input messages JSON schema](/docs/gen-ai/gen-ai-input-messages.json).
When the attribute is recorded on events, it MUST be recorded in structured
form. When recorded on spans, it MAY be recorded as a JSON string if structured
format is not supported and SHOULD be recorded in structured form otherwise.
@@ -150,7 +161,7 @@ input messages.
See [Recording content on attributes](/docs/gen-ai/gen-ai-spans.md#recording-content-on-attributes)
section for more details.
-**[12] `gen_ai.output.messages`:** Instrumentations MUST follow [Output messages JSON schema](/docs/gen-ai/gen-ai-output-messages.json)
+**[15] `gen_ai.output.messages`:** Instrumentations MUST follow [Output messages JSON schema](/docs/gen-ai/gen-ai-output-messages.json)
Each message represents a single output choice/candidate generated by
the model. Each message corresponds to exactly one generation
@@ -170,7 +181,7 @@ output messages.
See [Recording content on attributes](/docs/gen-ai/gen-ai-spans.md#recording-content-on-attributes)
section for more details.
-**[13] `gen_ai.system_instructions`:** This attribute SHOULD be used when the corresponding provider or API
+**[16] `gen_ai.system_instructions`:** This attribute SHOULD be used when the corresponding provider or API
allows to provide system instructions or messages separately from the
chat history.
@@ -191,7 +202,7 @@ system instructions.
See [Recording content on attributes](/docs/gen-ai/gen-ai-spans.md#recording-content-on-attributes)
section for more details.
-**[14] `gen_ai.tool.definitions`:** The value of this attribute matches source system tool definition format.
+**[17] `gen_ai.tool.definitions`:** The value of this attribute matches source system tool definition format.
It's expected to be an array of objects where each object represents a tool definition. In case a serialized string is available
to the instrumentation, the instrumentation SHOULD do the best effort to
@@ -256,9 +267,9 @@ and SHOULD be provided **at span creation time** (if provided at all):
| `azure.ai.openai` | [Azure OpenAI](https://azure.microsoft.com/products/ai-services/openai-service/) |  |
| `cohere` | [Cohere](https://cohere.com/) |  |
| `deepseek` | [DeepSeek](https://www.deepseek.com/) |  |
-| `gcp.gemini` | [Gemini](https://cloud.google.com/products/gemini) [15] |  |
-| `gcp.gen_ai` | Any Google generative AI endpoint [16] |  |
-| `gcp.vertex_ai` | [Vertex AI](https://cloud.google.com/vertex-ai) [17] |  |
+| `gcp.gemini` | [Gemini](https://cloud.google.com/products/gemini) [18] |  |
+| `gcp.gen_ai` | Any Google generative AI endpoint [19] |  |
+| `gcp.vertex_ai` | [Vertex AI](https://cloud.google.com/vertex-ai) [20] |  |
| `groq` | [Groq](https://groq.com/) |  |
| `ibm.watsonx.ai` | [IBM Watsonx AI](https://www.ibm.com/products/watsonx-ai) |  |
| `mistral_ai` | [Mistral AI](https://mistral.ai/) |  |
@@ -266,11 +277,11 @@ and SHOULD be provided **at span creation time** (if provided at all):
| `perplexity` | [Perplexity](https://www.perplexity.ai/) |  |
| `x_ai` | [xAI](https://x.ai/) |  |
-**[15]:** Used when accessing the 'generativelanguage.googleapis.com' endpoint. Also known as the AI Studio API.
+**[18]:** Used when accessing the 'generativelanguage.googleapis.com' endpoint. Also known as the AI Studio API.
-**[16]:** May be used when specific backend is unknown.
+**[19]:** May be used when specific backend is unknown.
-**[17]:** Used when accessing the 'aiplatform.googleapis.com' endpoint.
+**[20]:** Used when accessing the 'aiplatform.googleapis.com' endpoint.
diff --git a/docs/gen-ai/azure-ai-inference.md b/docs/gen-ai/azure-ai-inference.md
index a704b0a70d..8d1fa1acbc 100644
--- a/docs/gen-ai/azure-ai-inference.md
+++ b/docs/gen-ai/azure-ai-inference.md
@@ -84,13 +84,15 @@ model name is available and `{gen_ai.operation.name}` otherwise.
| [`gen_ai.response.finish_reasons`](/docs/registry/attributes/gen-ai.md) |  | `Recommended` | string[] | Array of reasons the model stopped generating tokens, corresponding to each generation received. | `["stop"]`; `["stop", "length"]` |
| [`gen_ai.response.id`](/docs/registry/attributes/gen-ai.md) |  | `Recommended` | string | The unique identifier for the completion. | `chatcmpl-123` |
| [`gen_ai.response.model`](/docs/registry/attributes/gen-ai.md) |  | `Recommended` | string | The name of the model that generated the response. [9] | `gpt-4-0613` |
-| [`gen_ai.usage.input_tokens`](/docs/registry/attributes/gen-ai.md) |  | `Recommended` | int | The number of prompt tokens as reported in the usage prompt_tokens property of the response. | `100` |
+| [`gen_ai.usage.cache_creation.input_tokens`](/docs/registry/attributes/gen-ai.md) |  | `Recommended` | int | The number of input tokens written to a provider-managed cache. [10] | `25` |
+| [`gen_ai.usage.cache_read.input_tokens`](/docs/registry/attributes/gen-ai.md) |  | `Recommended` | int | The number of input tokens served from a provider-managed cache. [11] | `50` |
+| [`gen_ai.usage.input_tokens`](/docs/registry/attributes/gen-ai.md) |  | `Recommended` | int | The number of prompt tokens as reported in the usage prompt_tokens property of the response. [12] | `100` |
| [`gen_ai.usage.output_tokens`](/docs/registry/attributes/gen-ai.md) |  | `Recommended` | int | The number of completion tokens as reported in the usage completion_tokens property of the response. | `180` |
-| [`server.address`](/docs/registry/attributes/server.md) |  | `Recommended` | string | GenAI server address. [10] | `example.com`; `10.1.2.80`; `/tmp/my.sock` |
-| [`gen_ai.input.messages`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | The chat history provided to the model as an input. [11] | [
{
"role": "user",
"parts": [
{
"type": "text",
"content": "Weather in Paris?"
}
]
},
{
"role": "assistant",
"parts": [
{
"type": "tool_call",
"id": "call_VSPygqKTWdrhaFErNvMV18Yl",
"name": "get_weather",
"arguments": {
"location": "Paris"
}
}
]
},
{
"role": "tool",
"parts": [
{
"type": "tool_call_response",
"id": " call_VSPygqKTWdrhaFErNvMV18Yl",
"result": "rainy, 57°F"
}
]
}
] |
-| [`gen_ai.output.messages`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | Messages returned by the model where each message represents a specific model response (choice, candidate). [12] | [
{
"role": "assistant",
"parts": [
{
"type": "text",
"content": "The weather in Paris is currently rainy with a temperature of 57°F."
}
],
"finish_reason": "stop"
}
] |
-| [`gen_ai.system_instructions`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | The system message or instructions provided to the GenAI model separately from the chat history. [13] | [
{
"type": "text",
"content": "You are an Agent that greet users, always use greetings tool to respond"
}
]; [
{
"type": "text",
"content": "You are a language translator."
},
{
"type": "text",
"content": "Your mission is to translate text in English to French."
}
] |
-| [`gen_ai.tool.definitions`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | The list of source system tool definitions available to the GenAI agent or model. [14] | [
{
"type": "function",
"name": "get_current_weather",
"description": "Get the current weather in a given location",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city and state, e.g. San Francisco, CA"
},
"unit": {
"type": "string",
"enum": [
"celsius",
"fahrenheit"
]
}
},
"required": [
"location",
"unit"
]
}
}
] |
+| [`server.address`](/docs/registry/attributes/server.md) |  | `Recommended` | string | GenAI server address. [13] | `example.com`; `10.1.2.80`; `/tmp/my.sock` |
+| [`gen_ai.input.messages`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | The chat history provided to the model as an input. [14] | [
{
"role": "user",
"parts": [
{
"type": "text",
"content": "Weather in Paris?"
}
]
},
{
"role": "assistant",
"parts": [
{
"type": "tool_call",
"id": "call_VSPygqKTWdrhaFErNvMV18Yl",
"name": "get_weather",
"arguments": {
"location": "Paris"
}
}
]
},
{
"role": "tool",
"parts": [
{
"type": "tool_call_response",
"id": " call_VSPygqKTWdrhaFErNvMV18Yl",
"result": "rainy, 57°F"
}
]
}
] |
+| [`gen_ai.output.messages`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | Messages returned by the model where each message represents a specific model response (choice, candidate). [15] | [
{
"role": "assistant",
"parts": [
{
"type": "text",
"content": "The weather in Paris is currently rainy with a temperature of 57°F."
}
],
"finish_reason": "stop"
}
] |
+| [`gen_ai.system_instructions`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | The system message or instructions provided to the GenAI model separately from the chat history. [16] | [
{
"type": "text",
"content": "You are an Agent that greet users, always use greetings tool to respond"
}
]; [
{
"type": "text",
"content": "You are a language translator."
},
{
"type": "text",
"content": "Your mission is to translate text in English to French."
}
] |
+| [`gen_ai.tool.definitions`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | The list of source system tool definitions available to the GenAI agent or model. [17] | [
{
"type": "function",
"name": "get_current_weather",
"description": "Get the current weather in a given location",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city and state, e.g. San Francisco, CA"
},
"unit": {
"type": "string",
"enum": [
"celsius",
"fahrenheit"
]
}
},
"required": [
"location",
"unit"
]
}
}
] |
**[1] `gen_ai.operation.name`:** If one of the predefined values applies, but specific system uses a different name it's RECOMMENDED to document it in the semantic conventions for specific GenAI system and use system-specific name in the instrumentation. If a different name is not documented, instrumentation libraries SHOULD use applicable predefined value.
@@ -135,9 +137,18 @@ Additional output format details may be recorded in the future in the
**[9] `gen_ai.response.model`:** If available. The name of the GenAI model that provided the response. If the model is supplied by a vendor, then the value must be the exact name of the model actually used. If the model is a fine-tuned custom model, the value should have a more specific name than the base model that's been fine-tuned.
-**[10] `server.address`:** When observed from the client side, and when communicating through an intermediary, `server.address` SHOULD represent the server address behind any intermediaries, for example proxies, if it's available.
+**[10] `gen_ai.usage.cache_creation.input_tokens`:** The value SHOULD be included in `gen_ai.usage.input_tokens`.
-**[11] `gen_ai.input.messages`:** Instrumentations MUST follow [Input messages JSON schema](/docs/gen-ai/gen-ai-input-messages.json).
+**[11] `gen_ai.usage.cache_read.input_tokens`:** The value SHOULD be included in `gen_ai.usage.input_tokens`.
+
+**[12] `gen_ai.usage.input_tokens`:** This value SHOULD include all types of input tokens, including cached tokens.
+Instrumentations SHOULD make a best effort to populate this value, using a total
+provided by the provider when available or, depending on the provider API,
+by summing different token types parsed from the provider output.
+
+**[13] `server.address`:** When observed from the client side, and when communicating through an intermediary, `server.address` SHOULD represent the server address behind any intermediaries, for example proxies, if it's available.
+
+**[14] `gen_ai.input.messages`:** Instrumentations MUST follow [Input messages JSON schema](/docs/gen-ai/gen-ai-input-messages.json).
When the attribute is recorded on events, it MUST be recorded in structured
form. When recorded on spans, it MAY be recorded as a JSON string if structured
format is not supported and SHOULD be recorded in structured form otherwise.
@@ -152,7 +163,7 @@ input messages.
See [Recording content on attributes](/docs/gen-ai/gen-ai-spans.md#recording-content-on-attributes)
section for more details.
-**[12] `gen_ai.output.messages`:** Instrumentations MUST follow [Output messages JSON schema](/docs/gen-ai/gen-ai-output-messages.json)
+**[15] `gen_ai.output.messages`:** Instrumentations MUST follow [Output messages JSON schema](/docs/gen-ai/gen-ai-output-messages.json)
Each message represents a single output choice/candidate generated by
the model. Each message corresponds to exactly one generation
@@ -172,7 +183,7 @@ output messages.
See [Recording content on attributes](/docs/gen-ai/gen-ai-spans.md#recording-content-on-attributes)
section for more details.
-**[13] `gen_ai.system_instructions`:** This attribute SHOULD be used when the corresponding provider or API
+**[16] `gen_ai.system_instructions`:** This attribute SHOULD be used when the corresponding provider or API
allows to provide system instructions or messages separately from the
chat history.
@@ -193,7 +204,7 @@ system instructions.
See [Recording content on attributes](/docs/gen-ai/gen-ai-spans.md#recording-content-on-attributes)
section for more details.
-**[14] `gen_ai.tool.definitions`:** The value of this attribute matches source system tool definition format.
+**[17] `gen_ai.tool.definitions`:** The value of this attribute matches source system tool definition format.
It's expected to be an array of objects where each object represents a tool definition. In case a serialized string is available
to the instrumentation, the instrumentation SHOULD do the best effort to
diff --git a/docs/gen-ai/gen-ai-agent-spans.md b/docs/gen-ai/gen-ai-agent-spans.md
index 6b0891a2bf..b1e323833e 100644
--- a/docs/gen-ai/gen-ai-agent-spans.md
+++ b/docs/gen-ai/gen-ai-agent-spans.md
@@ -232,13 +232,15 @@ Examples of span kinds for different agent scenarios:
| [`gen_ai.response.finish_reasons`](/docs/registry/attributes/gen-ai.md) |  | `Recommended` | string[] | Array of reasons the model stopped generating tokens, corresponding to each generation received. | `["stop"]`; `["stop", "length"]` |
| [`gen_ai.response.id`](/docs/registry/attributes/gen-ai.md) |  | `Recommended` | string | The unique identifier for the completion. | `chatcmpl-123` |
| [`gen_ai.response.model`](/docs/registry/attributes/gen-ai.md) |  | `Recommended` | string | The name of the model that generated the response. [10] | `gpt-4-0613` |
-| [`gen_ai.usage.input_tokens`](/docs/registry/attributes/gen-ai.md) |  | `Recommended` | int | The number of tokens used in the GenAI input (prompt). | `100` |
+| [`gen_ai.usage.cache_creation.input_tokens`](/docs/registry/attributes/gen-ai.md) |  | `Recommended` | int | The number of input tokens written to a provider-managed cache. [11] | `25` |
+| [`gen_ai.usage.cache_read.input_tokens`](/docs/registry/attributes/gen-ai.md) |  | `Recommended` | int | The number of input tokens served from a provider-managed cache. [12] | `50` |
+| [`gen_ai.usage.input_tokens`](/docs/registry/attributes/gen-ai.md) |  | `Recommended` | int | The number of tokens used in the GenAI input (prompt). [13] | `100` |
| [`gen_ai.usage.output_tokens`](/docs/registry/attributes/gen-ai.md) |  | `Recommended` | int | The number of tokens used in the GenAI response (completion). | `180` |
-| [`server.address`](/docs/registry/attributes/server.md) |  | `Recommended` when span kind is `CLIENT`. | string | GenAI server address. [11] | `example.com`; `10.1.2.80`; `/tmp/my.sock` |
-| [`gen_ai.input.messages`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | The chat history provided to the model as an input. [12] | [
{
"role": "user",
"parts": [
{
"type": "text",
"content": "Weather in Paris?"
}
]
},
{
"role": "assistant",
"parts": [
{
"type": "tool_call",
"id": "call_VSPygqKTWdrhaFErNvMV18Yl",
"name": "get_weather",
"arguments": {
"location": "Paris"
}
}
]
},
{
"role": "tool",
"parts": [
{
"type": "tool_call_response",
"id": " call_VSPygqKTWdrhaFErNvMV18Yl",
"result": "rainy, 57°F"
}
]
}
] |
-| [`gen_ai.output.messages`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | Messages returned by the model where each message represents a specific model response (choice, candidate). [13] | [
{
"role": "assistant",
"parts": [
{
"type": "text",
"content": "The weather in Paris is currently rainy with a temperature of 57°F."
}
],
"finish_reason": "stop"
}
] |
-| [`gen_ai.system_instructions`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | The system message or instructions provided to the GenAI model separately from the chat history. [14] | [
{
"type": "text",
"content": "You are an Agent that greet users, always use greetings tool to respond"
}
]; [
{
"type": "text",
"content": "You are a language translator."
},
{
"type": "text",
"content": "Your mission is to translate text in English to French."
}
] |
-| [`gen_ai.tool.definitions`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | The list of source system tool definitions available to the GenAI agent or model. [15] | [
{
"type": "function",
"name": "get_current_weather",
"description": "Get the current weather in a given location",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city and state, e.g. San Francisco, CA"
},
"unit": {
"type": "string",
"enum": [
"celsius",
"fahrenheit"
]
}
},
"required": [
"location",
"unit"
]
}
}
] |
+| [`server.address`](/docs/registry/attributes/server.md) |  | `Recommended` when span kind is `CLIENT`. | string | GenAI server address. [14] | `example.com`; `10.1.2.80`; `/tmp/my.sock` |
+| [`gen_ai.input.messages`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | The chat history provided to the model as an input. [15] | [
{
"role": "user",
"parts": [
{
"type": "text",
"content": "Weather in Paris?"
}
]
},
{
"role": "assistant",
"parts": [
{
"type": "tool_call",
"id": "call_VSPygqKTWdrhaFErNvMV18Yl",
"name": "get_weather",
"arguments": {
"location": "Paris"
}
}
]
},
{
"role": "tool",
"parts": [
{
"type": "tool_call_response",
"id": " call_VSPygqKTWdrhaFErNvMV18Yl",
"result": "rainy, 57°F"
}
]
}
] |
+| [`gen_ai.output.messages`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | Messages returned by the model where each message represents a specific model response (choice, candidate). [16] | [
{
"role": "assistant",
"parts": [
{
"type": "text",
"content": "The weather in Paris is currently rainy with a temperature of 57°F."
}
],
"finish_reason": "stop"
}
] |
+| [`gen_ai.system_instructions`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | The system message or instructions provided to the GenAI model separately from the chat history. [17] | [
{
"type": "text",
"content": "You are an Agent that greet users, always use greetings tool to respond"
}
]; [
{
"type": "text",
"content": "You are a language translator."
},
{
"type": "text",
"content": "Your mission is to translate text in English to French."
}
] |
+| [`gen_ai.tool.definitions`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | The list of source system tool definitions available to the GenAI agent or model. [18] | [
{
"type": "function",
"name": "get_current_weather",
"description": "Get the current weather in a given location",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city and state, e.g. San Francisco, CA"
},
"unit": {
"type": "string",
"enum": [
"celsius",
"fahrenheit"
]
}
},
"required": [
"location",
"unit"
]
}
}
] |
**[1] `gen_ai.operation.name`:** If one of the predefined values applies, but specific system uses a different name it's RECOMMENDED to document it in the semantic conventions for specific GenAI system and use system-specific name in the instrumentation. If a different name is not documented, instrumentation libraries SHOULD use applicable predefined value.
@@ -292,9 +294,18 @@ Additional output format details may be recorded in the future in the `gen_ai.ou
**[10] `gen_ai.response.model`:** If available. The name of the GenAI model that provided the response. If the model is supplied by a vendor, then the value must be the exact name of the model actually used. If the model is a fine-tuned custom model, the value should have a more specific name than the base model that's been fine-tuned.
-**[11] `server.address`:** When observed from the client side, and when communicating through an intermediary, `server.address` SHOULD represent the server address behind any intermediaries, for example proxies, if it's available.
+**[11] `gen_ai.usage.cache_creation.input_tokens`:** The value SHOULD be included in `gen_ai.usage.input_tokens`.
-**[12] `gen_ai.input.messages`:** Instrumentations MUST follow [Input messages JSON schema](/docs/gen-ai/gen-ai-input-messages.json).
+**[12] `gen_ai.usage.cache_read.input_tokens`:** The value SHOULD be included in `gen_ai.usage.input_tokens`.
+
+**[13] `gen_ai.usage.input_tokens`:** This value SHOULD include all types of input tokens, including cached tokens.
+Instrumentations SHOULD make a best effort to populate this value, using a total
+provided by the provider when available or, depending on the provider API,
+by summing different token types parsed from the provider output.
+
+**[14] `server.address`:** When observed from the client side, and when communicating through an intermediary, `server.address` SHOULD represent the server address behind any intermediaries, for example proxies, if it's available.
+
+**[15] `gen_ai.input.messages`:** Instrumentations MUST follow [Input messages JSON schema](/docs/gen-ai/gen-ai-input-messages.json).
When the attribute is recorded on events, it MUST be recorded in structured
form. When recorded on spans, it MAY be recorded as a JSON string if structured
format is not supported and SHOULD be recorded in structured form otherwise.
@@ -309,7 +320,7 @@ input messages.
See [Recording content on attributes](/docs/gen-ai/gen-ai-spans.md#recording-content-on-attributes)
section for more details.
-**[13] `gen_ai.output.messages`:** Instrumentations MUST follow [Output messages JSON schema](/docs/gen-ai/gen-ai-output-messages.json)
+**[16] `gen_ai.output.messages`:** Instrumentations MUST follow [Output messages JSON schema](/docs/gen-ai/gen-ai-output-messages.json)
Each message represents a single output choice/candidate generated by
the model. Each message corresponds to exactly one generation
@@ -329,7 +340,7 @@ output messages.
See [Recording content on attributes](/docs/gen-ai/gen-ai-spans.md#recording-content-on-attributes)
section for more details.
-**[14] `gen_ai.system_instructions`:** This attribute SHOULD be used when the corresponding provider or API
+**[17] `gen_ai.system_instructions`:** This attribute SHOULD be used when the corresponding provider or API
allows to provide system instructions or messages separately from the
chat history.
@@ -350,7 +361,7 @@ system instructions.
See [Recording content on attributes](/docs/gen-ai/gen-ai-spans.md#recording-content-on-attributes)
section for more details.
-**[15] `gen_ai.tool.definitions`:** The value of this attribute matches source system tool definition format.
+**[18] `gen_ai.tool.definitions`:** The value of this attribute matches source system tool definition format.
It's expected to be an array of objects where each object represents a tool definition. In case a serialized string is available
to the instrumentation, the instrumentation SHOULD do the best effort to
@@ -415,9 +426,9 @@ and SHOULD be provided **at span creation time** (if provided at all):
| `azure.ai.openai` | [Azure OpenAI](https://azure.microsoft.com/products/ai-services/openai-service/) |  |
| `cohere` | [Cohere](https://cohere.com/) |  |
| `deepseek` | [DeepSeek](https://www.deepseek.com/) |  |
-| `gcp.gemini` | [Gemini](https://cloud.google.com/products/gemini) [16] |  |
-| `gcp.gen_ai` | Any Google generative AI endpoint [17] |  |
-| `gcp.vertex_ai` | [Vertex AI](https://cloud.google.com/vertex-ai) [18] |  |
+| `gcp.gemini` | [Gemini](https://cloud.google.com/products/gemini) [19] |  |
+| `gcp.gen_ai` | Any Google generative AI endpoint [20] |  |
+| `gcp.vertex_ai` | [Vertex AI](https://cloud.google.com/vertex-ai) [21] |  |
| `groq` | [Groq](https://groq.com/) |  |
| `ibm.watsonx.ai` | [IBM Watsonx AI](https://www.ibm.com/products/watsonx-ai) |  |
| `mistral_ai` | [Mistral AI](https://mistral.ai/) |  |
@@ -425,11 +436,11 @@ and SHOULD be provided **at span creation time** (if provided at all):
| `perplexity` | [Perplexity](https://www.perplexity.ai/) |  |
| `x_ai` | [xAI](https://x.ai/) |  |
-**[16]:** Used when accessing the 'generativelanguage.googleapis.com' endpoint. Also known as the AI Studio API.
+**[19]:** Used when accessing the 'generativelanguage.googleapis.com' endpoint. Also known as the AI Studio API.
-**[17]:** May be used when specific backend is unknown.
+**[20]:** May be used when specific backend is unknown.
-**[18]:** Used when accessing the 'aiplatform.googleapis.com' endpoint.
+**[21]:** Used when accessing the 'aiplatform.googleapis.com' endpoint.
diff --git a/docs/gen-ai/gen-ai-events.md b/docs/gen-ai/gen-ai-events.md
index 65387b2d53..6b0f99cec0 100644
--- a/docs/gen-ai/gen-ai-events.md
+++ b/docs/gen-ai/gen-ai-events.md
@@ -75,13 +75,15 @@ This event is opt-in and could be used to store input and output details indepen
| [`gen_ai.response.finish_reasons`](/docs/registry/attributes/gen-ai.md) |  | `Recommended` | string[] | Array of reasons the model stopped generating tokens, corresponding to each generation received. | `["stop"]`; `["stop", "length"]` |
| [`gen_ai.response.id`](/docs/registry/attributes/gen-ai.md) |  | `Recommended` | string | The unique identifier for the completion. | `chatcmpl-123` |
| [`gen_ai.response.model`](/docs/registry/attributes/gen-ai.md) |  | `Recommended` | string | The name of the model that generated the response. [8] | `gpt-4-0613` |
-| [`gen_ai.usage.input_tokens`](/docs/registry/attributes/gen-ai.md) |  | `Recommended` | int | The number of tokens used in the GenAI input (prompt). | `100` |
+| [`gen_ai.usage.cache_creation.input_tokens`](/docs/registry/attributes/gen-ai.md) |  | `Recommended` | int | The number of input tokens written to a provider-managed cache. [9] | `25` |
+| [`gen_ai.usage.cache_read.input_tokens`](/docs/registry/attributes/gen-ai.md) |  | `Recommended` | int | The number of input tokens served from a provider-managed cache. [10] | `50` |
+| [`gen_ai.usage.input_tokens`](/docs/registry/attributes/gen-ai.md) |  | `Recommended` | int | The number of tokens used in the GenAI input (prompt). [11] | `100` |
| [`gen_ai.usage.output_tokens`](/docs/registry/attributes/gen-ai.md) |  | `Recommended` | int | The number of tokens used in the GenAI response (completion). | `180` |
-| [`server.address`](/docs/registry/attributes/server.md) |  | `Recommended` | string | GenAI server address. [9] | `example.com`; `10.1.2.80`; `/tmp/my.sock` |
-| [`gen_ai.input.messages`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | The chat history provided to the model as an input. [10] | [
{
"role": "user",
"parts": [
{
"type": "text",
"content": "Weather in Paris?"
}
]
},
{
"role": "assistant",
"parts": [
{
"type": "tool_call",
"id": "call_VSPygqKTWdrhaFErNvMV18Yl",
"name": "get_weather",
"arguments": {
"location": "Paris"
}
}
]
},
{
"role": "tool",
"parts": [
{
"type": "tool_call_response",
"id": " call_VSPygqKTWdrhaFErNvMV18Yl",
"result": "rainy, 57°F"
}
]
}
] |
-| [`gen_ai.output.messages`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | Messages returned by the model where each message represents a specific model response (choice, candidate). [11] | [
{
"role": "assistant",
"parts": [
{
"type": "text",
"content": "The weather in Paris is currently rainy with a temperature of 57°F."
}
],
"finish_reason": "stop"
}
] |
-| [`gen_ai.system_instructions`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | The system message or instructions provided to the GenAI model separately from the chat history. [12] | [
{
"type": "text",
"content": "You are an Agent that greet users, always use greetings tool to respond"
}
]; [
{
"type": "text",
"content": "You are a language translator."
},
{
"type": "text",
"content": "Your mission is to translate text in English to French."
}
] |
-| [`gen_ai.tool.definitions`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | The list of source system tool definitions available to the GenAI agent or model. [13] | [
{
"type": "function",
"name": "get_current_weather",
"description": "Get the current weather in a given location",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city and state, e.g. San Francisco, CA"
},
"unit": {
"type": "string",
"enum": [
"celsius",
"fahrenheit"
]
}
},
"required": [
"location",
"unit"
]
}
}
] |
+| [`server.address`](/docs/registry/attributes/server.md) |  | `Recommended` | string | GenAI server address. [12] | `example.com`; `10.1.2.80`; `/tmp/my.sock` |
+| [`gen_ai.input.messages`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | The chat history provided to the model as an input. [13] | [
{
"role": "user",
"parts": [
{
"type": "text",
"content": "Weather in Paris?"
}
]
},
{
"role": "assistant",
"parts": [
{
"type": "tool_call",
"id": "call_VSPygqKTWdrhaFErNvMV18Yl",
"name": "get_weather",
"arguments": {
"location": "Paris"
}
}
]
},
{
"role": "tool",
"parts": [
{
"type": "tool_call_response",
"id": " call_VSPygqKTWdrhaFErNvMV18Yl",
"result": "rainy, 57°F"
}
]
}
] |
+| [`gen_ai.output.messages`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | Messages returned by the model where each message represents a specific model response (choice, candidate). [14] | [
{
"role": "assistant",
"parts": [
{
"type": "text",
"content": "The weather in Paris is currently rainy with a temperature of 57°F."
}
],
"finish_reason": "stop"
}
] |
+| [`gen_ai.system_instructions`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | The system message or instructions provided to the GenAI model separately from the chat history. [15] | [
{
"type": "text",
"content": "You are an Agent that greet users, always use greetings tool to respond"
}
]; [
{
"type": "text",
"content": "You are a language translator."
},
{
"type": "text",
"content": "Your mission is to translate text in English to French."
}
] |
+| [`gen_ai.tool.definitions`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | The list of source system tool definitions available to the GenAI agent or model. [16] | [
{
"type": "function",
"name": "get_current_weather",
"description": "Get the current weather in a given location",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city and state, e.g. San Francisco, CA"
},
"unit": {
"type": "string",
"enum": [
"celsius",
"fahrenheit"
]
}
},
"required": [
"location",
"unit"
]
}
}
] |
**[1] `gen_ai.operation.name`:** If one of the predefined values applies, but specific system uses a different name it's RECOMMENDED to document it in the semantic conventions for specific GenAI system and use system-specific name in the instrumentation. If a different name is not documented, instrumentation libraries SHOULD use applicable predefined value.
@@ -114,9 +116,18 @@ Additional output format details may be recorded in the future in the `gen_ai.ou
**[8] `gen_ai.response.model`:** If available. The name of the GenAI model that provided the response. If the model is supplied by a vendor, then the value must be the exact name of the model actually used. If the model is a fine-tuned custom model, the value should have a more specific name than the base model that's been fine-tuned.
-**[9] `server.address`:** When observed from the client side, and when communicating through an intermediary, `server.address` SHOULD represent the server address behind any intermediaries, for example proxies, if it's available.
+**[9] `gen_ai.usage.cache_creation.input_tokens`:** The value SHOULD be included in `gen_ai.usage.input_tokens`.
-**[10] `gen_ai.input.messages`:** Instrumentations MUST follow [Input messages JSON schema](/docs/gen-ai/gen-ai-input-messages.json).
+**[10] `gen_ai.usage.cache_read.input_tokens`:** The value SHOULD be included in `gen_ai.usage.input_tokens`.
+
+**[11] `gen_ai.usage.input_tokens`:** This value SHOULD include all types of input tokens, including cached tokens.
+Instrumentations SHOULD make a best effort to populate this value, using a total
+provided by the provider when available or, depending on the provider API,
+by summing different token types parsed from the provider output.
+
+**[12] `server.address`:** When observed from the client side, and when communicating through an intermediary, `server.address` SHOULD represent the server address behind any intermediaries, for example proxies, if it's available.
+
+**[13] `gen_ai.input.messages`:** Instrumentations MUST follow [Input messages JSON schema](/docs/gen-ai/gen-ai-input-messages.json).
When the attribute is recorded on events, it MUST be recorded in structured
form. When recorded on spans, it MAY be recorded as a JSON string if structured
format is not supported and SHOULD be recorded in structured form otherwise.
@@ -131,7 +142,7 @@ input messages.
See [Recording content on attributes](/docs/gen-ai/gen-ai-spans.md#recording-content-on-attributes)
section for more details.
-**[11] `gen_ai.output.messages`:** Instrumentations MUST follow [Output messages JSON schema](/docs/gen-ai/gen-ai-output-messages.json)
+**[14] `gen_ai.output.messages`:** Instrumentations MUST follow [Output messages JSON schema](/docs/gen-ai/gen-ai-output-messages.json)
Each message represents a single output choice/candidate generated by
the model. Each message corresponds to exactly one generation
@@ -151,7 +162,7 @@ output messages.
See [Recording content on attributes](/docs/gen-ai/gen-ai-spans.md#recording-content-on-attributes)
section for more details.
-**[12] `gen_ai.system_instructions`:** This attribute SHOULD be used when the corresponding provider or API
+**[15] `gen_ai.system_instructions`:** This attribute SHOULD be used when the corresponding provider or API
allows to provide system instructions or messages separately from the
chat history.
@@ -172,7 +183,7 @@ system instructions.
See [Recording content on attributes](/docs/gen-ai/gen-ai-spans.md#recording-content-on-attributes)
section for more details.
-**[13] `gen_ai.tool.definitions`:** The value of this attribute matches source system tool definition format.
+**[16] `gen_ai.tool.definitions`:** The value of this attribute matches source system tool definition format.
It's expected to be an array of objects where each object represents a tool definition. In case a serialized string is available
to the instrumentation, the instrumentation SHOULD do the best effort to
diff --git a/docs/gen-ai/gen-ai-spans.md b/docs/gen-ai/gen-ai-spans.md
index 1bcfaf690e..3cc6b9ea06 100644
--- a/docs/gen-ai/gen-ai-spans.md
+++ b/docs/gen-ai/gen-ai-spans.md
@@ -89,13 +89,15 @@ client or when the GenAI call happens over instrumented protocol such as HTTP.
| [`gen_ai.response.finish_reasons`](/docs/registry/attributes/gen-ai.md) |  | `Recommended` | string[] | Array of reasons the model stopped generating tokens, corresponding to each generation received. | `["stop"]`; `["stop", "length"]` |
| [`gen_ai.response.id`](/docs/registry/attributes/gen-ai.md) |  | `Recommended` | string | The unique identifier for the completion. | `chatcmpl-123` |
| [`gen_ai.response.model`](/docs/registry/attributes/gen-ai.md) |  | `Recommended` | string | The name of the model that generated the response. [9] | `gpt-4-0613` |
-| [`gen_ai.usage.input_tokens`](/docs/registry/attributes/gen-ai.md) |  | `Recommended` | int | The number of tokens used in the GenAI input (prompt). | `100` |
+| [`gen_ai.usage.cache_creation.input_tokens`](/docs/registry/attributes/gen-ai.md) |  | `Recommended` | int | The number of input tokens written to a provider-managed cache. [10] | `25` |
+| [`gen_ai.usage.cache_read.input_tokens`](/docs/registry/attributes/gen-ai.md) |  | `Recommended` | int | The number of input tokens served from a provider-managed cache. [11] | `50` |
+| [`gen_ai.usage.input_tokens`](/docs/registry/attributes/gen-ai.md) |  | `Recommended` | int | The number of tokens used in the GenAI input (prompt). [12] | `100` |
| [`gen_ai.usage.output_tokens`](/docs/registry/attributes/gen-ai.md) |  | `Recommended` | int | The number of tokens used in the GenAI response (completion). | `180` |
-| [`server.address`](/docs/registry/attributes/server.md) |  | `Recommended` | string | GenAI server address. [10] | `example.com`; `10.1.2.80`; `/tmp/my.sock` |
-| [`gen_ai.input.messages`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | The chat history provided to the model as an input. [11] | [
{
"role": "user",
"parts": [
{
"type": "text",
"content": "Weather in Paris?"
}
]
},
{
"role": "assistant",
"parts": [
{
"type": "tool_call",
"id": "call_VSPygqKTWdrhaFErNvMV18Yl",
"name": "get_weather",
"arguments": {
"location": "Paris"
}
}
]
},
{
"role": "tool",
"parts": [
{
"type": "tool_call_response",
"id": " call_VSPygqKTWdrhaFErNvMV18Yl",
"result": "rainy, 57°F"
}
]
}
] |
-| [`gen_ai.output.messages`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | Messages returned by the model where each message represents a specific model response (choice, candidate). [12] | [
{
"role": "assistant",
"parts": [
{
"type": "text",
"content": "The weather in Paris is currently rainy with a temperature of 57°F."
}
],
"finish_reason": "stop"
}
] |
-| [`gen_ai.system_instructions`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | The system message or instructions provided to the GenAI model separately from the chat history. [13] | [
{
"type": "text",
"content": "You are an Agent that greet users, always use greetings tool to respond"
}
]; [
{
"type": "text",
"content": "You are a language translator."
},
{
"type": "text",
"content": "Your mission is to translate text in English to French."
}
] |
-| [`gen_ai.tool.definitions`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | The list of source system tool definitions available to the GenAI agent or model. [14] | [
{
"type": "function",
"name": "get_current_weather",
"description": "Get the current weather in a given location",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city and state, e.g. San Francisco, CA"
},
"unit": {
"type": "string",
"enum": [
"celsius",
"fahrenheit"
]
}
},
"required": [
"location",
"unit"
]
}
}
] |
+| [`server.address`](/docs/registry/attributes/server.md) |  | `Recommended` | string | GenAI server address. [13] | `example.com`; `10.1.2.80`; `/tmp/my.sock` |
+| [`gen_ai.input.messages`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | The chat history provided to the model as an input. [14] | [
{
"role": "user",
"parts": [
{
"type": "text",
"content": "Weather in Paris?"
}
]
},
{
"role": "assistant",
"parts": [
{
"type": "tool_call",
"id": "call_VSPygqKTWdrhaFErNvMV18Yl",
"name": "get_weather",
"arguments": {
"location": "Paris"
}
}
]
},
{
"role": "tool",
"parts": [
{
"type": "tool_call_response",
"id": " call_VSPygqKTWdrhaFErNvMV18Yl",
"result": "rainy, 57°F"
}
]
}
] |
+| [`gen_ai.output.messages`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | Messages returned by the model where each message represents a specific model response (choice, candidate). [15] | [
{
"role": "assistant",
"parts": [
{
"type": "text",
"content": "The weather in Paris is currently rainy with a temperature of 57°F."
}
],
"finish_reason": "stop"
}
] |
+| [`gen_ai.system_instructions`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | The system message or instructions provided to the GenAI model separately from the chat history. [16] | [
{
"type": "text",
"content": "You are an Agent that greet users, always use greetings tool to respond"
}
]; [
{
"type": "text",
"content": "You are a language translator."
},
{
"type": "text",
"content": "Your mission is to translate text in English to French."
}
] |
+| [`gen_ai.tool.definitions`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | The list of source system tool definitions available to the GenAI agent or model. [17] | [
{
"type": "function",
"name": "get_current_weather",
"description": "Get the current weather in a given location",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city and state, e.g. San Francisco, CA"
},
"unit": {
"type": "string",
"enum": [
"celsius",
"fahrenheit"
]
}
},
"required": [
"location",
"unit"
]
}
}
] |
**[1] `gen_ai.operation.name`:** If one of the predefined values applies, but specific system uses a different name it's RECOMMENDED to document it in the semantic conventions for specific GenAI system and use system-specific name in the instrumentation. If a different name is not documented, instrumentation libraries SHOULD use applicable predefined value.
@@ -147,9 +149,18 @@ Additional output format details may be recorded in the future in the `gen_ai.ou
**[9] `gen_ai.response.model`:** If available. The name of the GenAI model that provided the response. If the model is supplied by a vendor, then the value must be the exact name of the model actually used. If the model is a fine-tuned custom model, the value should have a more specific name than the base model that's been fine-tuned.
-**[10] `server.address`:** When observed from the client side, and when communicating through an intermediary, `server.address` SHOULD represent the server address behind any intermediaries, for example proxies, if it's available.
+**[10] `gen_ai.usage.cache_creation.input_tokens`:** The value SHOULD be included in `gen_ai.usage.input_tokens`.
-**[11] `gen_ai.input.messages`:** Instrumentations MUST follow [Input messages JSON schema](/docs/gen-ai/gen-ai-input-messages.json).
+**[11] `gen_ai.usage.cache_read.input_tokens`:** The value SHOULD be included in `gen_ai.usage.input_tokens`.
+
+**[12] `gen_ai.usage.input_tokens`:** This value SHOULD include all types of input tokens, including cached tokens.
+Instrumentations SHOULD make a best effort to populate this value, using a total
+provided by the provider when available or, depending on the provider API,
+by summing different token types parsed from the provider output.
+
+**[13] `server.address`:** When observed from the client side, and when communicating through an intermediary, `server.address` SHOULD represent the server address behind any intermediaries, for example proxies, if it's available.
+
+**[14] `gen_ai.input.messages`:** Instrumentations MUST follow [Input messages JSON schema](/docs/gen-ai/gen-ai-input-messages.json).
When the attribute is recorded on events, it MUST be recorded in structured
form. When recorded on spans, it MAY be recorded as a JSON string if structured
format is not supported and SHOULD be recorded in structured form otherwise.
@@ -164,7 +175,7 @@ input messages.
See [Recording content on attributes](/docs/gen-ai/gen-ai-spans.md#recording-content-on-attributes)
section for more details.
-**[12] `gen_ai.output.messages`:** Instrumentations MUST follow [Output messages JSON schema](/docs/gen-ai/gen-ai-output-messages.json)
+**[15] `gen_ai.output.messages`:** Instrumentations MUST follow [Output messages JSON schema](/docs/gen-ai/gen-ai-output-messages.json)
Each message represents a single output choice/candidate generated by
the model. Each message corresponds to exactly one generation
@@ -184,7 +195,7 @@ output messages.
See [Recording content on attributes](/docs/gen-ai/gen-ai-spans.md#recording-content-on-attributes)
section for more details.
-**[13] `gen_ai.system_instructions`:** This attribute SHOULD be used when the corresponding provider or API
+**[16] `gen_ai.system_instructions`:** This attribute SHOULD be used when the corresponding provider or API
allows to provide system instructions or messages separately from the
chat history.
@@ -205,7 +216,7 @@ system instructions.
See [Recording content on attributes](/docs/gen-ai/gen-ai-spans.md#recording-content-on-attributes)
section for more details.
-**[14] `gen_ai.tool.definitions`:** The value of this attribute matches source system tool definition format.
+**[17] `gen_ai.tool.definitions`:** The value of this attribute matches source system tool definition format.
It's expected to be an array of objects where each object represents a tool definition. In case a serialized string is available
to the instrumentation, the instrumentation SHOULD do the best effort to
@@ -270,9 +281,9 @@ and SHOULD be provided **at span creation time** (if provided at all):
| `azure.ai.openai` | [Azure OpenAI](https://azure.microsoft.com/products/ai-services/openai-service/) |  |
| `cohere` | [Cohere](https://cohere.com/) |  |
| `deepseek` | [DeepSeek](https://www.deepseek.com/) |  |
-| `gcp.gemini` | [Gemini](https://cloud.google.com/products/gemini) [15] |  |
-| `gcp.gen_ai` | Any Google generative AI endpoint [16] |  |
-| `gcp.vertex_ai` | [Vertex AI](https://cloud.google.com/vertex-ai) [17] |  |
+| `gcp.gemini` | [Gemini](https://cloud.google.com/products/gemini) [18] |  |
+| `gcp.gen_ai` | Any Google generative AI endpoint [19] |  |
+| `gcp.vertex_ai` | [Vertex AI](https://cloud.google.com/vertex-ai) [20] |  |
| `groq` | [Groq](https://groq.com/) |  |
| `ibm.watsonx.ai` | [IBM Watsonx AI](https://www.ibm.com/products/watsonx-ai) |  |
| `mistral_ai` | [Mistral AI](https://mistral.ai/) |  |
@@ -280,11 +291,11 @@ and SHOULD be provided **at span creation time** (if provided at all):
| `perplexity` | [Perplexity](https://www.perplexity.ai/) |  |
| `x_ai` | [xAI](https://x.ai/) |  |
-**[15]:** Used when accessing the 'generativelanguage.googleapis.com' endpoint. Also known as the AI Studio API.
+**[18]:** Used when accessing the 'generativelanguage.googleapis.com' endpoint. Also known as the AI Studio API.
-**[16]:** May be used when specific backend is unknown.
+**[19]:** May be used when specific backend is unknown.
-**[17]:** Used when accessing the 'aiplatform.googleapis.com' endpoint.
+**[20]:** Used when accessing the 'aiplatform.googleapis.com' endpoint.
@@ -318,8 +329,8 @@ The `gen_ai.operation.name` SHOULD be `embeddings`.
| [`server.port`](/docs/registry/attributes/server.md) |  | `Conditionally Required` If `server.address` is set. | int | GenAI server port. [5] | `80`; `8080`; `443` |
| [`gen_ai.embeddings.dimension.count`](/docs/registry/attributes/gen-ai.md) |  | `Recommended` | int | The number of dimensions the resulting output embeddings should have. | `512`; `1024` |
| [`gen_ai.request.encoding_formats`](/docs/registry/attributes/gen-ai.md) |  | `Recommended` | string[] | The encoding formats requested in an embeddings operation, if specified. [6] | `["base64"]`; `["float", "binary"]` |
-| [`gen_ai.usage.input_tokens`](/docs/registry/attributes/gen-ai.md) |  | `Recommended` | int | The number of tokens used in the GenAI input (prompt). | `100` |
-| [`server.address`](/docs/registry/attributes/server.md) |  | `Recommended` | string | GenAI server address. [7] | `example.com`; `10.1.2.80`; `/tmp/my.sock` |
+| [`gen_ai.usage.input_tokens`](/docs/registry/attributes/gen-ai.md) |  | `Recommended` | int | The number of tokens used in the GenAI input (prompt). [7] | `100` |
+| [`server.address`](/docs/registry/attributes/server.md) |  | `Recommended` | string | GenAI server address. [8] | `example.com`; `10.1.2.80`; `/tmp/my.sock` |
**[1] `gen_ai.operation.name`:** If one of the predefined values applies, but specific system uses a different name it's RECOMMENDED to document it in the semantic conventions for specific GenAI system and use system-specific name in the instrumentation. If a different name is not documented, instrumentation libraries SHOULD use applicable predefined value.
@@ -352,7 +363,12 @@ Instrumentations SHOULD document the list of errors they report.
**[6] `gen_ai.request.encoding_formats`:** In some GenAI systems the encoding formats are called embedding types. Also, some GenAI systems only accept a single format per request.
-**[7] `server.address`:** When observed from the client side, and when communicating through an intermediary, `server.address` SHOULD represent the server address behind any intermediaries, for example proxies, if it's available.
+**[7] `gen_ai.usage.input_tokens`:** This value SHOULD include all types of input tokens, including cached tokens.
+Instrumentations SHOULD make a best effort to populate this value, using a total
+provided by the provider when available or, depending on the provider API,
+by summing different token types parsed from the provider output.
+
+**[8] `server.address`:** When observed from the client side, and when communicating through an intermediary, `server.address` SHOULD represent the server address behind any intermediaries, for example proxies, if it's available.
The following attributes can be important for making sampling decisions
and SHOULD be provided **at span creation time** (if provided at all):
@@ -398,9 +414,9 @@ and SHOULD be provided **at span creation time** (if provided at all):
| `azure.ai.openai` | [Azure OpenAI](https://azure.microsoft.com/products/ai-services/openai-service/) |  |
| `cohere` | [Cohere](https://cohere.com/) |  |
| `deepseek` | [DeepSeek](https://www.deepseek.com/) |  |
-| `gcp.gemini` | [Gemini](https://cloud.google.com/products/gemini) [8] |  |
-| `gcp.gen_ai` | Any Google generative AI endpoint [9] |  |
-| `gcp.vertex_ai` | [Vertex AI](https://cloud.google.com/vertex-ai) [10] |  |
+| `gcp.gemini` | [Gemini](https://cloud.google.com/products/gemini) [9] |  |
+| `gcp.gen_ai` | Any Google generative AI endpoint [10] |  |
+| `gcp.vertex_ai` | [Vertex AI](https://cloud.google.com/vertex-ai) [11] |  |
| `groq` | [Groq](https://groq.com/) |  |
| `ibm.watsonx.ai` | [IBM Watsonx AI](https://www.ibm.com/products/watsonx-ai) |  |
| `mistral_ai` | [Mistral AI](https://mistral.ai/) |  |
@@ -408,11 +424,11 @@ and SHOULD be provided **at span creation time** (if provided at all):
| `perplexity` | [Perplexity](https://www.perplexity.ai/) |  |
| `x_ai` | [xAI](https://x.ai/) |  |
-**[8]:** Used when accessing the 'generativelanguage.googleapis.com' endpoint. Also known as the AI Studio API.
+**[9]:** Used when accessing the 'generativelanguage.googleapis.com' endpoint. Also known as the AI Studio API.
-**[9]:** May be used when specific backend is unknown.
+**[10]:** May be used when specific backend is unknown.
-**[10]:** Used when accessing the 'aiplatform.googleapis.com' endpoint.
+**[11]:** Used when accessing the 'aiplatform.googleapis.com' endpoint.
diff --git a/docs/gen-ai/openai.md b/docs/gen-ai/openai.md
index cef0565792..608b73062a 100644
--- a/docs/gen-ai/openai.md
+++ b/docs/gen-ai/openai.md
@@ -86,14 +86,16 @@ Semantic Conventions for [OpenAI](https://openai.com/) client spans extend and o
| [`gen_ai.response.finish_reasons`](/docs/registry/attributes/gen-ai.md) |  | `Recommended` | string[] | Array of reasons the model stopped generating tokens, corresponding to each generation received. | `["stop"]`; `["stop", "length"]` |
| [`gen_ai.response.id`](/docs/registry/attributes/gen-ai.md) |  | `Recommended` | string | The unique identifier for the completion. | `chatcmpl-123` |
| [`gen_ai.response.model`](/docs/registry/attributes/gen-ai.md) |  | `Recommended` | string | The name of the model that generated the response. [10] | `gpt-4-0613` |
-| [`gen_ai.usage.input_tokens`](/docs/registry/attributes/gen-ai.md) |  | `Recommended` | int | The number of tokens used in the GenAI input (prompt). | `100` |
+| [`gen_ai.usage.cache_creation.input_tokens`](/docs/registry/attributes/gen-ai.md) |  | `Recommended` | int | The number of input tokens written to a provider-managed cache. [11] | `25` |
+| [`gen_ai.usage.cache_read.input_tokens`](/docs/registry/attributes/gen-ai.md) |  | `Recommended` | int | The number of input tokens served from a provider-managed cache. [12] | `50` |
+| [`gen_ai.usage.input_tokens`](/docs/registry/attributes/gen-ai.md) |  | `Recommended` | int | The number of tokens used in the GenAI input (prompt). [13] | `100` |
| [`gen_ai.usage.output_tokens`](/docs/registry/attributes/gen-ai.md) |  | `Recommended` | int | The number of tokens used in the GenAI response (completion). | `180` |
| [`openai.response.system_fingerprint`](/docs/registry/attributes/openai.md) |  | `Recommended` | string | A fingerprint to track any eventual change in the Generative AI environment. | `fp_44709d6fcb` |
-| [`server.address`](/docs/registry/attributes/server.md) |  | `Recommended` | string | GenAI server address. [11] | `example.com`; `10.1.2.80`; `/tmp/my.sock` |
-| [`gen_ai.input.messages`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | The chat history provided to the model as an input. [12] | [
{
"role": "user",
"parts": [
{
"type": "text",
"content": "Weather in Paris?"
}
]
},
{
"role": "assistant",
"parts": [
{
"type": "tool_call",
"id": "call_VSPygqKTWdrhaFErNvMV18Yl",
"name": "get_weather",
"arguments": {
"location": "Paris"
}
}
]
},
{
"role": "tool",
"parts": [
{
"type": "tool_call_response",
"id": " call_VSPygqKTWdrhaFErNvMV18Yl",
"result": "rainy, 57°F"
}
]
}
] |
-| [`gen_ai.output.messages`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | Messages returned by the model where each message represents a specific model response (choice, candidate). [13] | [
{
"role": "assistant",
"parts": [
{
"type": "text",
"content": "The weather in Paris is currently rainy with a temperature of 57°F."
}
],
"finish_reason": "stop"
}
] |
-| [`gen_ai.system_instructions`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | The system message or instructions provided to the GenAI model separately from the chat history. [14] | [
{
"type": "text",
"content": "You are an Agent that greet users, always use greetings tool to respond"
}
]; [
{
"type": "text",
"content": "You are a language translator."
},
{
"type": "text",
"content": "Your mission is to translate text in English to French."
}
] |
-| [`gen_ai.tool.definitions`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | The list of source system tool definitions available to the GenAI agent or model. [15] | [
{
"type": "function",
"name": "get_current_weather",
"description": "Get the current weather in a given location",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city and state, e.g. San Francisco, CA"
},
"unit": {
"type": "string",
"enum": [
"celsius",
"fahrenheit"
]
}
},
"required": [
"location",
"unit"
]
}
}
] |
+| [`server.address`](/docs/registry/attributes/server.md) |  | `Recommended` | string | GenAI server address. [14] | `example.com`; `10.1.2.80`; `/tmp/my.sock` |
+| [`gen_ai.input.messages`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | The chat history provided to the model as an input. [15] | [
{
"role": "user",
"parts": [
{
"type": "text",
"content": "Weather in Paris?"
}
]
},
{
"role": "assistant",
"parts": [
{
"type": "tool_call",
"id": "call_VSPygqKTWdrhaFErNvMV18Yl",
"name": "get_weather",
"arguments": {
"location": "Paris"
}
}
]
},
{
"role": "tool",
"parts": [
{
"type": "tool_call_response",
"id": " call_VSPygqKTWdrhaFErNvMV18Yl",
"result": "rainy, 57°F"
}
]
}
] |
+| [`gen_ai.output.messages`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | Messages returned by the model where each message represents a specific model response (choice, candidate). [16] | [
{
"role": "assistant",
"parts": [
{
"type": "text",
"content": "The weather in Paris is currently rainy with a temperature of 57°F."
}
],
"finish_reason": "stop"
}
] |
+| [`gen_ai.system_instructions`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | The system message or instructions provided to the GenAI model separately from the chat history. [17] | [
{
"type": "text",
"content": "You are an Agent that greet users, always use greetings tool to respond"
}
]; [
{
"type": "text",
"content": "You are a language translator."
},
{
"type": "text",
"content": "Your mission is to translate text in English to French."
}
] |
+| [`gen_ai.tool.definitions`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | The list of source system tool definitions available to the GenAI agent or model. [18] | [
{
"type": "function",
"name": "get_current_weather",
"description": "Get the current weather in a given location",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city and state, e.g. San Francisco, CA"
},
"unit": {
"type": "string",
"enum": [
"celsius",
"fahrenheit"
]
}
},
"required": [
"location",
"unit"
]
}
}
] |
**[1] `gen_ai.operation.name`:** If one of the predefined values applies, but specific system uses a different name it's RECOMMENDED to document it in the semantic conventions for specific GenAI system and use system-specific name in the instrumentation. If a different name is not documented, instrumentation libraries SHOULD use applicable predefined value.
@@ -140,9 +142,15 @@ Additional output format details may be recorded in the future in the
**[10] `gen_ai.response.model`:** If available. The name of the GenAI model that provided the response. If the model is supplied by a vendor, then the value must be the exact name of the model actually used. If the model is a fine-tuned custom model, the value should have a more specific name than the base model that's been fine-tuned.
-**[11] `server.address`:** When observed from the client side, and when communicating through an intermediary, `server.address` SHOULD represent the server address behind any intermediaries, for example proxies, if it's available.
+**[11] `gen_ai.usage.cache_creation.input_tokens`:** The value SHOULD be included in `gen_ai.usage.input_tokens`.
-**[12] `gen_ai.input.messages`:** Instrumentations MUST follow [Input messages JSON schema](/docs/gen-ai/gen-ai-input-messages.json).
+**[12] `gen_ai.usage.cache_read.input_tokens`:** Corresponds to `usage.input_tokens_details.cached_tokens` or a similar property in the model response.
+
+**[13] `gen_ai.usage.input_tokens`:** The total input token count is returned by `usage.input_tokens` or a similar property in the model response.
+
+**[14] `server.address`:** When observed from the client side, and when communicating through an intermediary, `server.address` SHOULD represent the server address behind any intermediaries, for example proxies, if it's available.
+
+**[15] `gen_ai.input.messages`:** Instrumentations MUST follow [Input messages JSON schema](/docs/gen-ai/gen-ai-input-messages.json).
When the attribute is recorded on events, it MUST be recorded in structured
form. When recorded on spans, it MAY be recorded as a JSON string if structured
format is not supported and SHOULD be recorded in structured form otherwise.
@@ -157,7 +165,7 @@ input messages.
See [Recording content on attributes](/docs/gen-ai/gen-ai-spans.md#recording-content-on-attributes)
section for more details.
-**[13] `gen_ai.output.messages`:** Instrumentations MUST follow [Output messages JSON schema](/docs/gen-ai/gen-ai-output-messages.json)
+**[16] `gen_ai.output.messages`:** Instrumentations MUST follow [Output messages JSON schema](/docs/gen-ai/gen-ai-output-messages.json)
Each message represents a single output choice/candidate generated by
the model. Each message corresponds to exactly one generation
@@ -177,7 +185,7 @@ output messages.
See [Recording content on attributes](/docs/gen-ai/gen-ai-spans.md#recording-content-on-attributes)
section for more details.
-**[14] `gen_ai.system_instructions`:** This attribute SHOULD be used when the corresponding provider or API
+**[17] `gen_ai.system_instructions`:** This attribute SHOULD be used when the corresponding provider or API
allows to provide system instructions or messages separately from the
chat history.
@@ -198,7 +206,7 @@ system instructions.
See [Recording content on attributes](/docs/gen-ai/gen-ai-spans.md#recording-content-on-attributes)
section for more details.
-**[15] `gen_ai.tool.definitions`:** The value of this attribute matches source system tool definition format.
+**[18] `gen_ai.tool.definitions`:** The value of this attribute matches source system tool definition format.
It's expected to be an array of objects where each object represents a tool definition. In case a serialized string is available
to the instrumentation, the instrumentation SHOULD do the best effort to
diff --git a/docs/registry/attributes/gen-ai.md b/docs/registry/attributes/gen-ai.md
index 847667c9b5..2ce8dc46f9 100644
--- a/docs/registry/attributes/gen-ai.md
+++ b/docs/registry/attributes/gen-ai.md
@@ -56,7 +56,9 @@ This document defines the attributes used to describe telemetry in the context o
| `gen_ai.tool.description` |  | string | The tool description. | `Multiply two numbers` |
| `gen_ai.tool.name` |  | string | Name of the tool utilized by the agent. | `Flights` |
| `gen_ai.tool.type` |  | string | Type of the tool utilized by the agent [15] | `function`; `extension`; `datastore` |
-| `gen_ai.usage.input_tokens` |  | int | The number of tokens used in the GenAI input (prompt). | `100` |
+| `gen_ai.usage.cache_creation.input_tokens` |  | int | The number of input tokens written to a provider-managed cache. [16] | `25` |
+| `gen_ai.usage.cache_read.input_tokens` |  | int | The number of input tokens served from a provider-managed cache. [17] | `50` |
+| `gen_ai.usage.input_tokens` |  | int | The number of tokens used in the GenAI input (prompt). [18] | `100` |
| `gen_ai.usage.output_tokens` |  | int | The number of tokens used in the GenAI response (completion). | `180` |
**[1] `gen_ai.data_source.id`:** Data sources are used by AI agents and RAG applications to store grounding data. A data source may be an external database, object store, document collection, website, or any other storage system used by the GenAI agent or application. The `gen_ai.data_source.id` SHOULD match the identifier used by the GenAI system rather than a name specific to the external storage, such as a database or object store. Semantic conventions referencing `gen_ai.data_source.id` MAY also leverage additional attributes, such as `db.*`, to further identify and describe the data source.
@@ -193,6 +195,15 @@ Function: A tool executed on the client-side, where the agent generates paramete
Client-side operations are actions taken on the user's end or within the client application.
Datastore: A tool used by the agent to access and query structured or unstructured external data for retrieval-augmented tasks or knowledge updates.
+**[16] `gen_ai.usage.cache_creation.input_tokens`:** The value SHOULD be included in `gen_ai.usage.input_tokens`.
+
+**[17] `gen_ai.usage.cache_read.input_tokens`:** The value SHOULD be included in `gen_ai.usage.input_tokens`.
+
+**[18] `gen_ai.usage.input_tokens`:** This value SHOULD include all types of input tokens, including cached tokens.
+Instrumentations SHOULD make a best effort to populate this value, using a total
+provided by the provider when available or, depending on the provider API,
+by summing different token types parsed from the provider output.
+
---
`gen_ai.operation.name` has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used.
@@ -231,9 +242,9 @@ Datastore: A tool used by the agent to access and query structured or unstructur
| `azure.ai.openai` | [Azure OpenAI](https://azure.microsoft.com/products/ai-services/openai-service/) |  |
| `cohere` | [Cohere](https://cohere.com/) |  |
| `deepseek` | [DeepSeek](https://www.deepseek.com/) |  |
-| `gcp.gemini` | [Gemini](https://cloud.google.com/products/gemini) [16] |  |
-| `gcp.gen_ai` | Any Google generative AI endpoint [17] |  |
-| `gcp.vertex_ai` | [Vertex AI](https://cloud.google.com/vertex-ai) [18] |  |
+| `gcp.gemini` | [Gemini](https://cloud.google.com/products/gemini) [19] |  |
+| `gcp.gen_ai` | Any Google generative AI endpoint [20] |  |
+| `gcp.vertex_ai` | [Vertex AI](https://cloud.google.com/vertex-ai) [21] |  |
| `groq` | [Groq](https://groq.com/) |  |
| `ibm.watsonx.ai` | [IBM Watsonx AI](https://www.ibm.com/products/watsonx-ai) |  |
| `mistral_ai` | [Mistral AI](https://mistral.ai/) |  |
@@ -241,11 +252,11 @@ Datastore: A tool used by the agent to access and query structured or unstructur
| `perplexity` | [Perplexity](https://www.perplexity.ai/) |  |
| `x_ai` | [xAI](https://x.ai/) |  |
-**[16]:** Used when accessing the 'generativelanguage.googleapis.com' endpoint. Also known as the AI Studio API.
+**[19]:** Used when accessing the 'generativelanguage.googleapis.com' endpoint. Also known as the AI Studio API.
-**[17]:** May be used when specific backend is unknown.
+**[20]:** May be used when specific backend is unknown.
-**[18]:** Used when accessing the 'aiplatform.googleapis.com' endpoint.
+**[21]:** Used when accessing the 'aiplatform.googleapis.com' endpoint.
---
@@ -282,9 +293,9 @@ Describes deprecated `gen_ai` attributes.
| `azure.ai.openai` | Azure OpenAI |  |
| `cohere` | Cohere |  |
| `deepseek` | DeepSeek |  |
-| `gcp.gemini` | Gemini [19] |  |
-| `gcp.gen_ai` | Any Google generative AI endpoint [20] |  |
-| `gcp.vertex_ai` | Vertex AI [21] |  |
+| `gcp.gemini` | Gemini [22] |  |
+| `gcp.gen_ai` | Any Google generative AI endpoint [23] |  |
+| `gcp.vertex_ai` | Vertex AI [24] |  |
| `groq` | Groq |  |
| `ibm.watsonx.ai` | IBM Watsonx AI |  |
| `mistral_ai` | Mistral AI |  |
@@ -292,11 +303,11 @@ Describes deprecated `gen_ai` attributes.
| `perplexity` | Perplexity |  |
| `xai` | xAI |  |
-**[19]:** This refers to the 'generativelanguage.googleapis.com' endpoint. Also known as the AI Studio API. May use common attributes prefixed with 'gcp.gen_ai.'.
+**[22]:** This refers to the 'generativelanguage.googleapis.com' endpoint. Also known as the AI Studio API. May use common attributes prefixed with 'gcp.gen_ai.'.
-**[20]:** May be used when specific backend is unknown. May use common attributes prefixed with 'gcp.gen_ai.'.
+**[23]:** May be used when specific backend is unknown. May use common attributes prefixed with 'gcp.gen_ai.'.
-**[21]:** This refers to the 'aiplatform.googleapis.com' endpoint. May use common attributes prefixed with 'gcp.gen_ai.'.
+**[24]:** This refers to the 'aiplatform.googleapis.com' endpoint. May use common attributes prefixed with 'gcp.gen_ai.'.
## Deprecated OpenAI GenAI Attributes
diff --git a/model/gen-ai/registry.yaml b/model/gen-ai/registry.yaml
index dc63b743e6..d64574f6f7 100644
--- a/model/gen-ai/registry.yaml
+++ b/model/gen-ai/registry.yaml
@@ -181,7 +181,26 @@ groups:
stability: development
type: int
brief: The number of tokens used in the GenAI input (prompt).
+ note: |
+ This value SHOULD include all types of input tokens, including cached tokens.
+ Instrumentations SHOULD make a best effort to populate this value, using a total
+ provided by the provider when available or, depending on the provider API,
+ by summing different token types parsed from the provider output.
examples: [100]
+ - id: gen_ai.usage.cache_read.input_tokens
+ stability: development
+ type: int
+ brief: The number of input tokens served from a provider-managed cache.
+ note: >
+ The value SHOULD be included in `gen_ai.usage.input_tokens`.
+ examples: [50]
+ - id: gen_ai.usage.cache_creation.input_tokens
+ stability: development
+ type: int
+ brief: The number of input tokens written to a provider-managed cache.
+ note: >
+ The value SHOULD be included in `gen_ai.usage.input_tokens`.
+ examples: [25]
- id: gen_ai.usage.output_tokens
stability: development
type: int
diff --git a/model/gen-ai/spans.yaml b/model/gen-ai/spans.yaml
index 36711dae1e..b9b256ed57 100644
--- a/model/gen-ai/spans.yaml
+++ b/model/gen-ai/spans.yaml
@@ -69,6 +69,10 @@ groups:
requirement_level: recommended
- ref: gen_ai.usage.input_tokens
requirement_level: recommended
+ - ref: gen_ai.usage.cache_read.input_tokens
+ requirement_level: recommended
+ - ref: gen_ai.usage.cache_creation.input_tokens
+ requirement_level: recommended
- ref: gen_ai.usage.output_tokens
requirement_level: recommended
- ref: gen_ai.conversation.id
@@ -176,6 +180,12 @@ groups:
attributes:
- ref: gen_ai.request.model
requirement_level: required
+ - ref: gen_ai.usage.input_tokens
+ note: >
+ The total input token count is returned by `usage.input_tokens` or a similar property in the model response.
+ - ref: gen_ai.usage.cache_read.input_tokens
+ note: >
+ Corresponds to `usage.input_tokens_details.cached_tokens` or a similar property in the model response.
- ref: openai.request.service_tier
requirement_level:
conditionally_required: if the request includes a service_tier and the value is not 'auto'
@@ -432,3 +442,29 @@ groups:
requirement_level: required
- ref: aws.bedrock.knowledge_base.id
requirement_level: recommended
+
+ - id: span.anthropic.inference.client
+ extends: attributes.gen_ai.inference.client
+ stability: development
+ span_kind: client
+ type: span
+ brief: >
+ Semantic Conventions for [Anthropic](https://www.anthropic.com/) client spans extend
+ and override the semantic conventions for [Gen AI Spans](gen-ai-spans.md).
+ note: |
+ `gen_ai.provider.name` MUST be set to `"anthropic"` and SHOULD be provided **at span creation time**.
+
+ **Span name** SHOULD be `{gen_ai.operation.name} {gen_ai.request.model}`.
+ attributes:
+ - ref: gen_ai.usage.input_tokens
+ note: >
+ Anthropic `input_tokens` excludes cached tokens. Compute:
+ `gen_ai.usage.input_tokens = input_tokens + cache_read_input_tokens + cache_creation_input_tokens`
+ - ref: gen_ai.usage.cache_read.input_tokens
+ note: >
+ Anthropic reports this separately from `input_tokens`.
+ This value MUST be added to the Anthropic `input_tokens` to compute `gen_ai.usage.input_tokens`.
+ - ref: gen_ai.usage.cache_creation.input_tokens
+ note: >
+ Anthropic reports this separately from `input_tokens`.
+ This value MUST be added to the Anthropic `input_tokens` to compute `gen_ai.usage.input_tokens`.