Gen_ai Attributes

67 attributes in this category.47 stable·20 deprecated

67 attributes

Stable Attributes

gen_ai.agent.name

stringScrub: ManualVisibility: PublicOTel: True

The name of the agent being used.

ExampleResearchAssistant
Changelog
v0.1.0#62#127
Raw JSON
{
  "key": "gen_ai.agent.name",
  "brief": "The name of the agent being used.",
  "type": "string",
  "apply_scrubbing": {
    "key": "manual"
  },
  "is_in_otel": true,
  "visibility": "public",
  "example": "ResearchAssistant",
  "changelog": [
    {
      "version": "0.1.0",
      "prs": [
        62,
        127
      ]
    }
  ]
}

gen_ai.context.utilization

doubleScrub: ManualVisibility: PublicOTel: False

The fraction of the model context window utilized by this generation.

Example0.75
Changelog
v0.5.0#315Added gen_ai.context.utilization attribute
Raw JSON
{
  "key": "gen_ai.context.utilization",
  "brief": "The fraction of the model context window utilized by this generation.",
  "type": "double",
  "apply_scrubbing": {
    "key": "manual"
  },
  "is_in_otel": false,
  "visibility": "public",
  "example": 0.75,
  "changelog": [
    {
      "version": "0.5.0",
      "prs": [
        315
      ],
      "description": "Added gen_ai.context.utilization attribute"
    }
  ]
}

gen_ai.context.window_size

integerScrub: ManualVisibility: PublicOTel: False

The maximum context window size supported by the model for this generation.

Example128000
Changelog
v0.5.0#315Added gen_ai.context.window_size attribute
Raw JSON
{
  "key": "gen_ai.context.window_size",
  "brief": "The maximum context window size supported by the model for this generation.",
  "type": "integer",
  "apply_scrubbing": {
    "key": "manual"
  },
  "is_in_otel": false,
  "visibility": "public",
  "example": 128000,
  "changelog": [
    {
      "version": "0.5.0",
      "prs": [
        315
      ],
      "description": "Added gen_ai.context.window_size attribute"
    }
  ]
}

gen_ai.conversation.id

stringScrub: ManualVisibility: PublicOTel: True

The unique identifier for a conversation (session, thread), used to store and correlate messages within this conversation.

Exampleconv_5j66UpCpwteGg4YSxUnt7lPY
Changelog
v0.4.0#250
Raw JSON
{
  "key": "gen_ai.conversation.id",
  "brief": "The unique identifier for a conversation (session, thread), used to store and correlate messages within this conversation.",
  "type": "string",
  "apply_scrubbing": {
    "key": "manual"
  },
  "is_in_otel": true,
  "visibility": "public",
  "example": "conv_5j66UpCpwteGg4YSxUnt7lPY",
  "changelog": [
    {
      "version": "0.4.0",
      "prs": [
        250
      ]
    }
  ]
}

gen_ai.cost.cache_creation.input_tokens

doubleScrub: ManualVisibility: PublicOTel: False

The cost of input tokens written to cache in USD.

Example12.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
v0.16.0Added gen_ai.cost.cache_creation.input_tokens attribute
Raw JSON
{
  "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"
    }
  ]
}

gen_ai.cost.cache_read.input_tokens

doubleScrub: ManualVisibility: PublicOTel: False

The cost of cached input tokens in USD.

Example12.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
v0.16.0Added gen_ai.cost.cache_read.input_tokens attribute
Raw JSON
{
  "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"
    }
  ]
}

gen_ai.cost.input_tokens

doubleScrub: ManualVisibility: PublicOTel: False

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.
Changelog
v0.9.0#397Add additional_context
v0.4.0#228
v0.1.0#112
Raw JSON
{
  "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
      ]
    }
  ]
}

gen_ai.cost.output_tokens

doubleScrub: ManualVisibility: PublicOTel: False

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.
Changelog
v0.9.0#397Add additional_context
v0.4.0#228
v0.1.0#112
Raw JSON
{
  "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
      ]
    }
  ]
}

gen_ai.cost.reasoning.output_tokens

doubleScrub: ManualVisibility: PublicOTel: False

The cost of reasoning output tokens in USD.

Example12.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
v0.16.0Added gen_ai.cost.reasoning.output_tokens attribute
Raw JSON
{
  "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"
    }
  ]
}

gen_ai.cost.total_tokens

doubleScrub: ManualVisibility: PublicOTel: False

The total cost for the tokens used.

Example12.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.total_tokens', this value is cost in USD, not a token count. For token counts, use gen_ai.usage.total_tokens.
Changelog
v0.9.0#397Add additional_context
v0.5.0#264
v0.4.0#228
v0.1.0#126
Raw JSON
{
  "key": "gen_ai.cost.total_tokens",
  "brief": "The total cost for the tokens used.",
  "type": "double",
  "apply_scrubbing": {
    "key": "manual"
  },
  "is_in_otel": false,
  "visibility": "public",
  "example": 12.34,
  "alias": [
    "ai.total_cost"
  ],
  "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.total_tokens', this value is cost in USD, not a token count. For token counts, use gen_ai.usage.total_tokens."
  ],
  "changelog": [
    {
      "version": "0.9.0",
      "prs": [
        397
      ],
      "description": "Add additional_context"
    },
    {
      "version": "0.5.0",
      "prs": [
        264
      ]
    },
    {
      "version": "0.4.0",
      "prs": [
        228
      ]
    },
    {
      "version": "0.1.0",
      "prs": [
        126
      ]
    }
  ]
}

gen_ai.embeddings.input

stringScrub: ManualVisibility: PublicOTel: False

The input to the embeddings model.

