This attribute appears on both agent parent spans (aggregated totals) and LLM child spans (per-call values). When using sum() to calculate total cost, filter to gen_ai.operation.type:ai_client to avoid double-counting hierarchical spans.
Despite the name 'cost.cache_creation.input_tokens', this value is cost in USD, not a token count. For token counts, use gen_ai.usage.cache_creation.input_tokens.
This is a subset of gen_ai.cost.input_tokens, not an independent cost. Do not sum this with gen_ai.cost.input_tokens — it is already included.
{
"key": "gen_ai.cost.cache_creation.input_tokens",
"brief": "The cost of input tokens written to cache in USD.",
"type": "double",
"apply_scrubbing": {
"key": "manual"
},
"is_in_otel": false,
"visibility": "public",
"example": 12.34,
"additional_context": [
"This attribute appears on both agent parent spans (aggregated totals) and LLM child spans (per-call values). When using sum() to calculate total cost, filter to gen_ai.operation.type:ai_client to avoid double-counting hierarchical spans.",
"Despite the name 'cost.cache_creation.input_tokens', this value is cost in USD, not a token count. For token counts, use gen_ai.usage.cache_creation.input_tokens.",
"This is a subset of gen_ai.cost.input_tokens, not an independent cost. Do not sum this with gen_ai.cost.input_tokens — it is already included."
],
"changelog": [
{
"version": "0.16.0",
"prs": [],
"description": "Added gen_ai.cost.cache_creation.input_tokens attribute"
}
]
}
This attribute appears on both agent parent spans (aggregated totals) and LLM child spans (per-call values). When using sum() to calculate total cost, filter to gen_ai.operation.type:ai_client to avoid double-counting hierarchical spans.
Despite the name 'cost.cache_read.input_tokens', this value is cost in USD, not a token count. For token counts, use gen_ai.usage.cache_read.input_tokens.
This is a subset of gen_ai.cost.input_tokens, not an independent cost. Do not sum this with gen_ai.cost.input_tokens — it is already included.
{
"key": "gen_ai.cost.cache_read.input_tokens",
"brief": "The cost of cached input tokens in USD.",
"type": "double",
"apply_scrubbing": {
"key": "manual"
},
"is_in_otel": false,
"visibility": "public",
"example": 12.34,
"additional_context": [
"This attribute appears on both agent parent spans (aggregated totals) and LLM child spans (per-call values). When using sum() to calculate total cost, filter to gen_ai.operation.type:ai_client to avoid double-counting hierarchical spans.",
"Despite the name 'cost.cache_read.input_tokens', this value is cost in USD, not a token count. For token counts, use gen_ai.usage.cache_read.input_tokens.",
"This is a subset of gen_ai.cost.input_tokens, not an independent cost. Do not sum this with gen_ai.cost.input_tokens — it is already included."
],
"changelog": [
{
"version": "0.16.0",
"prs": [],
"description": "Added gen_ai.cost.cache_read.input_tokens attribute"
}
]
}
The total cost of all input tokens in USD (includes cached and cache creation tokens).
Example123.45
Additional Context
This attribute appears on both agent parent spans (aggregated totals) and LLM child spans (per-call values). When using sum() to calculate total cost, filter to gen_ai.operation.type:ai_client to avoid double-counting hierarchical spans.
Despite the name 'cost.input_tokens', this value is cost in USD, not a token count. For token counts, use gen_ai.usage.input_tokens.
This is the total cost of all input tokens, including cached and cache creation tokens at their respective rates. For the cached portion, see gen_ai.cost.cache_read.input_tokens. For the cache creation portion, see gen_ai.cost.cache_creation.input_tokens.
{
"key": "gen_ai.cost.input_tokens",
"brief": "The total cost of all input tokens in USD (includes cached and cache creation tokens).",
"type": "double",
"apply_scrubbing": {
"key": "manual"
},
"is_in_otel": false,
"visibility": "public",
"example": 123.45,
"additional_context": [
"This attribute appears on both agent parent spans (aggregated totals) and LLM child spans (per-call values). When using sum() to calculate total cost, filter to gen_ai.operation.type:ai_client to avoid double-counting hierarchical spans.",
"Despite the name 'cost.input_tokens', this value is cost in USD, not a token count. For token counts, use gen_ai.usage.input_tokens.",
"This is the total cost of all input tokens, including cached and cache creation tokens at their respective rates. For the cached portion, see gen_ai.cost.cache_read.input_tokens. For the cache creation portion, see gen_ai.cost.cache_creation.input_tokens."
],
"changelog": [
{
"version": "0.9.0",
"prs": [
397
],
"description": "Add additional_context"
},
{
"version": "0.4.0",
"prs": [
228
]
},
{
"version": "0.1.0",
"prs": [
112
]
}
]
}
The total cost of all output tokens in USD (includes reasoning tokens).
Example123.45
Additional Context
This attribute appears on both agent parent spans (aggregated totals) and LLM child spans (per-call values). When using sum() to calculate total cost, filter to gen_ai.operation.type:ai_client to avoid double-counting hierarchical spans.
Despite the name 'cost.output_tokens', this value is cost in USD, not a token count. For token counts, use gen_ai.usage.output_tokens.
This is the total cost of all output tokens, including reasoning tokens at their respective rate. For the reasoning portion, see gen_ai.cost.reasoning.output_tokens.
{
"key": "gen_ai.cost.output_tokens",
"brief": "The total cost of all output tokens in USD (includes reasoning tokens).",
"type": "double",
"apply_scrubbing": {
"key": "manual"
},
"is_in_otel": false,
"visibility": "public",
"example": 123.45,
"additional_context": [
"This attribute appears on both agent parent spans (aggregated totals) and LLM child spans (per-call values). When using sum() to calculate total cost, filter to gen_ai.operation.type:ai_client to avoid double-counting hierarchical spans.",
"Despite the name 'cost.output_tokens', this value is cost in USD, not a token count. For token counts, use gen_ai.usage.output_tokens.",
"This is the total cost of all output tokens, including reasoning tokens at their respective rate. For the reasoning portion, see gen_ai.cost.reasoning.output_tokens."
],
"changelog": [
{
"version": "0.9.0",
"prs": [
397
],
"description": "Add additional_context"
},
{
"version": "0.4.0",
"prs": [
228
]
},
{
"version": "0.1.0",
"prs": [
112
]
}
]
}
This attribute appears on both agent parent spans (aggregated totals) and LLM child spans (per-call values). When using sum() to calculate total cost, filter to gen_ai.operation.type:ai_client to avoid double-counting hierarchical spans.
Despite the name 'cost.reasoning.output_tokens', this value is cost in USD, not a token count. For token counts, use gen_ai.usage.reasoning.output_tokens.
This is a subset of gen_ai.cost.output_tokens, not an independent cost. Do not sum this with gen_ai.cost.output_tokens — it is already included.
{
"key": "gen_ai.cost.reasoning.output_tokens",
"brief": "The cost of reasoning output tokens in USD.",
"type": "double",
"apply_scrubbing": {
"key": "manual"
},
"is_in_otel": false,
"visibility": "public",
"example": 12.34,
"additional_context": [
"This attribute appears on both agent parent spans (aggregated totals) and LLM child spans (per-call values). When using sum() to calculate total cost, filter to gen_ai.operation.type:ai_client to avoid double-counting hierarchical spans.",
"Despite the name 'cost.reasoning.output_tokens', this value is cost in USD, not a token count. For token counts, use gen_ai.usage.reasoning.output_tokens.",
"This is a subset of gen_ai.cost.output_tokens, not an independent cost. Do not sum this with gen_ai.cost.output_tokens — it is already included."
],
"changelog": [
{
"version": "0.16.0",
"prs": [],
"description": "Added gen_ai.cost.reasoning.output_tokens attribute"
}
]
}
This attribute appears on both agent parent spans (aggregated totals) and LLM child spans (per-call values). When using sum() to calculate total cost, filter to gen_ai.operation.type:ai_client to avoid double-counting hierarchical spans.
Despite the name 'cost.total_tokens', this value is cost in USD, not a token count. For token counts, use gen_ai.usage.total_tokens.
{
"key": "gen_ai.function_id",
"brief": "Framework-specific tracing label for the execution of a function or other unit of execution in a generative AI system.",
"type": "string",
"apply_scrubbing": {
"key": "manual"
},
"is_in_otel": false,
"visibility": "public",
"example": "my-awesome-function",
"changelog": [
{
"version": "0.5.0",
"prs": [
308
],
"description": "Added gen_ai.function_id attribute"
}
]
}
The messages passed to the model. It has to be a stringified version of an array of objects. The role attribute of each object must be "user", "assistant", "tool", or "system". For messages of the role "tool", the content can be a string or an arbitrary object with information about the tool call. For other messages the content can be either a string or a list of objects in the format {type: "text", text:"..."}. For gen_ai.evaluate operations, the array holds one object {type: "evaluation", state: ..., questions: {...}} with the evaluated state and the questions keyed by name, as the caller passed them.
{
"key": "gen_ai.input.messages",
"brief": "The messages passed to the model. It has to be a stringified version of an array of objects. The `role` attribute of each object must be `\"user\"`, `\"assistant\"`, `\"tool\"`, or `\"system\"`. For messages of the role `\"tool\"`, the `content` can be a string or an arbitrary object with information about the tool call. For other messages the `content` can be either a string or a list of objects in the format `{type: \"text\", text:\"...\"}`. For `gen_ai.evaluate` operations, the array holds one object `{type: \"evaluation\", state: ..., questions: {...}}` with the evaluated state and the questions keyed by name, as the caller passed them.",
"type": "string",
"apply_scrubbing": {
"key": "manual"
},
"is_in_otel": true,
"visibility": "public",
"example": "[{\"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\"}]}]",
"alias": [
"ai.texts",
"ai.prompt.messages",
"gen_ai.prompt",
"ai.prompt"
],
"changelog": [
{
"version": "0.26.0",
"prs": [
650
],
"description": "Describe the evaluation message shape for gen_ai.evaluate"
},
{
"version": "0.21.0",
"prs": [
583
],
"description": "Added ai.prompt as an alias"
},
{
"version": "0.5.0",
"prs": [
264
]
},
{
"version": "0.4.0",
"prs": [
221
]
}
]
}
The search query used to retrieve memories. Only applicable to 'search_memory'. Opt-in: instrumentations SHOULD NOT capture this by default and SHOULD gate it behind explicit user opt-in, as it may contain sensitive information.
{
"key": "gen_ai.memory.query.text",
"brief": "The search query used to retrieve memories. Only applicable to 'search_memory'. Opt-in: instrumentations SHOULD NOT capture this by default and SHOULD gate it behind explicit user opt-in, as it may contain sensitive information.",
"type": "string",
"apply_scrubbing": {
"key": "manual"
},
"is_in_otel": true,
"visibility": "public",
"examples": [
"user dietary preferences",
"past flight bookings"
],
"changelog": [
{
"version": "next",
"prs": [
653
],
"description": "Added gen_ai.memory.query.text attribute"
}
]
}
The number of memory records relevant to the operation. For 'search_memory' this is the number returned; for 'create_memory', 'update_memory', 'upsert_memory' and 'delete_memory' it is the number the operation attempted to create, modify, create-or-update, or delete respectively.
{
"key": "gen_ai.memory.record.count",
"brief": "The number of memory records relevant to the operation. For 'search_memory' this is the number returned; for 'create_memory', 'update_memory', 'upsert_memory' and 'delete_memory' it is the number the operation attempted to create, modify, create-or-update, or delete respectively.",
"type": "integer",
"apply_scrubbing": {
"key": "manual"
},
"is_in_otel": true,
"visibility": "public",
"examples": [
3
],
"changelog": [
{
"version": "next",
"prs": [
653
],
"description": "Added gen_ai.memory.record.count attribute"
}
]
}
The unique identifier of the memory record. Set when the operation applies to a specific memory record. For 'delete_memory', its absence may indicate the operation intends to delete all memory records in the store.
{
"key": "gen_ai.memory.record.id",
"brief": "The unique identifier of the memory record. Set when the operation applies to a specific memory record. For 'delete_memory', its absence may indicate the operation intends to delete all memory records in the store.",
"type": "string",
"apply_scrubbing": {
"key": "manual"
},
"is_in_otel": true,
"visibility": "public",
"examples": [
"mem_5j66UpCpwteGg4YSxUnt7lPY"
],
"changelog": [
{
"version": "next",
"prs": [
653
],
"description": "Added gen_ai.memory.record.id attribute"
}
]
}
The memory records stored or retrieved in a memory operation. Stringified JSON array; each element follows the OTel MemoryRecord schema: {content (required), id, metadata, score}. Opt-in: instrumentations SHOULD NOT capture this by default and SHOULD gate it behind explicit user opt-in, as it may contain sensitive information including user/PII data.
{
"key": "gen_ai.memory.records",
"brief": "The memory records stored or retrieved in a memory operation. Stringified JSON array; each element follows the OTel MemoryRecord schema: {content (required), id, metadata, score}. Opt-in: instrumentations SHOULD NOT capture this by default and SHOULD gate it behind explicit user opt-in, as it may contain sensitive information including user/PII data.",
"type": "string",
"apply_scrubbing": {
"key": "manual"
},
"is_in_otel": true,
"visibility": "public",
"examples": [
"[{\"content\": \"User prefers dark mode\", \"id\": \"mem_123\", \"score\": 0.95}, {\"content\": {\"preference\": \"vegetarian meals\", \"confidence\": 0.9}, \"metadata\": {\"source\": \"profile\"}}]"
],
"changelog": [
{
"version": "next",
"prs": [
653
],
"description": "Added gen_ai.memory.records attribute"
}
]
}
The unique identifier of the memory store the operation targets. What this maps to is implementation-specific (e.g. a collection, namespace, or vector index) and SHOULD be documented per integration.
{
"key": "gen_ai.memory.store.id",
"brief": "The unique identifier of the memory store the operation targets. What this maps to is implementation-specific (e.g. a collection, namespace, or vector index) and SHOULD be documented per integration.",
"type": "string",
"apply_scrubbing": {
"key": "manual"
},
"is_in_otel": true,
"visibility": "public",
"examples": [
"ms_abc123",
"user-preferences-store",
"seer-knowledge"
],
"changelog": [
{
"version": "next",
"prs": [
653
],
"description": "Added gen_ai.memory.store.id attribute"
}
]
}
The model's response messages. It has to be a stringified version of an array of message objects, which can include text responses and tool calls. For gen_ai.evaluate operations, the array holds one object {type: "evaluation", answers: {...}} with the answers keyed by question name, as the provider returned them.
Example[{"role": "assistant", "parts": [{"type": "text", "content": "The weather in Paris is currently rainy with a temperature of 57°F."}], "finish_reason": "stop"}]
{
"key": "gen_ai.output.messages",
"brief": "The model's response messages. It has to be a stringified version of an array of message objects, which can include text responses and tool calls. For `gen_ai.evaluate` operations, the array holds one object `{type: \"evaluation\", answers: {...}}` with the answers keyed by question name, as the provider returned them.",
"type": "string",
"apply_scrubbing": {
"key": "manual"
},
"is_in_otel": true,
"visibility": "public",
"example": "[{\"role\": \"assistant\", \"parts\": [{\"type\": \"text\", \"content\": \"The weather in Paris is currently rainy with a temperature of 57°F.\"}], \"finish_reason\": \"stop\"}]",
"alias": [
"ai.response.toolCalls",
"ai.response.text"
],
"changelog": [
{
"version": "0.26.0",
"prs": [
650
],
"description": "Describe the evaluation message shape for gen_ai.evaluate"
},
{
"version": "0.4.0",
"prs": [
221
]
}
]
}
Dynamic SuffixYes - the key contains dynamic parts
Additional Context
Capture only when the user explicitly opts in to recording prompt inputs. In MCP, these values are the arguments supplied in prompts/get requests.
Changelog
next#671Added the OpenTelemetry convention for prompt variables
Raw JSON
{
"key": "gen_ai.prompt.variable.<key>",
"brief": "Variables supplied to the prompt template. The <key> is the variable name, and the value is the variable value serialized as a string.",
"has_dynamic_suffix": true,
"type": "string",
"apply_scrubbing": {
"key": "auto",
"reason": "Prompt variables contain user input and may include sensitive information"
},
"is_in_otel": true,
"visibility": "public",
"examples": [
"gen_ai.prompt.variable.language='French'",
"gen_ai.prompt.variable.topic='weather'"
],
"additional_context": [
"Capture only when the user explicitly opts in to recording prompt inputs. In MCP, these values are the arguments supplied in prompts/get requests."
],
"changelog": [
{
"version": "next",
"prs": [
671
],
"description": "Added the OpenTelemetry convention for prompt variables"
}
]
}
Used to reduce repetitiveness of generated tokens. The higher the value, the stronger a penalty is applied to previously present tokens, proportional to how many times they have already appeared in the prompt or prior generation.
{
"key": "gen_ai.request.frequency_penalty",
"brief": "Used to reduce repetitiveness of generated tokens. The higher the value, the stronger a penalty is applied to previously present tokens, proportional to how many times they have already appeared in the prompt or prior generation.",
"type": "double",
"apply_scrubbing": {
"key": "manual"
},
"is_in_otel": true,
"visibility": "public",
"example": 0.5,
"alias": [
"ai.frequency_penalty"
],
"changelog": [
{
"version": "0.4.0",
"prs": [
228
]
},
{
"version": "0.1.0",
"prs": [
57
]
}
]
}
Used to reduce repetitiveness of generated tokens. Similar to frequency_penalty, except that this penalty is applied equally to all tokens that have already appeared, regardless of their exact frequencies.
{
"key": "gen_ai.request.seed",
"brief": "The seed, ideally models given the same seed and same other parameters will produce the exact same output.",
"type": "string",
"apply_scrubbing": {
"key": "manual"
},
"is_in_otel": true,
"visibility": "public",
"example": "1234567890",
"alias": [
"ai.seed"
],
"changelog": [
{
"version": "0.1.0",
"prs": [
57,
127
]
}
]
}
Limits the model to only consider the K most likely next tokens, where K is an integer (e.g., top_k=20 means only the 20 highest probability tokens are considered).
{
"key": "gen_ai.request.top_k",
"brief": "Limits the model to only consider the K most likely next tokens, where K is an integer (e.g., top_k=20 means only the 20 highest probability tokens are considered).",
"type": "integer",
"apply_scrubbing": {
"key": "manual"
},
"is_in_otel": true,
"visibility": "public",
"example": 35,
"alias": [
"ai.top_k"
],
"changelog": [
{
"version": "0.4.0",
"prs": [
228
]
},
{
"version": "0.1.0",
"prs": [
57
]
}
]
}
Limits the model to only consider tokens whose cumulative probability mass adds up to p, where p is a float between 0 and 1 (e.g., top_p=0.7 means only tokens that sum up to 70% of the probability mass are considered).
{
"key": "gen_ai.request.top_p",
"brief": "Limits the model to only consider tokens whose cumulative probability mass adds up to p, where p is a float between 0 and 1 (e.g., top_p=0.7 means only tokens that sum up to 70% of the probability mass are considered).",
"type": "double",
"apply_scrubbing": {
"key": "manual"
},
"is_in_otel": true,
"visibility": "public",
"example": 0.7,
"alias": [
"ai.top_p"
],
"changelog": [
{
"version": "0.4.0",
"prs": [
228
]
},
{
"version": "0.1.0",
"prs": [
57
]
}
]
}
{
"key": "gen_ai.tool.call.arguments",
"brief": "The arguments of the tool call. It has to be a stringified version of the arguments to the tool.",
"type": "string",
"apply_scrubbing": {
"key": "manual"
},
"is_in_otel": true,
"visibility": "public",
"example": "{\"location\": \"Paris\"}",
"alias": [
"gen_ai.tool.input",
"ai.toolCall.args"
],
"changelog": [
{
"version": "0.5.0",
"prs": [
265
]
},
{
"version": "0.4.0",
"prs": [
221
]
}
]
}
{
"key": "gen_ai.tool.call.result",
"brief": "The result of the tool call. It has to be a stringified version of the result of the tool.",
"type": "string",
"apply_scrubbing": {
"key": "manual"
},
"is_in_otel": true,
"visibility": "public",
"example": "rainy, 57°F",
"alias": [
"gen_ai.tool.output",
"gen_ai.tool.message",
"mcp.tool.result.content",
"ai.toolCall.result",
"anthropic.tool_result.content"
],
"changelog": [
{
"version": "0.5.0",
"prs": [
265
]
},
{
"version": "0.4.0",
"prs": [
221
]
}
]
}
The list of source system tool definitions available to the GenAI agent or model.
Example[{"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"]}}]
{
"key": "gen_ai.tool.description",
"brief": "The description of the tool being used.",
"type": "string",
"apply_scrubbing": {
"key": "manual"
},
"is_in_otel": true,
"visibility": "public",
"example": "Searches the web for current information about a topic",
"changelog": [
{
"version": "0.1.0",
"prs": [
62,
127
]
}
]
}
This attribute appears on both agent parent spans (aggregated totals) and LLM child spans (per-call values). When using sum() to count tokens, filter to gen_ai.operation.type:ai_client to avoid double-counting hierarchical spans.
Changelog
v0.24.0#582Added gen_ai.usage.cache_creation_input_tokens as an alias
This attribute appears on both agent parent spans (aggregated totals) and LLM child spans (per-call values). When using sum() to count tokens, filter to gen_ai.operation.type:ai_client to avoid double-counting hierarchical spans.
This is a subset of gen_ai.usage.input_tokens, not an independent count. Do not sum this with gen_ai.usage.input_tokens — it is already included.
Changelog
v0.24.0#582Added gen_ai.usage.cache_read_input_tokens as an alias
{
"key": "gen_ai.usage.cache_read.input_tokens",
"brief": "The number of cached tokens used to process the AI input (prompt).",
"type": "integer",
"apply_scrubbing": {
"key": "manual"
},
"is_in_otel": true,
"visibility": "public",
"example": 50,
"alias": [
"gen_ai.usage.input_tokens.cached",
"gen_ai.usage.cache_read_input_tokens"
],
"additional_context": [
"This attribute appears on both agent parent spans (aggregated totals) and LLM child spans (per-call values). When using sum() to count tokens, filter to gen_ai.operation.type:ai_client to avoid double-counting hierarchical spans.",
"This is a subset of gen_ai.usage.input_tokens, not an independent count. Do not sum this with gen_ai.usage.input_tokens — it is already included."
],
"changelog": [
{
"version": "0.24.0",
"prs": [
582
],
"description": "Added gen_ai.usage.cache_read_input_tokens as an alias"
},
{
"version": "0.11.0",
"prs": [
418
],
"description": "Added gen_ai.usage.cache_read.input_tokens attribute"
}
]
}
This attribute appears on both agent parent spans (aggregated totals) and LLM child spans (per-call values). When using sum() to count tokens, filter to gen_ai.operation.type:ai_client to avoid double-counting hierarchical spans.
This count includes cached input tokens. gen_ai.usage.cache_read.input_tokens is a subset of this value, not an independent count — do not sum them together.
Changelog
v0.11.0#418Update additional_context to reference gen_ai.usage.cache_read.input_tokens
This attribute appears on both agent parent spans (aggregated totals) and LLM child spans (per-call values). When using sum() to count tokens, filter to gen_ai.operation.type:ai_client to avoid double-counting hierarchical spans.
This count includes reasoning tokens. gen_ai.usage.reasoning.output_tokens is a subset of this value, not an independent count — do not sum them together.
Changelog
v0.11.0#418Update additional_context to reference gen_ai.usage.reasoning.output_tokens
This attribute appears on both agent parent spans (aggregated totals) and LLM child spans (per-call values). When using sum() to count tokens, filter to gen_ai.operation.type:ai_client to avoid double-counting hierarchical spans.
This is a subset of gen_ai.usage.output_tokens, not an independent count. Do not sum this with gen_ai.usage.output_tokens — it is already included.
{
"key": "gen_ai.usage.reasoning.output_tokens",
"brief": "The number of tokens used for reasoning to create the AI output.",
"type": "integer",
"apply_scrubbing": {
"key": "manual"
},
"is_in_otel": true,
"visibility": "public",
"example": 75,
"alias": [
"gen_ai.usage.output_tokens.reasoning"
],
"additional_context": [
"This attribute appears on both agent parent spans (aggregated totals) and LLM child spans (per-call values). When using sum() to count tokens, filter to gen_ai.operation.type:ai_client to avoid double-counting hierarchical spans.",
"This is a subset of gen_ai.usage.output_tokens, not an independent count. Do not sum this with gen_ai.usage.output_tokens — it is already included."
],
"changelog": [
{
"version": "0.11.0",
"prs": [
418
],
"description": "Added gen_ai.usage.reasoning.output_tokens attribute"
}
]
}
This attribute appears on both agent parent spans (aggregated totals) and LLM child spans (per-call values). When using sum() to count tokens, filter to gen_ai.operation.type:ai_client to avoid double-counting hierarchical spans.
This is the sum of gen_ai.usage.input_tokens and gen_ai.usage.output_tokens. Do not sum this with either of them — they are already included.
{
"key": "gen_ai.usage.total_tokens",
"brief": "The total number of tokens used to process the prompt. (input tokens plus output todkens)",
"type": "integer",
"apply_scrubbing": {
"key": "manual"
},
"is_in_otel": false,
"visibility": "public",
"example": 20,
"alias": [
"ai.total_tokens.used",
"ai.usage.tokens"
],
"additional_context": [
"This attribute appears on both agent parent spans (aggregated totals) and LLM child spans (per-call values). When using sum() to count tokens, filter to gen_ai.operation.type:ai_client to avoid double-counting hierarchical spans.",
"This is the sum of gen_ai.usage.input_tokens and gen_ai.usage.output_tokens. Do not sum this with either of them — they are already included."
],
"changelog": [
{
"version": "0.21.0",
"prs": [
583
],
"description": "Added ai.usage.tokens as an alias"
},
{
"version": "0.9.0",
"prs": [
397
],
"description": "Add additional_context"
},
{
"version": "0.4.0",
"prs": [
228
]
},
{
"version": "0.1.0",
"prs": [
57
]
}
]
}
Deprecated Attributes
These attributes are deprecated and should not be used in new code. See each attribute for migration guidance.
The available tools for the model. It has to be a stringified version of an array of objects.
Example[{"name": "get_weather", "description": "Get the weather for a given location"}, {"name": "get_news", "description": "Get the news for a given topic"}]
{
"key": "gen_ai.request.available_tools",
"brief": "The available tools for the model. It has to be a stringified version of an array of objects.",
"type": "string",
"apply_scrubbing": {
"key": "manual"
},
"is_in_otel": false,
"visibility": "public",
"example": "[{\"name\": \"get_weather\", \"description\": \"Get the weather for a given location\"}, {\"name\": \"get_news\", \"description\": \"Get the news for a given topic\"}]",
"deprecation": {
"replacement": "gen_ai.tool.definitions",
"_status": "normalize"
},
"alias": [
"gen_ai.tool.definitions"
],
"changelog": [
{
"version": "0.22.0",
"prs": [
595
],
"description": "Added gen_ai.tool.definitions as an alias"
},
{
"version": "0.4.0",
"prs": [
221
]
},
{
"version": "0.1.0",
"prs": [
63,
127
]
}
]
}
The messages passed to the model. It has to be a stringified version of an array of objects. The role attribute of each object must be "user", "assistant", "tool", or "system". For messages of the role "tool", the content can be a string or an arbitrary object with information about the tool call. For other messages the content can be either a string or a list of objects in the format {type: "text", text:"..."}.
Example[{"role": "system", "content": "Generate a random number."}, {"role": "user", "content": [{"text": "Generate a random number between 0 and 10.", "type": "text"}]}, {"role": "tool", "content": {"toolCallId": "1", "toolName": "Weather", "output": "rainy"}}]
{
"key": "gen_ai.request.messages",
"brief": "The messages passed to the model. It has to be a stringified version of an array of objects. The `role` attribute of each object must be `\"user\"`, `\"assistant\"`, `\"tool\"`, or `\"system\"`. For messages of the role `\"tool\"`, the `content` can be a string or an arbitrary object with information about the tool call. For other messages the `content` can be either a string or a list of objects in the format `{type: \"text\", text:\"...\"}`.",
"type": "string",
"apply_scrubbing": {
"key": "manual"
},
"is_in_otel": false,
"visibility": "public",
"example": "[{\"role\": \"system\", \"content\": \"Generate a random number.\"}, {\"role\": \"user\", \"content\": [{\"text\": \"Generate a random number between 0 and 10.\", \"type\": \"text\"}]}, {\"role\": \"tool\", \"content\": {\"toolCallId\": \"1\", \"toolName\": \"Weather\", \"output\": \"rainy\"}}]",
"deprecation": {
"replacement": "gen_ai.input.messages",
"_status": "transform",
"transformation": "gen_ai_request_messages_to_input_messages"
},
"alias": [
"ai.input_messages"
],
"changelog": [
{
"version": "0.4.0",
"prs": [
221
]
},
{
"version": "0.1.0",
"prs": [
63,
74,
108,
119,
122
]
}
]
}
{
"key": "gen_ai.response.object",
"brief": "The type of the object returned by the model.",
"type": "string",
"apply_scrubbing": {
"key": "manual"
},
"is_in_otel": false,
"visibility": "public",
"examples": [
"chat.completion"
],
"deprecation": {
"reason": "This attribute is deprecated. The Sentry conventions have no replacement for the raw response object type.",
"_status": null
},
"changelog": [
{
"version": "0.21.0",
"prs": [
583
],
"description": "Added gen_ai.response.object attribute"
}
]
}
The model's response text messages. It has to be a stringified version of an array of response text messages.
Example["The weather in Paris is rainy and overcast, with temperatures around 57°F", "The weather in London is sunny and warm, with temperatures around 65°F"]
{
"key": "gen_ai.response.text",
"brief": "The model's response text messages. It has to be a stringified version of an array of response text messages.",
"type": "string",
"apply_scrubbing": {
"key": "manual"
},
"is_in_otel": false,
"visibility": "public",
"example": "[\"The weather in Paris is rainy and overcast, with temperatures around 57°F\", \"The weather in London is sunny and warm, with temperatures around 65°F\"]",
"deprecation": {
"replacement": "gen_ai.output.messages",
"_status": "transform",
"transformation": "gen_ai_response_to_output_messages"
},
"alias": [],
"changelog": [
{
"version": "0.4.0",
"prs": [
221
]
},
{
"version": "0.1.0",
"prs": [
63,
74
]
}
]
}
This attribute appears on both agent parent spans (aggregated totals) and LLM child spans (per-call values). When using sum() to count tokens, filter to gen_ai.operation.type:ai_client to avoid double-counting hierarchical spans.
This attribute appears on both agent parent spans (aggregated totals) and LLM child spans (per-call values). When using sum() to count tokens, filter to gen_ai.operation.type:ai_client to avoid double-counting hierarchical spans.
Changelog
v0.24.0#582Added gen_ai.usage.cache_creation_input_tokens as an alias
v0.11.0#418Deprecate in favor of gen_ai.usage.cache_creation.input_tokens
This attribute appears on both agent parent spans (aggregated totals) and LLM child spans (per-call values). When using sum() to count tokens, filter to gen_ai.operation.type:ai_client to avoid double-counting hierarchical spans.
This is a subset of gen_ai.usage.input_tokens, not an independent count. Do not sum this with gen_ai.usage.input_tokens — it is already included.
Changelog
v0.24.0#582Added gen_ai.usage.cache_read_input_tokens as an alias
v0.11.0#418Deprecate in favor of gen_ai.usage.cache_read.input_tokens
{
"key": "gen_ai.usage.input_tokens.cached",
"brief": "The number of cached tokens used to process the AI input (prompt).",
"type": "integer",
"apply_scrubbing": {
"key": "manual"
},
"is_in_otel": false,
"visibility": "public",
"example": 50,
"deprecation": {
"replacement": "gen_ai.usage.cache_read.input_tokens",
"_status": "backfill"
},
"alias": [
"gen_ai.usage.cache_read.input_tokens",
"gen_ai.usage.cache_read_input_tokens"
],
"additional_context": [
"This attribute appears on both agent parent spans (aggregated totals) and LLM child spans (per-call values). When using sum() to count tokens, filter to gen_ai.operation.type:ai_client to avoid double-counting hierarchical spans.",
"This is a subset of gen_ai.usage.input_tokens, not an independent count. Do not sum this with gen_ai.usage.input_tokens — it is already included."
],
"changelog": [
{
"version": "0.24.0",
"prs": [
582
],
"description": "Added gen_ai.usage.cache_read_input_tokens as an alias"
},
{
"version": "0.11.0",
"prs": [
418
],
"description": "Deprecate in favor of gen_ai.usage.cache_read.input_tokens"
},
{
"version": "0.9.0",
"prs": [
397
],
"description": "Add additional_context"
},
{
"version": "0.4.0",
"prs": [
228
]
},
{
"version": "0.1.0",
"prs": [
62,
112
]
}
]
}
This attribute appears on both agent parent spans (aggregated totals) and LLM child spans (per-call values). When using sum() to count tokens, filter to gen_ai.operation.type:ai_client to avoid double-counting hierarchical spans.
This is a subset of gen_ai.usage.output_tokens, not an independent count. Do not sum this with gen_ai.usage.output_tokens — it is already included.
Changelog
v0.11.0#418Deprecate in favor of gen_ai.usage.reasoning.output_tokens
{
"key": "gen_ai.usage.output_tokens.reasoning",
"brief": "The number of tokens used for reasoning to create the AI output.",
"type": "integer",
"apply_scrubbing": {
"key": "manual"
},
"is_in_otel": false,
"visibility": "public",
"example": 75,
"deprecation": {
"replacement": "gen_ai.usage.reasoning.output_tokens",
"_status": "backfill"
},
"alias": [
"gen_ai.usage.reasoning.output_tokens"
],
"additional_context": [
"This attribute appears on both agent parent spans (aggregated totals) and LLM child spans (per-call values). When using sum() to count tokens, filter to gen_ai.operation.type:ai_client to avoid double-counting hierarchical spans.",
"This is a subset of gen_ai.usage.output_tokens, not an independent count. Do not sum this with gen_ai.usage.output_tokens — it is already included."
],
"changelog": [
{
"version": "0.11.0",
"prs": [
418
],
"description": "Deprecate in favor of gen_ai.usage.reasoning.output_tokens"
},
{
"version": "0.9.0",
"prs": [
397
],
"description": "Add additional_context"
},
{
"version": "0.4.0",
"prs": [
228
]
},
{
"version": "0.1.0",
"prs": [
62,
112
]
}
]
}
This attribute appears on both agent parent spans (aggregated totals) and LLM child spans (per-call values). When using sum() to count tokens, filter to gen_ai.operation.type:ai_client to avoid double-counting hierarchical spans.