ExampleWhat's the weather in Paris?
Changelog
v0.3.1#195
Raw JSON
{
  "key": "gen_ai.embeddings.input",
  "brief": "The input to the embeddings model.",
  "type": "string",
  "apply_scrubbing": {
    "key": "manual"
  },
  "is_in_otel": false,
  "visibility": "public",
  "example": "What's the weather in Paris?",
  "changelog": [
    {
      "version": "0.3.1",
      "prs": [
        195
      ]
    }
  ]
}

gen_ai.function_id

stringScrub: ManualVisibility: PublicOTel: False

Framework-specific tracing label for the execution of a function or other unit of execution in a generative AI system.

Examplemy-awesome-function
Changelog
v0.5.0#308Added gen_ai.function_id attribute
Raw JSON
{
  "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"
    }
  ]
}

gen_ai.input.messages

stringScrub: ManualVisibility: PublicOTel: True

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": "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"}]}]
Changelog
nextAdded ai.prompt as an alias
v0.5.0#264
v0.4.0#221
Raw JSON
{
  "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:\"...\"}`.",
  "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": "next",
      "description": "Added ai.prompt as an alias"
    },
    {
      "version": "0.5.0",
      "prs": [
        264
      ]
    },
    {
      "version": "0.4.0",
      "prs": [
        221
      ]
    }
  ]
}

gen_ai.operation.name

stringScrub: ManualVisibility: PublicOTel: True

The name of the operation being performed. It has the following list of well-known values: 'chat', 'create_agent', 'embeddings', 'execute_tool', 'generate_content', 'invoke_agent', 'text_completion'. If one of them applies, then that value MUST be used. Otherwise a custom value MAY be used.

Examplechat
Changelog
v0.4.0#225
v0.1.0#62#127
Raw JSON
{
  "key": "gen_ai.operation.name",
  "brief": "The name of the operation being performed. It has the following list of well-known values: 'chat', 'create_agent', 'embeddings', 'execute_tool', 'generate_content', 'invoke_agent', 'text_completion'. If one of them applies, then that value MUST be used. Otherwise a custom value MAY be used.",
  "type": "string",
  "apply_scrubbing": {
    "key": "manual"
  },
  "is_in_otel": true,
  "visibility": "public",
  "example": "chat",
  "changelog": [
    {
      "version": "0.4.0",
      "prs": [
        225
      ]
    },
    {
      "version": "0.1.0",
      "prs": [
        62,
        127
      ]
    }
  ]
}

gen_ai.operation.type

stringScrub: ManualVisibility: PublicOTel: False

The type of AI operation. Must be one of 'agent' (invoke_agent and create_agent spans), 'ai_client' (any LLM call), 'tool' (execute_tool spans), 'handoff' (handoff spans), 'other' (input and output processors, skill loading, guardrails etc.) . Added during ingestion based on span.op and gen_ai.operation.type. Used to filter and aggregate data in the UI

Exampletool
Changelog
v0.4.0#257
v0.1.0#113#127
Raw JSON
{
  "key": "gen_ai.operation.type",
  "brief": "The type of AI operation. Must be one of 'agent' (invoke_agent and create_agent spans), 'ai_client' (any LLM call), 'tool' (execute_tool spans), 'handoff' (handoff spans), 'other' (input and output processors, skill loading, guardrails etc.) . Added during ingestion based on span.op and gen_ai.operation.type. Used to filter and aggregate data in the UI",
  "type": "string",
  "apply_scrubbing": {
    "key": "manual"
  },
  "is_in_otel": false,
  "visibility": "public",
  "example": "tool",
  "changelog": [
    {
      "version": "0.4.0",
      "prs": [
        257
      ]
    },
    {
      "version": "0.1.0",
      "prs": [
        113,
        127
      ]
    }
  ]
}

gen_ai.output.messages

stringScrub: ManualVisibility: PublicOTel: True

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.

Example[{"role": "assistant", "parts": [{"type": "text", "content": "The weather in Paris is currently rainy with a temperature of 57°F."}], "finish_reason": "stop"}]
Changelog
v0.4.0#221
Raw JSON
{
  "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.",
  "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.4.0",
      "prs": [
        221
      ]
    }
  ]
}

gen_ai.pipeline.name

stringScrub: ManualVisibility: PublicOTel: False

Name of the AI pipeline or chain being executed.

ExampleAutofix Pipeline
Changelog
v0.1.0#76#127
Raw JSON
{
  "key": "gen_ai.pipeline.name",
  "brief": "Name of the AI pipeline or chain being executed.",
  "type": "string",
  "apply_scrubbing": {
    "key": "manual"
  },
  "is_in_otel": false,
  "visibility": "public",
  "example": "Autofix Pipeline",
  "alias": [
    "ai.pipeline.name"
  ],
  "changelog": [
    {
      "version": "0.1.0",
      "prs": [
        76,
        127
      ]
    }
  ]
}

gen_ai.prompt.name

stringScrub: ManualVisibility: PublicOTel: True

The name of the prompt that uniquely identifies it.

Scrubbing ReasonPrompt names may reveal user behavior patterns or sensitive operations
Examplesummarize_text
Changelog
v0.12.0#420Added gen_ai.prompt.name attribute
Raw JSON
{
  "key": "gen_ai.prompt.name",
  "brief": "The name of the prompt that uniquely identifies it.",
  "type": "string",
  "apply_scrubbing": {
    "key": "manual",
    "reason": "Prompt names may reveal user behavior patterns or sensitive operations"
  },
  "is_in_otel": true,
  "visibility": "public",
  "example": "summarize_text",
  "alias": [
    "mcp.prompt.name"
  ],
  "changelog": [
    {
      "version": "0.12.0",
      "prs": [
        420
      ],
      "description": "Added gen_ai.prompt.name attribute"
    }
  ]
}

gen_ai.provider.name

stringScrub: ManualVisibility: PublicOTel: True

The Generative AI provider as identified by the client or server instrumentation.

Exampleopenai
Changelog
v0.4.0#253
Raw JSON
{
  "key": "gen_ai.provider.name",
  "brief": "The Generative AI provider as identified by the client or server instrumentation.",
  "type": "string",
  "apply_scrubbing": {
    "key": "manual"
  },
  "is_in_otel": true,
  "visibility": "public",
  "example": "openai",
  "alias": [
    "ai.model.provider",
    "gen_ai.system"
  ],
  "changelog": [
    {
      "version": "0.4.0",
      "prs": [
        253
      ]
    }
  ]
}

gen_ai.request.frequency_penalty

doubleScrub: ManualVisibility: PublicOTel: True

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.

Example0.5
Changelog
v0.4.0#228
v0.1.0#57
Raw JSON
{
  "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
      ]
    }
  ]
}

gen_ai.request.max_tokens

integerScrub: ManualVisibility: PublicOTel: True

The maximum number of tokens to generate in the response.

Example2048
Changelog
v0.4.0#228
v0.1.0#62
Raw JSON
{
  "key": "gen_ai.request.max_tokens",
  "brief": "The maximum number of tokens to generate in the response.",
  "type": "integer",
  "apply_scrubbing": {
    "key": "manual"
  },
  "is_in_otel": true,
  "visibility": "public",
  "example": 2048,
  "changelog": [
    {
      "version": "0.4.0",
      "prs": [
        228
      ]
    },
    {
      "version": "0.1.0",
      "prs": [
        62
      ]
    }
  ]
}

gen_ai.request.model

stringScrub: ManualVisibility: PublicOTel: True

The model identifier being used for the request.

Examplegpt-4-turbo-preview
Changelog
nextAdded ai.model.id as an alias
v0.1.0#62#127
Raw JSON
{
  "key": "gen_ai.request.model",
  "brief": "The model identifier being used for the request.",
  "type": "string",
  "apply_scrubbing": {
    "key": "manual"
  },
  "is_in_otel": true,
  "visibility": "public",
  "example": "gpt-4-turbo-preview",
  "alias": [
    "ai.model_id",
    "ai.model.id"
  ],
  "changelog": [
    {
      "version": "next",
      "description": "Added ai.model.id as an alias"
    },
    {
      "version": "0.1.0",
      "prs": [
        62,
        127
      ]
    }
  ]
}

gen_ai.request.presence_penalty

doubleScrub: ManualVisibility: PublicOTel: True

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.

Example0.5
Changelog
v0.4.0#228
v0.1.0#57
Raw JSON
{
  "key": "gen_ai.request.presence_penalty",
  "brief": "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.",
  "type": "double",
  "apply_scrubbing": {
    "key": "manual"
  },
  "is_in_otel": true,
  "visibility": "public",
  "example": 0.5,
  "alias": [
    "ai.presence_penalty"
  ],
  "changelog": [
    {
      "version": "0.4.0",
      "prs": [
        228
      ]
    },
    {
      "version": "0.1.0",
      "prs": [
        57
      ]
    }
  ]
}

gen_ai.request.reasoning.level

stringScrub: ManualVisibility: PublicOTel: True

The reasoning or thinking effort level requested for a GenAI model.

Examplehigh
Changelog
v0.17.0#502Added gen_ai.request.reasoning.level attribute
Raw JSON
{
  "key": "gen_ai.request.reasoning.level",
  "brief": "The reasoning or thinking effort level requested for a GenAI model.",
  "type": "string",
  "apply_scrubbing": {
    "key": "manual"
  },
  "is_in_otel": true,
  "visibility": "public",
  "example": "high",
  "changelog": [
    {
      "version": "0.17.0",
      "prs": [
        502
      ],
      "description": "Added gen_ai.request.reasoning.level attribute"
    }
  ]
}

gen_ai.request.seed

stringScrub: ManualVisibility: PublicOTel: True

The seed, ideally models given the same seed and same other parameters will produce the exact same output.

Example1234567890
Aliasesai.seed
Changelog
v0.1.0#57#127
Raw JSON
{
  "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
      ]
    }
  ]
}

gen_ai.request.stop_sequences

string[]Scrub: ManualVisibility: PublicOTel: True

List of sequences that the model will use to stop generating further tokens.

Example["forest","lived"]
Changelog
v0.16.0#482Added gen_ai.request.stop_sequences attribute
Raw JSON
{
  "key": "gen_ai.request.stop_sequences",
  "brief": "List of sequences that the model will use to stop generating further tokens.",
  "type": "string[]",
  "apply_scrubbing": {
    "key": "manual"
  },
  "is_in_otel": true,
  "visibility": "public",
  "example": [
    "forest",
    "lived"
  ],
  "changelog": [
    {
      "version": "0.16.0",
      "prs": [
        482
      ],
      "description": "Added gen_ai.request.stop_sequences attribute"
    }
  ]
}

gen_ai.request.temperature

doubleScrub: ManualVisibility: PublicOTel: True

For an AI model call, the temperature parameter. Temperature essentially means how random the output will be.

Example0.1
Changelog
v0.4.0#228
v0.1.0#57
Raw JSON
{
  "key": "gen_ai.request.temperature",
  "brief": "For an AI model call, the temperature parameter. Temperature essentially means how random the output will be.",
  "type": "double",
  "apply_scrubbing": {
    "key": "manual"
  },
  "is_in_otel": true,
  "visibility": "public",
  "example": 0.1,
  "alias": [
    "ai.temperature"
  ],
  "changelog": [
    {
      "version": "0.4.0",
      "prs": [
        228
      ]
    },
    {
      "version": "0.1.0",
      "prs": [
        57
      ]
    }
  ]
}

gen_ai.request.top_k

integerScrub: ManualVisibility: PublicOTel: True

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).

Example35
Aliasesai.top_k
Changelog
v0.4.0#228
v0.1.0#57
Raw JSON
{
  "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
      ]
    }
  ]
}

gen_ai.request.top_p

doubleScrub: ManualVisibility: PublicOTel: True

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).

Example0.7
Aliasesai.top_p
Changelog
v0.4.0#228
v0.1.0#57
Raw JSON
{
  "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
      ]
    }
  ]
}

gen_ai.response.finish_reasons

stringScrub: ManualVisibility: PublicOTel: True

The reason why the model stopped generating.

Changelog
v0.1.0#57#127
Raw JSON
{
  "key": "gen_ai.response.finish_reasons",
  "brief": "The reason why the model stopped generating.",
  "type": "string",
  "apply_scrubbing": {
    "key": "manual"
  },
  "is_in_otel": true,
  "visibility": "public",
  "example": "COMPLETE",
  "alias": [
    "ai.finish_reason",
    "gen_ai.response.finish_reason"
  ],
  "changelog": [
    {
      "version": "0.1.0",
      "prs": [
        57,
        127
      ]
    }
  ]
}

gen_ai.response.id

stringScrub: ManualVisibility: PublicOTel: True

Unique identifier for the completion.

Examplegen_123abc
Changelog
nextAdded ai.response.id as an alias
v0.1.0#57#127
Raw JSON
{
  "key": "gen_ai.response.id",
  "brief": "Unique identifier for the completion.",
  "type": "string",
  "apply_scrubbing": {
    "key": "manual"
  },
  "is_in_otel": true,
  "visibility": "public",
  "example": "gen_123abc",
  "alias": [
    "ai.generation_id",
    "ai.response.id"
  ],
  "changelog": [
    {
      "version": "next",
      "description": "Added ai.response.id as an alias"
    },
    {
      "version": "0.1.0",
      "prs": [
        57,
        127
      ]
    }
  ]
}

gen_ai.response.model

stringScrub: ManualVisibility: PublicOTel: True

The vendor-specific ID of the model used.

Examplegpt-4
Changelog
nextAdded ai.response.model as an alias
v0.1.0#127
v0.0.0
Raw JSON
{
  "key": "gen_ai.response.model",
  "brief": "The vendor-specific ID of the model used.",
  "type": "string",
  "apply_scrubbing": {
    "key": "manual"
  },
  "is_in_otel": true,
  "visibility": "public",
  "example": "gpt-4",
  "alias": [
    "ai.response.model"
  ],
  "changelog": [
    {
      "version": "next",
      "description": "Added ai.response.model as an alias"
    },
    {
      "version": "0.1.0",
      "prs": [
        127
      ]
    },
    {
      "version": "0.0.0"
    }
  ]
}

gen_ai.response.streaming

booleanScrub: ManualVisibility: PublicOTel: False

Whether or not the AI model call's response was streamed back asynchronously

Exampletrue
Changelog
v0.1.0#76
Raw JSON
{
  "key": "gen_ai.response.streaming",
  "brief": "Whether or not the AI model call's response was streamed back asynchronously",
  "type": "boolean",
  "apply_scrubbing": {
    "key": "manual"
  },
  "is_in_otel": false,
  "visibility": "public",
  "example": true,
  "alias": [
    "ai.streaming"
  ],
  "changelog": [
    {
      "version": "0.1.0",
      "prs": [
        76
      ]
    }
  ]
}

gen_ai.response.time_to_first_chunk

doubleScrub: ManualVisibility: PublicOTel: True

Time in seconds when the first response content chunk arrived in streaming responses.

Changelog
v0.11.0#418Added gen_ai.response.time_to_first_chunk attribute
Raw JSON
{
  "key": "gen_ai.response.time_to_first_chunk",
  "brief": "Time in seconds when the first response content chunk arrived in streaming responses.",
  "type": "double",
  "apply_scrubbing": {
    "key": "manual"
  },
  "is_in_otel": true,
  "visibility": "public",
  "example": 0.6853435,
  "alias": [
    "gen_ai.response.time_to_first_token"
  ],
  "changelog": [
    {
      "version": "0.11.0",
      "prs": [
        418
      ],
      "description": "Added gen_ai.response.time_to_first_chunk attribute"
    }
  ]
}

gen_ai.response.tokens_per_second

doubleScrub: ManualVisibility: PublicOTel: False

The total output tokens per seconds throughput

Example12345.67
Changelog
v0.4.0#228
v0.1.0#66
Raw JSON
{
  "key": "gen_ai.response.tokens_per_second",
  "brief": "The total output tokens per seconds throughput",
  "type": "double",
  "apply_scrubbing": {
    "key": "manual"
  },
  "is_in_otel": false,
  "visibility": "public",
  "example": 12345.67,
  "changelog": [
    {
      "version": "0.4.0",
      "prs": [
        228
      ]
    },
    {
      "version": "0.1.0",
      "prs": [
        66
      ]
    }
  ]
}

gen_ai.system_instructions

stringScrub: ManualVisibility: PublicOTel: True

The system instructions passed to the model.

ExampleYou are a helpful assistant
Changelog
v0.5.0#264
v0.4.0#221
Raw JSON
{
  "key": "gen_ai.system_instructions",
  "brief": "The system instructions passed to the model.",
  "type": "string",
  "apply_scrubbing": {
    "key": "manual"
  },
  "is_in_otel": true,
  "visibility": "public",
  "example": "You are a helpful assistant",
  "alias": [
    "ai.preamble"
  ],
  "changelog": [
    {
      "version": "0.5.0",
      "prs": [
        264
      ]
    },
    {
      "version": "0.4.0",
      "prs": [
        221
      ]
    }
  ]
}

gen_ai.tool.call.arguments

stringScrub: ManualVisibility: PublicOTel: True

The arguments of the tool call. It has to be a stringified version of the arguments to the tool.

Example{"location": "Paris"}
Changelog
v0.5.0#265
v0.4.0#221
Raw JSON
{
  "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
      ]
    }
  ]
}

gen_ai.tool.call.result

stringScrub: ManualVisibility: PublicOTel: True

The result of the tool call. It has to be a stringified version of the result of the tool.

Changelog
v0.5.0#265
v0.4.0#221
Raw JSON
{
  "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"
  ],
  "changelog": [
    {
      "version": "0.5.0",
      "prs": [
        265
      ]
    },
    {
      "version": "0.4.0",
      "prs": [
        221
      ]
    }
  ]
}

gen_ai.tool.definitions

stringScrub: ManualVisibility: PublicOTel: True

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"]}}]
Changelog
v0.4.0#221
Raw JSON
{
  "key": "gen_ai.tool.definitions",
  "brief": "The list of source system tool definitions available to the GenAI agent or model.",
  "type": "string",
  "apply_scrubbing": {
    "key": "manual"
  },
  "is_in_otel": true,
  "visibility": "public",
  "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\"]}}]",
  "changelog": [
    {
      "version": "0.4.0",
      "prs": [
        221
      ]
    }
  ]
}

gen_ai.tool.description

stringScrub: ManualVisibility: PublicOTel: True

The description of the tool being used.

ExampleSearches the web for current information about a topic
Changelog
v0.1.0#62#127
Raw JSON
{
  "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
      ]
    }
  ]
}

gen_ai.tool.name

stringScrub: ManualVisibility: PublicOTel: True

Name of the tool utilized by the agent.

ExampleFlights
Changelog
v0.1.0#57#127
Raw JSON
{
  "key": "gen_ai.tool.name",
  "brief": "Name of the tool utilized by the agent.",
  "type": "string",
  "apply_scrubbing": {
    "key": "manual"
  },
  "is_in_otel": true,
  "visibility": "public",
  "example": "Flights",
  "alias": [
    "ai.function_call",
    "mcp.tool.name"
  ],
  "changelog": [
    {
      "version": "0.1.0",
      "prs": [
        57,
        127
      ]
    }
  ]
}

gen_ai.usage.cache_creation.input_tokens

integerScrub: ManualVisibility: PublicOTel: True

The number of tokens written to the cache when processing the AI input (prompt).

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.
Changelog
v0.11.0#418Added gen_ai.usage.cache_creation.input_tokens attribute
Raw JSON
{
  "key": "gen_ai.usage.cache_creation.input_tokens",
  "brief": "The number of tokens written to the cache when processing the AI input (prompt).",
  "type": "integer",
  "apply_scrubbing": {
    "key": "manual"
  },
  "is_in_otel": true,
  "visibility": "public",
  "example": 100,
  "alias": [
    "gen_ai.usage.input_tokens.cache_write"
  ],
  "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."
  ],
  "changelog": [
    {
      "version": "0.11.0",
      "prs": [
        418
      ],
      "description": "Added gen_ai.usage.cache_creation.input_tokens attribute"
    }
  ]
}

gen_ai.usage.cache_read.input_tokens

integerScrub: ManualVisibility: PublicOTel: True

The number of cached tokens used to process the AI input (prompt).

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
v0.11.0#418Added gen_ai.usage.cache_read.input_tokens attribute
Raw JSON
{
  "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"
  ],
  "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.11.0",
      "prs": [
        418
      ],
      "description": "Added gen_ai.usage.cache_read.input_tokens attribute"
    }
  ]
}

gen_ai.usage.input_tokens

integerScrub: ManualVisibility: PublicOTel: True

The number of tokens used to process the AI input (prompt) including cached 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 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
v0.9.0#397Add additional_context
v0.5.0#261
v0.4.0#228
v0.1.0#112
v0.0.0
Raw JSON
{
  "key": "gen_ai.usage.input_tokens",
  "brief": "The number of tokens used to process the AI input (prompt) including cached input tokens.",
  "type": "integer",
  "apply_scrubbing": {
    "key": "manual"
  },
  "is_in_otel": true,
  "visibility": "public",
  "example": 10,
  "alias": [
    "ai.prompt_tokens.used",
    "gen_ai.usage.prompt_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 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": [
    {
      "version": "0.11.0",
      "prs": [
        418
      ],
      "description": "Update additional_context to reference gen_ai.usage.cache_read.input_tokens"
    },
    {
      "version": "0.9.0",
      "prs": [
        397
      ],
      "description": "Add additional_context"
    },
    {
      "version": "0.5.0",
      "prs": [
        261
      ]
    },
    {
      "version": "0.4.0",
      "prs": [
        228
      ]
    },
    {
      "version": "0.1.0",
      "prs": [
        112
      ]
    },
    {
      "version": "0.0.0"
    }
  ]
}

gen_ai.usage.output_tokens

integerScrub: ManualVisibility: PublicOTel: True

The number of tokens used for creating the AI output (including reasoning 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 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
v0.9.0#397Add additional_context
v0.5.0#261
v0.4.0#228
v0.1.0#112
v0.0.0
Raw JSON
{
  "key": "gen_ai.usage.output_tokens",
  "brief": "The number of tokens used for creating the AI output (including reasoning tokens).",
  "type": "integer",
  "apply_scrubbing": {
    "key": "manual"
  },
  "is_in_otel": true,
  "visibility": "public",
  "example": 10,
  "alias": [
    "ai.completion_tokens.used",
    "gen_ai.usage.completion_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 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": [
    {
      "version": "0.11.0",
      "prs": [
        418
      ],
      "description": "Update additional_context to reference gen_ai.usage.reasoning.output_tokens"
    },
    {
      "version": "0.9.0",
      "prs": [
        397
      ],
      "description": "Add additional_context"
    },
    {
      "version": "0.5.0",
      "prs": [
        261
      ]
    },
    {
      "version": "0.4.0",
      "prs": [
        228
      ]
    },
    {
      "version": "0.1.0",
      "prs": [
        112
      ]
    },
    {
      "version": "0.0.0"
    }
  ]
}

gen_ai.usage.reasoning.output_tokens

integerScrub: ManualVisibility: PublicOTel: True

The number of tokens used for reasoning to create the AI output.

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
v0.11.0#418Added gen_ai.usage.reasoning.output_tokens attribute
Raw JSON
{
  "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"
    }
  ]
}

gen_ai.usage.total_tokens

integerScrub: ManualVisibility: PublicOTel: False

The total number of tokens used to process the prompt. (input tokens plus output todkens)

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
nextAdded ai.usage.tokens as an alias
v0.9.0#397Add additional_context
v0.4.0#228
v0.1.0#57
Raw JSON
{
  "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": "next",
      "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.

gen_ai.promptDeprecated

stringScrub: ManualVisibility: PublicOTel: True

The input messages sent to the model

Example[{"role": "user", "message": "hello"}]

Use gen_ai.input.messages instead.

Deprecated from OTEL, use gen_ai.input.messages with the new format instead.

Status: backfill

Changelog
nextAdded ai.prompt as an alias
v0.0.0
Raw JSON
{
  "key": "gen_ai.prompt",
  "brief": "The input messages sent to the model",
  "type": "string",
  "apply_scrubbing": {
    "key": "manual"
  },
  "is_in_otel": true,
  "visibility": "public",
  "example": "[{\"role\": \"user\", \"message\": \"hello\"}]",
  "deprecation": {
    "replacement": "gen_ai.input.messages",
    "reason": "Deprecated from OTEL, use gen_ai.input.messages with the new format instead.",
    "_status": "backfill"
  },
  "alias": [
    "gen_ai.input.messages",
    "ai.texts",
    "ai.prompt.messages",
    "ai.prompt"
  ],
  "changelog": [
    {
      "version": "next",
      "description": "Added ai.prompt as an alias"
    },
    {
      "version": "0.1.0",
      "prs": [
        74,
        108,
        119
      ]
    },
    {
      "version": "0.0.0"
    }
  ]
}

gen_ai.request.available_toolsDeprecated

stringScrub: ManualVisibility: PublicOTel: False

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"}]

Use gen_ai.tool.definitions instead.

Status: normalize

Changelog
v0.4.0#221
v0.1.0#63#127
Raw JSON
{
  "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": [],
  "changelog": [
    {
      "version": "0.4.0",
      "prs": [
        221
      ]
    },
    {
      "version": "0.1.0",
      "prs": [
        63,
        127
      ]
    }
  ]
}

gen_ai.request.messagesDeprecated

stringScrub: ManualVisibility: PublicOTel: False

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"}}]

Use gen_ai.input.messages instead.

Status: transform

Changelog
Raw JSON
{
  "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
      ]
    }
  ]
}

gen_ai.request.schemaDeprecated

stringScrub: ManualVisibility: PublicOTel: False

The stringified JSON schema the model output must conform to.

Examples{"type":"object","properties":{"city":{"type":"string"}}}

No replacement available at this time.

This attribute is deprecated. The Sentry conventions have no replacement for the requested output schema.

Changelog
next#583Added gen_ai.request.schema attribute
Raw JSON
{
  "key": "gen_ai.request.schema",
  "brief": "The stringified JSON schema the model output must conform to.",
  "type": "string",
  "apply_scrubbing": {
    "key": "manual"
  },
  "is_in_otel": false,
  "visibility": "public",
  "examples": [
    "{\"type\":\"object\",\"properties\":{\"city\":{\"type\":\"string\"}}}"
  ],
  "deprecation": {
    "reason": "This attribute is deprecated. The Sentry conventions have no replacement for the requested output schema.",
    "_status": null
  },
  "changelog": [
    {
      "version": "next",
      "prs": [
        583
      ],
      "description": "Added gen_ai.request.schema attribute"
    }
  ]
}

gen_ai.response.finish_reasonDeprecated

stringScrub: ManualVisibility: PublicOTel: False

The reason why the model stopped generating (singular form).

ExampleCOMPLETE

Use gen_ai.response.finish_reasons instead.

Status: normalize

Changelog
v0.19.0#498Added gen_ai.response.finish_reason attribute
Raw JSON
{
  "key": "gen_ai.response.finish_reason",
  "brief": "The reason why the model stopped generating (singular form).",
  "type": "string",
  "apply_scrubbing": {
    "key": "manual"
  },
  "is_in_otel": false,
  "visibility": "public",
  "example": "COMPLETE",
  "deprecation": {
    "replacement": "gen_ai.response.finish_reasons",
    "_status": "normalize"
  },
  "alias": [
    "gen_ai.response.finish_reasons"
  ],
  "changelog": [
    {
      "version": "0.19.0",
      "prs": [
        498
      ],
      "description": "Added gen_ai.response.finish_reason attribute"
    }
  ]
}

gen_ai.response.objectDeprecated

stringScrub: ManualVisibility: PublicOTel: False

The type of the object returned by the model.

Exampleschat.completion

No replacement available at this time.

This attribute is deprecated. The Sentry conventions have no replacement for the raw response object type.

Changelog
next#583Added gen_ai.response.object attribute
Raw JSON
{
  "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": "next",
      "prs": [
        583
      ],
      "description": "Added gen_ai.response.object attribute"
    }
  ]
}

gen_ai.response.textDeprecated

stringScrub: ManualVisibility: PublicOTel: False

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"]

Use gen_ai.output.messages instead.

Status: transform

Changelog
v0.4.0#221
v0.1.0#63#74
Raw JSON
{
  "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
      ]
    }
  ]
}

gen_ai.response.time_to_first_tokenDeprecated

doubleScrub: ManualVisibility: PublicOTel: False

Time in seconds when the first response content chunk arrived in streaming responses.

Example0.6853435

Use gen_ai.response.time_to_first_chunk instead.

Status: backfill

Changelog
v0.11.0#418Deprecate in favor of gen_ai.response.time_to_first_chunk
v0.4.0#227
Raw JSON
{
  "key": "gen_ai.response.time_to_first_token",
  "brief": "Time in seconds when the first response content chunk arrived in streaming responses.",
  "type": "double",
  "apply_scrubbing": {
    "key": "manual"
  },
  "is_in_otel": false,
  "visibility": "public",
  "example": 0.6853435,
  "deprecation": {
    "replacement": "gen_ai.response.time_to_first_chunk",
    "_status": "backfill"
  },
  "alias": [
    "gen_ai.response.time_to_first_chunk"
  ],
  "changelog": [
    {
      "version": "0.11.0",
      "prs": [
        418
      ],
      "description": "Deprecate in favor of gen_ai.response.time_to_first_chunk"
    },
    {
      "version": "0.4.0",
      "prs": [
        227
      ]
    }
  ]
}

gen_ai.response.tool_callsDeprecated

stringScrub: ManualVisibility: PublicOTel: False

The tool calls in the model's response. It has to be a stringified version of an array of objects.

Example[{"name": "get_weather", "arguments": {"location": "Paris"}}]

Use gen_ai.output.messages instead.

Status: transform

Changelog
v0.4.0#221
v0.1.0#63#74
Raw JSON
{
  "key": "gen_ai.response.tool_calls",
  "brief": "The tool calls in the model's response. 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\", \"arguments\": {\"location\": \"Paris\"}}]",
  "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
      ]
    }
  ]
}

gen_ai.systemDeprecated

stringScrub: ManualVisibility: PublicOTel: True

The provider of the model.

Exampleopenai

Use gen_ai.provider.name instead.

Status: normalize

Changelog
v0.4.0#253
v0.1.0#57#127
Raw JSON
{
  "key": "gen_ai.system",
  "brief": "The provider of the model.",
  "type": "string",
  "apply_scrubbing": {
    "key": "manual"
  },
  "is_in_otel": true,
  "visibility": "public",
  "example": "openai",
  "deprecation": {
    "replacement": "gen_ai.provider.name",
    "_status": "normalize"
  },
  "alias": [
    "ai.model.provider",
    "gen_ai.provider.name"
  ],
  "changelog": [
    {
      "version": "0.4.0",
      "prs": [
        253
      ]
    },
    {
      "version": "0.1.0",
      "prs": [
        57,
        127
      ]
    }
  ]
}

gen_ai.system.messageDeprecated

stringScrub: AutoVisibility: PublicOTel: False

The system instructions passed to the model.

ExampleYou are a helpful assistant

Use gen_ai.system_instructions instead.

Status: backfill

Changelog
v0.4.0#221
v0.1.0#62
Raw JSON
{
  "key": "gen_ai.system.message",
  "brief": "The system instructions passed to the model.",
  "type": "string",
  "apply_scrubbing": {
    "key": "auto"
  },
  "is_in_otel": false,
  "visibility": "public",
  "example": "You are a helpful assistant",
  "deprecation": {
    "replacement": "gen_ai.system_instructions",
    "_status": "backfill"
  },
  "changelog": [
    {
      "version": "0.4.0",
      "prs": [
        221
      ]
    },
    {
      "version": "0.1.0",
      "prs": [
        62
      ]
    }
  ]
}

gen_ai.tool.inputDeprecated

stringScrub: ManualVisibility: PublicOTel: False

The input of the tool being used. It has to be a stringified version of the input to the tool.

Example{"location": "Paris"}

Use gen_ai.tool.call.arguments instead.

Status: normalize

Changelog
v0.5.0#265
v0.1.0#63#74
Raw JSON
{
  "key": "gen_ai.tool.input",
  "brief": "The input of the tool being used. It has to be a stringified version of the input to the tool.",
  "type": "string",
  "apply_scrubbing": {
    "key": "manual"
  },
  "is_in_otel": false,
  "visibility": "public",
  "example": "{\"location\": \"Paris\"}",
  "deprecation": {
    "replacement": "gen_ai.tool.call.arguments",
    "_status": "normalize"
  },
  "alias": [
    "gen_ai.tool.call.arguments",
    "ai.toolCall.args"
  ],
  "changelog": [
    {
      "version": "0.5.0",
      "prs": [
        265
      ]
    },
    {
      "version": "0.1.0",
      "prs": [
        63,
        74
      ]
    }
  ]
}

gen_ai.tool.messageDeprecated

stringScrub: AutoVisibility: PublicOTel: False

The response from a tool or function call passed to the model.

Changelog
v0.5.0#265
v0.1.0#62
Raw JSON
{
  "key": "gen_ai.tool.message",
  "brief": "The response from a tool or function call passed to the model.",
  "type": "string",
  "apply_scrubbing": {
    "key": "auto"
  },
  "is_in_otel": false,
  "visibility": "public",
  "example": "rainy, 57°F",
  "deprecation": {
    "replacement": "gen_ai.tool.call.result",
    "_status": "normalize"
  },
  "alias": [
    "gen_ai.tool.call.result",
    "gen_ai.tool.output",
    "mcp.tool.result.content",
    "ai.toolCall.result"
  ],
  "changelog": [
    {
      "version": "0.5.0",
      "prs": [
        265
      ]
    },
    {
      "version": "0.1.0",
      "prs": [
        62
      ]
    }
  ]
}

gen_ai.tool.outputDeprecated

stringScrub: ManualVisibility: PublicOTel: False

The output of the tool being used. It has to be a stringified version of the output of the tool.

Changelog
v0.5.0#265
v0.1.0#63#74
Raw JSON
{
  "key": "gen_ai.tool.output",
  "brief": "The output of the tool being used. It has to be a stringified version of the output of the tool.",
  "type": "string",
  "apply_scrubbing": {
    "key": "manual"
  },
  "is_in_otel": false,
  "visibility": "public",
  "example": "rainy, 57°F",
  "deprecation": {
    "replacement": "gen_ai.tool.call.result",
    "_status": "normalize"
  },
  "alias": [
    "gen_ai.tool.call.result",
    "gen_ai.tool.message",
    "mcp.tool.result.content",
    "ai.toolCall.result"
  ],
  "changelog": [
    {
      "version": "0.5.0",
      "prs": [
        265
      ]
    },
    {
      "version": "0.1.0",
      "prs": [
        63,
        74
      ]
    }
  ]
}

gen_ai.tool.typeDeprecated

stringScrub: ManualVisibility: PublicOTel: True

The type of tool being used.

Examplefunction

No replacement available at this time.

The gen_ai.tool.type attribute is deprecated and should no longer be set.

Changelog
v0.1.0#62#127
Raw JSON
{
  "key": "gen_ai.tool.type",
  "brief": "The type of tool being used.",
  "type": "string",
  "apply_scrubbing": {
    "key": "manual"
  },
  "is_in_otel": true,
  "visibility": "public",
  "example": "function",
  "deprecation": {
    "reason": "The gen_ai.tool.type attribute is deprecated and should no longer be set.",
    "_status": null
  },
  "changelog": [
    {
      "version": "0.1.0",
      "prs": [
        62,
        127
      ]
    }
  ]
}

gen_ai.usage.completion_tokensDeprecated

integerScrub: ManualVisibility: PublicOTel: True

The number of tokens used in the GenAI response (completion).

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.
Changelog
v0.9.0#397Add additional_context
v0.4.0#228
v0.1.0#61
v0.0.0
Raw JSON
{
  "key": "gen_ai.usage.completion_tokens",
  "brief": "The number of tokens used in the GenAI response (completion).",
  "type": "integer",
  "apply_scrubbing": {
    "key": "manual"
  },
  "is_in_otel": true,
  "visibility": "public",
  "example": 10,
  "deprecation": {
    "replacement": "gen_ai.usage.output_tokens",
    "_status": "backfill"
  },
  "alias": [
    "ai.completion_tokens.used",
    "gen_ai.usage.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."
  ],
  "changelog": [
    {
      "version": "0.9.0",
      "prs": [
        397
      ],
      "description": "Add additional_context"
    },
    {
      "version": "0.4.0",
      "prs": [
        228
      ]
    },
    {
      "version": "0.1.0",
      "prs": [
        61
      ]
    },
    {
      "version": "0.0.0"
    }
  ]
}

gen_ai.usage.input_tokens.cache_writeDeprecated

integerScrub: ManualVisibility: PublicOTel: False

The number of tokens written to the cache when processing the AI input (prompt).

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.
Changelog
v0.11.0#418Deprecate in favor of gen_ai.usage.cache_creation.input_tokens
v0.9.0#397Add additional_context
v0.4.0#217#228
Raw JSON
{
  "key": "gen_ai.usage.input_tokens.cache_write",
  "brief": "The number of tokens written to the cache when processing the AI input (prompt).",
  "type": "integer",
  "apply_scrubbing": {
    "key": "manual"
  },
  "is_in_otel": false,
  "visibility": "public",
  "example": 100,
  "deprecation": {
    "replacement": "gen_ai.usage.cache_creation.input_tokens",
    "_status": "backfill"
  },
  "alias": [
    "gen_ai.usage.cache_creation.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."
  ],
  "changelog": [
    {
      "version": "0.11.0",
      "prs": [
        418
      ],
      "description": "Deprecate in favor of gen_ai.usage.cache_creation.input_tokens"
    },
    {
      "version": "0.9.0",
      "prs": [
        397
      ],
      "description": "Add additional_context"
    },
    {
      "version": "0.4.0",
      "prs": [
        217,
        228
      ]
    }
  ]
}

gen_ai.usage.input_tokens.cachedDeprecated

integerScrub: ManualVisibility: PublicOTel: False

The number of cached tokens used to process the AI input (prompt).

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
v0.11.0#418Deprecate in favor of gen_ai.usage.cache_read.input_tokens
v0.9.0#397Add additional_context
v0.4.0#228
v0.1.0#62#112
Raw JSON
{
  "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"
  ],
  "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.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
      ]
    }
  ]
}

gen_ai.usage.output_tokens.reasoningDeprecated

integerScrub: ManualVisibility: PublicOTel: False

The number of tokens used for reasoning to create the AI output.

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
v0.11.0#418Deprecate in favor of gen_ai.usage.reasoning.output_tokens
v0.9.0#397Add additional_context
v0.4.0#228
v0.1.0#62#112
Raw JSON
{
  "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
      ]
    }
  ]
}

gen_ai.usage.prompt_tokensDeprecated

integerScrub: ManualVisibility: PublicOTel: True

The number of tokens used in the GenAI input (prompt).

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.
Changelog
v0.9.0#397Add additional_context
v0.4.0#228
v0.1.0#61
v0.0.0
Raw JSON
{
  "key": "gen_ai.usage.prompt_tokens",
  "brief": "The number of tokens used in the GenAI input (prompt).",
  "type": "integer",
  "apply_scrubbing": {
    "key": "manual"
  },
  "is_in_otel": true,
  "visibility": "public",
  "example": 20,
  "deprecation": {
    "replacement": "gen_ai.usage.input_tokens",
    "_status": "backfill"
  },
  "alias": [
    "ai.prompt_tokens.used",
    "gen_ai.usage.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."
  ],
  "changelog": [
    {
      "version": "0.9.0",
      "prs": [
        397
      ],
      "description": "Add additional_context"
    },
    {
      "version": "0.4.0",
      "prs": [
        228
      ]
    },
    {
      "version": "0.1.0",
      "prs": [
        61
      ]
    },
    {
      "version": "0.0.0"
    }
  ]
}