diff --git a/.chloggen/gen-ai-reasoning-output-tokens.yaml b/.chloggen/gen-ai-reasoning-output-tokens.yaml
new file mode 100644
index 0000000000..6f28b49453
--- /dev/null
+++ b/.chloggen/gen-ai-reasoning-output-tokens.yaml
@@ -0,0 +1,6 @@
+change_type: enhancement
+component: gen-ai
+note: Add `gen_ai.usage.reasoning.output_tokens` attribute for reasoning tokens
+issues: [3194]
+subtext: |
+ - Add `gen_ai.usage.reasoning.output_tokens` for tokens used for reasoning
diff --git a/docs/gen-ai/anthropic.md b/docs/gen-ai/anthropic.md
index 7bd74b9431..7f6b8a9fcc 100644
--- a/docs/gen-ai/anthropic.md
+++ b/docs/gen-ai/anthropic.md
@@ -88,11 +88,12 @@ Semantic Conventions for [Anthropic](https://www.anthropic.com/) client spans ex
| [`gen_ai.usage.cache_read.input_tokens`](/docs/registry/attributes/gen-ai.md) |  | `Recommended` | int | The number of input tokens served from a provider-managed cache. [11] | `50` |
| [`gen_ai.usage.input_tokens`](/docs/registry/attributes/gen-ai.md) |  | `Recommended` | int | The number of tokens used in the GenAI input (prompt). [12] | `100` |
| [`gen_ai.usage.output_tokens`](/docs/registry/attributes/gen-ai.md) |  | `Recommended` | int | The number of tokens used in the GenAI response (completion). | `180` |
-| [`server.address`](/docs/registry/attributes/server.md) |  | `Recommended` | string | GenAI server address. [13] | `example.com`; `10.1.2.80`; `/tmp/my.sock` |
-| [`gen_ai.input.messages`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | The chat history provided to the model as an input. [14] | [
{
"role": "user",
"parts": [
{
"type": "text",
"content": "Weather in Paris?"
}
]
},
{
"role": "assistant",
"parts": [
{
"type": "tool_call",
"id": "call_VSPygqKTWdrhaFErNvMV18Yl",
"name": "get_weather",
"arguments": {
"location": "Paris"
}
}
]
},
{
"role": "tool",
"parts": [
{
"type": "tool_call_response",
"id": " call_VSPygqKTWdrhaFErNvMV18Yl",
"result": "rainy, 57°F"
}
]
}
] |
-| [`gen_ai.output.messages`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | Messages returned by the model where each message represents a specific model response (choice, candidate). [15] | [
{
"role": "assistant",
"parts": [
{
"type": "text",
"content": "The weather in Paris is currently rainy with a temperature of 57°F."
}
],
"finish_reason": "stop"
}
] |
-| [`gen_ai.system_instructions`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | The system message or instructions provided to the GenAI model separately from the chat history. [16] | [
{
"type": "text",
"content": "You are an Agent that greet users, always use greetings tool to respond"
}
]; [
{
"type": "text",
"content": "You are a language translator."
},
{
"type": "text",
"content": "Your mission is to translate text in English to French."
}
] |
-| [`gen_ai.tool.definitions`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | The list of tool definitions available to the GenAI agent or model. [17] | [
{
"type": "function",
"name": "get_current_weather",
"description": "Get the current weather in a given location",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city and state, e.g. San Francisco, CA"
},
"unit": {
"type": "string",
"enum": [
"celsius",
"fahrenheit"
]
}
},
"required": [
"location",
"unit"
]
}
}
] |
+| [`gen_ai.usage.reasoning.output_tokens`](/docs/registry/attributes/gen-ai.md) |  | `Recommended` when applicable | int | The number of output tokens used for reasoning (e.g. chain-of-thought, extended thinking). [13] | `50` |
+| [`server.address`](/docs/registry/attributes/server.md) |  | `Recommended` | string | GenAI server address. [14] | `example.com`; `10.1.2.80`; `/tmp/my.sock` |
+| [`gen_ai.input.messages`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | The chat history provided to the model as an input. [15] | [
{
"role": "user",
"parts": [
{
"type": "text",
"content": "Weather in Paris?"
}
]
},
{
"role": "assistant",
"parts": [
{
"type": "tool_call",
"id": "call_VSPygqKTWdrhaFErNvMV18Yl",
"name": "get_weather",
"arguments": {
"location": "Paris"
}
}
]
},
{
"role": "tool",
"parts": [
{
"type": "tool_call_response",
"id": " call_VSPygqKTWdrhaFErNvMV18Yl",
"result": "rainy, 57°F"
}
]
}
] |
+| [`gen_ai.output.messages`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | Messages returned by the model where each message represents a specific model response (choice, candidate). [16] | [
{
"role": "assistant",
"parts": [
{
"type": "text",
"content": "The weather in Paris is currently rainy with a temperature of 57°F."
}
],
"finish_reason": "stop"
}
] |
+| [`gen_ai.system_instructions`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | The system message or instructions provided to the GenAI model separately from the chat history. [17] | [
{
"type": "text",
"content": "You are an Agent that greet users, always use greetings tool to respond"
}
]; [
{
"type": "text",
"content": "You are a language translator."
},
{
"type": "text",
"content": "Your mission is to translate text in English to French."
}
] |
+| [`gen_ai.tool.definitions`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | The list of tool definitions available to the GenAI agent or model. [18] | [
{
"type": "function",
"name": "get_current_weather",
"description": "Get the current weather in a given location",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city and state, e.g. San Francisco, CA"
},
"unit": {
"type": "string",
"enum": [
"celsius",
"fahrenheit"
]
}
},
"required": [
"location",
"unit"
]
}
}
] |
**[1] `gen_ai.operation.name`:** If one of the predefined values applies, but specific system uses a different name it's RECOMMENDED to document it in the semantic conventions for specific GenAI system and use system-specific name in the instrumentation. If a different name is not documented, instrumentation libraries SHOULD use applicable predefined value.
@@ -133,9 +134,11 @@ Additional output format details may be recorded in the future in the `gen_ai.ou
**[12] `gen_ai.usage.input_tokens`:** Anthropic `input_tokens` excludes cached tokens. Compute: `gen_ai.usage.input_tokens = input_tokens + cache_read_input_tokens + cache_creation_input_tokens`
-**[13] `server.address`:** When observed from the client side, and when communicating through an intermediary, `server.address` SHOULD represent the server address behind any intermediaries, for example proxies, if it's available.
+**[13] `gen_ai.usage.reasoning.output_tokens`:** The value SHOULD be included in `gen_ai.usage.output_tokens`.
-**[14] `gen_ai.input.messages`:** Instrumentations MUST follow [Input messages JSON schema](/docs/gen-ai/gen-ai-input-messages.json).
+**[14] `server.address`:** When observed from the client side, and when communicating through an intermediary, `server.address` SHOULD represent the server address behind any intermediaries, for example proxies, if it's available.
+
+**[15] `gen_ai.input.messages`:** Instrumentations MUST follow [Input messages JSON schema](/docs/gen-ai/gen-ai-input-messages.json).
When the attribute is recorded on events, it MUST be recorded in structured
form. When recorded on spans, it MAY be recorded as a JSON string if structured
format is not supported and SHOULD be recorded in structured form otherwise.
@@ -150,7 +153,7 @@ input messages.
See [Recording content on attributes](/docs/gen-ai/gen-ai-spans.md#recording-content-on-attributes)
section for more details.
-**[15] `gen_ai.output.messages`:** Instrumentations MUST follow [Output messages JSON schema](/docs/gen-ai/gen-ai-output-messages.json)
+**[16] `gen_ai.output.messages`:** Instrumentations MUST follow [Output messages JSON schema](/docs/gen-ai/gen-ai-output-messages.json)
Each message represents a single output choice/candidate generated by
the model. Each message corresponds to exactly one generation
@@ -170,7 +173,7 @@ output messages.
See [Recording content on attributes](/docs/gen-ai/gen-ai-spans.md#recording-content-on-attributes)
section for more details.
-**[16] `gen_ai.system_instructions`:** This attribute SHOULD be used when the corresponding provider or API
+**[17] `gen_ai.system_instructions`:** This attribute SHOULD be used when the corresponding provider or API
allows to provide system instructions or messages separately from the
chat history.
@@ -191,7 +194,7 @@ system instructions.
See [Recording content on attributes](/docs/gen-ai/gen-ai-spans.md#recording-content-on-attributes)
section for more details.
-**[17] `gen_ai.tool.definitions`:** Instrumentations MUST follow [Tool Definitions JSON Schema](/docs/gen-ai/gen-ai-tool-definitions.json).
+**[18] `gen_ai.tool.definitions`:** Instrumentations MUST follow [Tool Definitions JSON Schema](/docs/gen-ai/gen-ai-tool-definitions.json).
When the attribute is recorded on events, it MUST be recorded in structured
form. When recorded on spans, it MAY be recorded as a JSON string if structured
diff --git a/docs/gen-ai/aws-bedrock.md b/docs/gen-ai/aws-bedrock.md
index fc53143570..b0dd589361 100644
--- a/docs/gen-ai/aws-bedrock.md
+++ b/docs/gen-ai/aws-bedrock.md
@@ -81,11 +81,12 @@ Describes an AWS Bedrock operation span.
| [`gen_ai.usage.cache_read.input_tokens`](/docs/registry/attributes/gen-ai.md) |  | `Recommended` | int | The number of input tokens served from a provider-managed cache. [12] | `50` |
| [`gen_ai.usage.input_tokens`](/docs/registry/attributes/gen-ai.md) |  | `Recommended` | int | The number of tokens used in the GenAI input (prompt). [13] | `100` |
| [`gen_ai.usage.output_tokens`](/docs/registry/attributes/gen-ai.md) |  | `Recommended` | int | The number of tokens used in the GenAI response (completion). | `180` |
-| [`server.address`](/docs/registry/attributes/server.md) |  | `Recommended` | string | GenAI server address. [14] | `example.com`; `10.1.2.80`; `/tmp/my.sock` |
-| [`gen_ai.input.messages`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | The chat history provided to the model as an input. [15] | [
{
"role": "user",
"parts": [
{
"type": "text",
"content": "Weather in Paris?"
}
]
},
{
"role": "assistant",
"parts": [
{
"type": "tool_call",
"id": "call_VSPygqKTWdrhaFErNvMV18Yl",
"name": "get_weather",
"arguments": {
"location": "Paris"
}
}
]
},
{
"role": "tool",
"parts": [
{
"type": "tool_call_response",
"id": " call_VSPygqKTWdrhaFErNvMV18Yl",
"result": "rainy, 57°F"
}
]
}
] |
-| [`gen_ai.output.messages`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | Messages returned by the model where each message represents a specific model response (choice, candidate). [16] | [
{
"role": "assistant",
"parts": [
{
"type": "text",
"content": "The weather in Paris is currently rainy with a temperature of 57°F."
}
],
"finish_reason": "stop"
}
] |
-| [`gen_ai.system_instructions`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | The system message or instructions provided to the GenAI model separately from the chat history. [17] | [
{
"type": "text",
"content": "You are an Agent that greet users, always use greetings tool to respond"
}
]; [
{
"type": "text",
"content": "You are a language translator."
},
{
"type": "text",
"content": "Your mission is to translate text in English to French."
}
] |
-| [`gen_ai.tool.definitions`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | The list of tool definitions available to the GenAI agent or model. [18] | [
{
"type": "function",
"name": "get_current_weather",
"description": "Get the current weather in a given location",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city and state, e.g. San Francisco, CA"
},
"unit": {
"type": "string",
"enum": [
"celsius",
"fahrenheit"
]
}
},
"required": [
"location",
"unit"
]
}
}
] |
+| [`gen_ai.usage.reasoning.output_tokens`](/docs/registry/attributes/gen-ai.md) |  | `Recommended` when applicable | int | The number of output tokens used for reasoning (e.g. chain-of-thought, extended thinking). [14] | `50` |
+| [`server.address`](/docs/registry/attributes/server.md) |  | `Recommended` | string | GenAI server address. [15] | `example.com`; `10.1.2.80`; `/tmp/my.sock` |
+| [`gen_ai.input.messages`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | The chat history provided to the model as an input. [16] | [
{
"role": "user",
"parts": [
{
"type": "text",
"content": "Weather in Paris?"
}
]
},
{
"role": "assistant",
"parts": [
{
"type": "tool_call",
"id": "call_VSPygqKTWdrhaFErNvMV18Yl",
"name": "get_weather",
"arguments": {
"location": "Paris"
}
}
]
},
{
"role": "tool",
"parts": [
{
"type": "tool_call_response",
"id": " call_VSPygqKTWdrhaFErNvMV18Yl",
"result": "rainy, 57°F"
}
]
}
] |
+| [`gen_ai.output.messages`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | Messages returned by the model where each message represents a specific model response (choice, candidate). [17] | [
{
"role": "assistant",
"parts": [
{
"type": "text",
"content": "The weather in Paris is currently rainy with a temperature of 57°F."
}
],
"finish_reason": "stop"
}
] |
+| [`gen_ai.system_instructions`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | The system message or instructions provided to the GenAI model separately from the chat history. [18] | [
{
"type": "text",
"content": "You are an Agent that greet users, always use greetings tool to respond"
}
]; [
{
"type": "text",
"content": "You are a language translator."
},
{
"type": "text",
"content": "Your mission is to translate text in English to French."
}
] |
+| [`gen_ai.tool.definitions`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | The list of tool definitions available to the GenAI agent or model. [19] | [
{
"type": "function",
"name": "get_current_weather",
"description": "Get the current weather in a given location",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city and state, e.g. San Francisco, CA"
},
"unit": {
"type": "string",
"enum": [
"celsius",
"fahrenheit"
]
}
},
"required": [
"location",
"unit"
]
}
}
] |
**[1] `gen_ai.operation.name`:** If one of the predefined values applies, but specific system uses a different name it's RECOMMENDED to document it in the semantic conventions for specific GenAI system and use system-specific name in the instrumentation. If a different name is not documented, instrumentation libraries SHOULD use applicable predefined value.
@@ -148,9 +149,11 @@ Instrumentations SHOULD make a best effort to populate this value, using a total
provided by the provider when available or, depending on the provider API,
by summing different token types parsed from the provider output.
-**[14] `server.address`:** When observed from the client side, and when communicating through an intermediary, `server.address` SHOULD represent the server address behind any intermediaries, for example proxies, if it's available.
+**[14] `gen_ai.usage.reasoning.output_tokens`:** The value SHOULD be included in `gen_ai.usage.output_tokens`.
-**[15] `gen_ai.input.messages`:** Instrumentations MUST follow [Input messages JSON schema](/docs/gen-ai/gen-ai-input-messages.json).
+**[15] `server.address`:** When observed from the client side, and when communicating through an intermediary, `server.address` SHOULD represent the server address behind any intermediaries, for example proxies, if it's available.
+
+**[16] `gen_ai.input.messages`:** Instrumentations MUST follow [Input messages JSON schema](/docs/gen-ai/gen-ai-input-messages.json).
When the attribute is recorded on events, it MUST be recorded in structured
form. When recorded on spans, it MAY be recorded as a JSON string if structured
format is not supported and SHOULD be recorded in structured form otherwise.
@@ -165,7 +168,7 @@ input messages.
See [Recording content on attributes](/docs/gen-ai/gen-ai-spans.md#recording-content-on-attributes)
section for more details.
-**[16] `gen_ai.output.messages`:** Instrumentations MUST follow [Output messages JSON schema](/docs/gen-ai/gen-ai-output-messages.json)
+**[17] `gen_ai.output.messages`:** Instrumentations MUST follow [Output messages JSON schema](/docs/gen-ai/gen-ai-output-messages.json)
Each message represents a single output choice/candidate generated by
the model. Each message corresponds to exactly one generation
@@ -185,7 +188,7 @@ output messages.
See [Recording content on attributes](/docs/gen-ai/gen-ai-spans.md#recording-content-on-attributes)
section for more details.
-**[17] `gen_ai.system_instructions`:** This attribute SHOULD be used when the corresponding provider or API
+**[18] `gen_ai.system_instructions`:** This attribute SHOULD be used when the corresponding provider or API
allows to provide system instructions or messages separately from the
chat history.
@@ -206,7 +209,7 @@ system instructions.
See [Recording content on attributes](/docs/gen-ai/gen-ai-spans.md#recording-content-on-attributes)
section for more details.
-**[18] `gen_ai.tool.definitions`:** Instrumentations MUST follow [Tool Definitions JSON Schema](/docs/gen-ai/gen-ai-tool-definitions.json).
+**[19] `gen_ai.tool.definitions`:** Instrumentations MUST follow [Tool Definitions JSON Schema](/docs/gen-ai/gen-ai-tool-definitions.json).
When the attribute is recorded on events, it MUST be recorded in structured
form. When recorded on spans, it MAY be recorded as a JSON string if structured
@@ -272,9 +275,9 @@ and SHOULD be provided **at span creation time** (if provided at all):
| `azure.ai.openai` | [Azure OpenAI](https://learn.microsoft.com/en-us/azure/ai-services/openai/overview) |  |
| `cohere` | [Cohere](https://cohere.com/) |  |
| `deepseek` | [DeepSeek](https://www.deepseek.com/) |  |
-| `gcp.gemini` | [Gemini](https://cloud.google.com/products/gemini) [19] |  |
-| `gcp.gen_ai` | Any Google generative AI endpoint [20] |  |
-| `gcp.vertex_ai` | [Vertex AI](https://cloud.google.com/vertex-ai) [21] |  |
+| `gcp.gemini` | [Gemini](https://cloud.google.com/products/gemini) [20] |  |
+| `gcp.gen_ai` | Any Google generative AI endpoint [21] |  |
+| `gcp.vertex_ai` | [Vertex AI](https://cloud.google.com/vertex-ai) [22] |  |
| `groq` | [Groq](https://groq.com/) |  |
| `ibm.watsonx.ai` | [IBM Watsonx AI](https://www.ibm.com/products/watsonx-ai) |  |
| `mistral_ai` | [Mistral AI](https://mistral.ai/) |  |
@@ -282,11 +285,11 @@ and SHOULD be provided **at span creation time** (if provided at all):
| `perplexity` | [Perplexity](https://www.perplexity.ai/) |  |
| `x_ai` | [xAI](https://x.ai/) |  |
-**[19]:** Used when accessing the 'generativelanguage.googleapis.com' endpoint. Also known as the AI Studio API.
+**[20]:** Used when accessing the 'generativelanguage.googleapis.com' endpoint. Also known as the AI Studio API.
-**[20]:** May be used when specific backend is unknown.
+**[21]:** May be used when specific backend is unknown.
-**[21]:** Used when accessing the 'aiplatform.googleapis.com' endpoint.
+**[22]:** Used when accessing the 'aiplatform.googleapis.com' endpoint.
diff --git a/docs/gen-ai/azure-ai-inference.md b/docs/gen-ai/azure-ai-inference.md
index 4b3c5942ef..a3e794832e 100644
--- a/docs/gen-ai/azure-ai-inference.md
+++ b/docs/gen-ai/azure-ai-inference.md
@@ -90,11 +90,12 @@ model name is available and `{gen_ai.operation.name}` otherwise.
| [`gen_ai.usage.cache_read.input_tokens`](/docs/registry/attributes/gen-ai.md) |  | `Recommended` | int | The number of input tokens served from a provider-managed cache. [12] | `50` |
| [`gen_ai.usage.input_tokens`](/docs/registry/attributes/gen-ai.md) |  | `Recommended` | int | The number of prompt tokens as reported in the usage prompt_tokens property of the response. [13] | `100` |
| [`gen_ai.usage.output_tokens`](/docs/registry/attributes/gen-ai.md) |  | `Recommended` | int | The number of completion tokens as reported in the usage completion_tokens property of the response. | `180` |
-| [`server.address`](/docs/registry/attributes/server.md) |  | `Recommended` | string | GenAI server address. [14] | `example.com`; `10.1.2.80`; `/tmp/my.sock` |
-| [`gen_ai.input.messages`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | The chat history provided to the model as an input. [15] | [
{
"role": "user",
"parts": [
{
"type": "text",
"content": "Weather in Paris?"
}
]
},
{
"role": "assistant",
"parts": [
{
"type": "tool_call",
"id": "call_VSPygqKTWdrhaFErNvMV18Yl",
"name": "get_weather",
"arguments": {
"location": "Paris"
}
}
]
},
{
"role": "tool",
"parts": [
{
"type": "tool_call_response",
"id": " call_VSPygqKTWdrhaFErNvMV18Yl",
"result": "rainy, 57°F"
}
]
}
] |
-| [`gen_ai.output.messages`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | Messages returned by the model where each message represents a specific model response (choice, candidate). [16] | [
{
"role": "assistant",
"parts": [
{
"type": "text",
"content": "The weather in Paris is currently rainy with a temperature of 57°F."
}
],
"finish_reason": "stop"
}
] |
-| [`gen_ai.system_instructions`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | The system message or instructions provided to the GenAI model separately from the chat history. [17] | [
{
"type": "text",
"content": "You are an Agent that greet users, always use greetings tool to respond"
}
]; [
{
"type": "text",
"content": "You are a language translator."
},
{
"type": "text",
"content": "Your mission is to translate text in English to French."
}
] |
-| [`gen_ai.tool.definitions`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | The list of tool definitions available to the GenAI agent or model. [18] | [
{
"type": "function",
"name": "get_current_weather",
"description": "Get the current weather in a given location",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city and state, e.g. San Francisco, CA"
},
"unit": {
"type": "string",
"enum": [
"celsius",
"fahrenheit"
]
}
},
"required": [
"location",
"unit"
]
}
}
] |
+| [`gen_ai.usage.reasoning.output_tokens`](/docs/registry/attributes/gen-ai.md) |  | `Recommended` when applicable | int | The number of output tokens used for reasoning (e.g. chain-of-thought, extended thinking). [14] | `50` |
+| [`server.address`](/docs/registry/attributes/server.md) |  | `Recommended` | string | GenAI server address. [15] | `example.com`; `10.1.2.80`; `/tmp/my.sock` |
+| [`gen_ai.input.messages`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | The chat history provided to the model as an input. [16] | [
{
"role": "user",
"parts": [
{
"type": "text",
"content": "Weather in Paris?"
}
]
},
{
"role": "assistant",
"parts": [
{
"type": "tool_call",
"id": "call_VSPygqKTWdrhaFErNvMV18Yl",
"name": "get_weather",
"arguments": {
"location": "Paris"
}
}
]
},
{
"role": "tool",
"parts": [
{
"type": "tool_call_response",
"id": " call_VSPygqKTWdrhaFErNvMV18Yl",
"result": "rainy, 57°F"
}
]
}
] |
+| [`gen_ai.output.messages`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | Messages returned by the model where each message represents a specific model response (choice, candidate). [17] | [
{
"role": "assistant",
"parts": [
{
"type": "text",
"content": "The weather in Paris is currently rainy with a temperature of 57°F."
}
],
"finish_reason": "stop"
}
] |
+| [`gen_ai.system_instructions`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | The system message or instructions provided to the GenAI model separately from the chat history. [18] | [
{
"type": "text",
"content": "You are an Agent that greet users, always use greetings tool to respond"
}
]; [
{
"type": "text",
"content": "You are a language translator."
},
{
"type": "text",
"content": "Your mission is to translate text in English to French."
}
] |
+| [`gen_ai.tool.definitions`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | The list of tool definitions available to the GenAI agent or model. [19] | [
{
"type": "function",
"name": "get_current_weather",
"description": "Get the current weather in a given location",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city and state, e.g. San Francisco, CA"
},
"unit": {
"type": "string",
"enum": [
"celsius",
"fahrenheit"
]
}
},
"required": [
"location",
"unit"
]
}
}
] |
**[1] `gen_ai.operation.name`:** If one of the predefined values applies, but specific system uses a different name it's RECOMMENDED to document it in the semantic conventions for specific GenAI system and use system-specific name in the instrumentation. If a different name is not documented, instrumentation libraries SHOULD use applicable predefined value.
@@ -150,9 +151,11 @@ Instrumentations SHOULD make a best effort to populate this value, using a total
provided by the provider when available or, depending on the provider API,
by summing different token types parsed from the provider output.
-**[14] `server.address`:** When observed from the client side, and when communicating through an intermediary, `server.address` SHOULD represent the server address behind any intermediaries, for example proxies, if it's available.
+**[14] `gen_ai.usage.reasoning.output_tokens`:** The value SHOULD be included in `gen_ai.usage.output_tokens`.
-**[15] `gen_ai.input.messages`:** Instrumentations MUST follow [Input messages JSON schema](/docs/gen-ai/gen-ai-input-messages.json).
+**[15] `server.address`:** When observed from the client side, and when communicating through an intermediary, `server.address` SHOULD represent the server address behind any intermediaries, for example proxies, if it's available.
+
+**[16] `gen_ai.input.messages`:** Instrumentations MUST follow [Input messages JSON schema](/docs/gen-ai/gen-ai-input-messages.json).
When the attribute is recorded on events, it MUST be recorded in structured
form. When recorded on spans, it MAY be recorded as a JSON string if structured
format is not supported and SHOULD be recorded in structured form otherwise.
@@ -167,7 +170,7 @@ input messages.
See [Recording content on attributes](/docs/gen-ai/gen-ai-spans.md#recording-content-on-attributes)
section for more details.
-**[16] `gen_ai.output.messages`:** Instrumentations MUST follow [Output messages JSON schema](/docs/gen-ai/gen-ai-output-messages.json)
+**[17] `gen_ai.output.messages`:** Instrumentations MUST follow [Output messages JSON schema](/docs/gen-ai/gen-ai-output-messages.json)
Each message represents a single output choice/candidate generated by
the model. Each message corresponds to exactly one generation
@@ -187,7 +190,7 @@ output messages.
See [Recording content on attributes](/docs/gen-ai/gen-ai-spans.md#recording-content-on-attributes)
section for more details.
-**[17] `gen_ai.system_instructions`:** This attribute SHOULD be used when the corresponding provider or API
+**[18] `gen_ai.system_instructions`:** This attribute SHOULD be used when the corresponding provider or API
allows to provide system instructions or messages separately from the
chat history.
@@ -208,7 +211,7 @@ system instructions.
See [Recording content on attributes](/docs/gen-ai/gen-ai-spans.md#recording-content-on-attributes)
section for more details.
-**[18] `gen_ai.tool.definitions`:** Instrumentations MUST follow [Tool Definitions JSON Schema](/docs/gen-ai/gen-ai-tool-definitions.json).
+**[19] `gen_ai.tool.definitions`:** Instrumentations MUST follow [Tool Definitions JSON Schema](/docs/gen-ai/gen-ai-tool-definitions.json).
When the attribute is recorded on events, it MUST be recorded in structured
form. When recorded on spans, it MAY be recorded as a JSON string if structured
diff --git a/docs/gen-ai/gen-ai-events.md b/docs/gen-ai/gen-ai-events.md
index ba49491393..9907cad4d5 100644
--- a/docs/gen-ai/gen-ai-events.md
+++ b/docs/gen-ai/gen-ai-events.md
@@ -81,11 +81,12 @@ This event is opt-in and could be used to store input and output details indepen
| [`gen_ai.usage.cache_read.input_tokens`](/docs/registry/attributes/gen-ai.md) |  | `Recommended` | int | The number of input tokens served from a provider-managed cache. [11] | `50` |
| [`gen_ai.usage.input_tokens`](/docs/registry/attributes/gen-ai.md) |  | `Recommended` | int | The number of tokens used in the GenAI input (prompt). [12] | `100` |
| [`gen_ai.usage.output_tokens`](/docs/registry/attributes/gen-ai.md) |  | `Recommended` | int | The number of tokens used in the GenAI response (completion). | `180` |
-| [`server.address`](/docs/registry/attributes/server.md) |  | `Recommended` | string | GenAI server address. [13] | `example.com`; `10.1.2.80`; `/tmp/my.sock` |
-| [`gen_ai.input.messages`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | The chat history provided to the model as an input. [14] | [
{
"role": "user",
"parts": [
{
"type": "text",
"content": "Weather in Paris?"
}
]
},
{
"role": "assistant",
"parts": [
{
"type": "tool_call",
"id": "call_VSPygqKTWdrhaFErNvMV18Yl",
"name": "get_weather",
"arguments": {
"location": "Paris"
}
}
]
},
{
"role": "tool",
"parts": [
{
"type": "tool_call_response",
"id": " call_VSPygqKTWdrhaFErNvMV18Yl",
"result": "rainy, 57°F"
}
]
}
] |
-| [`gen_ai.output.messages`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | Messages returned by the model where each message represents a specific model response (choice, candidate). [15] | [
{
"role": "assistant",
"parts": [
{
"type": "text",
"content": "The weather in Paris is currently rainy with a temperature of 57°F."
}
],
"finish_reason": "stop"
}
] |
-| [`gen_ai.system_instructions`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | The system message or instructions provided to the GenAI model separately from the chat history. [16] | [
{
"type": "text",
"content": "You are an Agent that greet users, always use greetings tool to respond"
}
]; [
{
"type": "text",
"content": "You are a language translator."
},
{
"type": "text",
"content": "Your mission is to translate text in English to French."
}
] |
-| [`gen_ai.tool.definitions`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | The list of tool definitions available to the GenAI agent or model. [17] | [
{
"type": "function",
"name": "get_current_weather",
"description": "Get the current weather in a given location",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city and state, e.g. San Francisco, CA"
},
"unit": {
"type": "string",
"enum": [
"celsius",
"fahrenheit"
]
}
},
"required": [
"location",
"unit"
]
}
}
] |
+| [`gen_ai.usage.reasoning.output_tokens`](/docs/registry/attributes/gen-ai.md) |  | `Recommended` when applicable | int | The number of output tokens used for reasoning (e.g. chain-of-thought, extended thinking). [13] | `50` |
+| [`server.address`](/docs/registry/attributes/server.md) |  | `Recommended` | string | GenAI server address. [14] | `example.com`; `10.1.2.80`; `/tmp/my.sock` |
+| [`gen_ai.input.messages`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | The chat history provided to the model as an input. [15] | [
{
"role": "user",
"parts": [
{
"type": "text",
"content": "Weather in Paris?"
}
]
},
{
"role": "assistant",
"parts": [
{
"type": "tool_call",
"id": "call_VSPygqKTWdrhaFErNvMV18Yl",
"name": "get_weather",
"arguments": {
"location": "Paris"
}
}
]
},
{
"role": "tool",
"parts": [
{
"type": "tool_call_response",
"id": " call_VSPygqKTWdrhaFErNvMV18Yl",
"result": "rainy, 57°F"
}
]
}
] |
+| [`gen_ai.output.messages`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | Messages returned by the model where each message represents a specific model response (choice, candidate). [16] | [
{
"role": "assistant",
"parts": [
{
"type": "text",
"content": "The weather in Paris is currently rainy with a temperature of 57°F."
}
],
"finish_reason": "stop"
}
] |
+| [`gen_ai.system_instructions`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | The system message or instructions provided to the GenAI model separately from the chat history. [17] | [
{
"type": "text",
"content": "You are an Agent that greet users, always use greetings tool to respond"
}
]; [
{
"type": "text",
"content": "You are a language translator."
},
{
"type": "text",
"content": "Your mission is to translate text in English to French."
}
] |
+| [`gen_ai.tool.definitions`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | The list of tool definitions available to the GenAI agent or model. [18] | [
{
"type": "function",
"name": "get_current_weather",
"description": "Get the current weather in a given location",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city and state, e.g. San Francisco, CA"
},
"unit": {
"type": "string",
"enum": [
"celsius",
"fahrenheit"
]
}
},
"required": [
"location",
"unit"
]
}
}
] |
**[1] `gen_ai.operation.name`:** If one of the predefined values applies, but specific system uses a different name it's RECOMMENDED to document it in the semantic conventions for specific GenAI system and use system-specific name in the instrumentation. If a different name is not documented, instrumentation libraries SHOULD use applicable predefined value.
@@ -129,9 +130,11 @@ Instrumentations SHOULD make a best effort to populate this value, using a total
provided by the provider when available or, depending on the provider API,
by summing different token types parsed from the provider output.
-**[13] `server.address`:** When observed from the client side, and when communicating through an intermediary, `server.address` SHOULD represent the server address behind any intermediaries, for example proxies, if it's available.
+**[13] `gen_ai.usage.reasoning.output_tokens`:** The value SHOULD be included in `gen_ai.usage.output_tokens`.
-**[14] `gen_ai.input.messages`:** Instrumentations MUST follow [Input messages JSON schema](/docs/gen-ai/gen-ai-input-messages.json).
+**[14] `server.address`:** When observed from the client side, and when communicating through an intermediary, `server.address` SHOULD represent the server address behind any intermediaries, for example proxies, if it's available.
+
+**[15] `gen_ai.input.messages`:** Instrumentations MUST follow [Input messages JSON schema](/docs/gen-ai/gen-ai-input-messages.json).
When the attribute is recorded on events, it MUST be recorded in structured
form. When recorded on spans, it MAY be recorded as a JSON string if structured
format is not supported and SHOULD be recorded in structured form otherwise.
@@ -146,7 +149,7 @@ input messages.
See [Recording content on attributes](/docs/gen-ai/gen-ai-spans.md#recording-content-on-attributes)
section for more details.
-**[15] `gen_ai.output.messages`:** Instrumentations MUST follow [Output messages JSON schema](/docs/gen-ai/gen-ai-output-messages.json)
+**[16] `gen_ai.output.messages`:** Instrumentations MUST follow [Output messages JSON schema](/docs/gen-ai/gen-ai-output-messages.json)
Each message represents a single output choice/candidate generated by
the model. Each message corresponds to exactly one generation
@@ -166,7 +169,7 @@ output messages.
See [Recording content on attributes](/docs/gen-ai/gen-ai-spans.md#recording-content-on-attributes)
section for more details.
-**[16] `gen_ai.system_instructions`:** This attribute SHOULD be used when the corresponding provider or API
+**[17] `gen_ai.system_instructions`:** This attribute SHOULD be used when the corresponding provider or API
allows to provide system instructions or messages separately from the
chat history.
@@ -187,7 +190,7 @@ system instructions.
See [Recording content on attributes](/docs/gen-ai/gen-ai-spans.md#recording-content-on-attributes)
section for more details.
-**[17] `gen_ai.tool.definitions`:** Instrumentations MUST follow [Tool Definitions JSON Schema](/docs/gen-ai/gen-ai-tool-definitions.json).
+**[18] `gen_ai.tool.definitions`:** Instrumentations MUST follow [Tool Definitions JSON Schema](/docs/gen-ai/gen-ai-tool-definitions.json).
When the attribute is recorded on events, it MUST be recorded in structured
form. When recorded on spans, it MAY be recorded as a JSON string if structured
diff --git a/docs/gen-ai/gen-ai-spans.md b/docs/gen-ai/gen-ai-spans.md
index f84abc2f82..7c414d1aaa 100644
--- a/docs/gen-ai/gen-ai-spans.md
+++ b/docs/gen-ai/gen-ai-spans.md
@@ -95,11 +95,12 @@ client or when the GenAI call happens over instrumented protocol such as HTTP.
| [`gen_ai.usage.cache_read.input_tokens`](/docs/registry/attributes/gen-ai.md) |  | `Recommended` | int | The number of input tokens served from a provider-managed cache. [12] | `50` |
| [`gen_ai.usage.input_tokens`](/docs/registry/attributes/gen-ai.md) |  | `Recommended` | int | The number of tokens used in the GenAI input (prompt). [13] | `100` |
| [`gen_ai.usage.output_tokens`](/docs/registry/attributes/gen-ai.md) |  | `Recommended` | int | The number of tokens used in the GenAI response (completion). | `180` |
-| [`server.address`](/docs/registry/attributes/server.md) |  | `Recommended` | string | GenAI server address. [14] | `example.com`; `10.1.2.80`; `/tmp/my.sock` |
-| [`gen_ai.input.messages`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | The chat history provided to the model as an input. [15] | [
{
"role": "user",
"parts": [
{
"type": "text",
"content": "Weather in Paris?"
}
]
},
{
"role": "assistant",
"parts": [
{
"type": "tool_call",
"id": "call_VSPygqKTWdrhaFErNvMV18Yl",
"name": "get_weather",
"arguments": {
"location": "Paris"
}
}
]
},
{
"role": "tool",
"parts": [
{
"type": "tool_call_response",
"id": " call_VSPygqKTWdrhaFErNvMV18Yl",
"result": "rainy, 57°F"
}
]
}
] |
-| [`gen_ai.output.messages`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | Messages returned by the model where each message represents a specific model response (choice, candidate). [16] | [
{
"role": "assistant",
"parts": [
{
"type": "text",
"content": "The weather in Paris is currently rainy with a temperature of 57°F."
}
],
"finish_reason": "stop"
}
] |
-| [`gen_ai.system_instructions`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | The system message or instructions provided to the GenAI model separately from the chat history. [17] | [
{
"type": "text",
"content": "You are an Agent that greet users, always use greetings tool to respond"
}
]; [
{
"type": "text",
"content": "You are a language translator."
},
{
"type": "text",
"content": "Your mission is to translate text in English to French."
}
] |
-| [`gen_ai.tool.definitions`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | The list of tool definitions available to the GenAI agent or model. [18] | [
{
"type": "function",
"name": "get_current_weather",
"description": "Get the current weather in a given location",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city and state, e.g. San Francisco, CA"
},
"unit": {
"type": "string",
"enum": [
"celsius",
"fahrenheit"
]
}
},
"required": [
"location",
"unit"
]
}
}
] |
+| [`gen_ai.usage.reasoning.output_tokens`](/docs/registry/attributes/gen-ai.md) |  | `Recommended` when applicable | int | The number of output tokens used for reasoning (e.g. chain-of-thought, extended thinking). [14] | `50` |
+| [`server.address`](/docs/registry/attributes/server.md) |  | `Recommended` | string | GenAI server address. [15] | `example.com`; `10.1.2.80`; `/tmp/my.sock` |
+| [`gen_ai.input.messages`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | The chat history provided to the model as an input. [16] | [
{
"role": "user",
"parts": [
{
"type": "text",
"content": "Weather in Paris?"
}
]
},
{
"role": "assistant",
"parts": [
{
"type": "tool_call",
"id": "call_VSPygqKTWdrhaFErNvMV18Yl",
"name": "get_weather",
"arguments": {
"location": "Paris"
}
}
]
},
{
"role": "tool",
"parts": [
{
"type": "tool_call_response",
"id": " call_VSPygqKTWdrhaFErNvMV18Yl",
"result": "rainy, 57°F"
}
]
}
] |
+| [`gen_ai.output.messages`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | Messages returned by the model where each message represents a specific model response (choice, candidate). [17] | [
{
"role": "assistant",
"parts": [
{
"type": "text",
"content": "The weather in Paris is currently rainy with a temperature of 57°F."
}
],
"finish_reason": "stop"
}
] |
+| [`gen_ai.system_instructions`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | The system message or instructions provided to the GenAI model separately from the chat history. [18] | [
{
"type": "text",
"content": "You are an Agent that greet users, always use greetings tool to respond"
}
]; [
{
"type": "text",
"content": "You are a language translator."
},
{
"type": "text",
"content": "Your mission is to translate text in English to French."
}
] |
+| [`gen_ai.tool.definitions`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | The list of tool definitions available to the GenAI agent or model. [19] | [
{
"type": "function",
"name": "get_current_weather",
"description": "Get the current weather in a given location",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city and state, e.g. San Francisco, CA"
},
"unit": {
"type": "string",
"enum": [
"celsius",
"fahrenheit"
]
}
},
"required": [
"location",
"unit"
]
}
}
] |
**[1] `gen_ai.operation.name`:** If one of the predefined values applies, but specific system uses a different name it's RECOMMENDED to document it in the semantic conventions for specific GenAI system and use system-specific name in the instrumentation. If a different name is not documented, instrumentation libraries SHOULD use applicable predefined value.
@@ -162,9 +163,11 @@ Instrumentations SHOULD make a best effort to populate this value, using a total
provided by the provider when available or, depending on the provider API,
by summing different token types parsed from the provider output.
-**[14] `server.address`:** When observed from the client side, and when communicating through an intermediary, `server.address` SHOULD represent the server address behind any intermediaries, for example proxies, if it's available.
+**[14] `gen_ai.usage.reasoning.output_tokens`:** The value SHOULD be included in `gen_ai.usage.output_tokens`.
-**[15] `gen_ai.input.messages`:** Instrumentations MUST follow [Input messages JSON schema](/docs/gen-ai/gen-ai-input-messages.json).
+**[15] `server.address`:** When observed from the client side, and when communicating through an intermediary, `server.address` SHOULD represent the server address behind any intermediaries, for example proxies, if it's available.
+
+**[16] `gen_ai.input.messages`:** Instrumentations MUST follow [Input messages JSON schema](/docs/gen-ai/gen-ai-input-messages.json).
When the attribute is recorded on events, it MUST be recorded in structured
form. When recorded on spans, it MAY be recorded as a JSON string if structured
format is not supported and SHOULD be recorded in structured form otherwise.
@@ -179,7 +182,7 @@ input messages.
See [Recording content on attributes](/docs/gen-ai/gen-ai-spans.md#recording-content-on-attributes)
section for more details.
-**[16] `gen_ai.output.messages`:** Instrumentations MUST follow [Output messages JSON schema](/docs/gen-ai/gen-ai-output-messages.json)
+**[17] `gen_ai.output.messages`:** Instrumentations MUST follow [Output messages JSON schema](/docs/gen-ai/gen-ai-output-messages.json)
Each message represents a single output choice/candidate generated by
the model. Each message corresponds to exactly one generation
@@ -199,7 +202,7 @@ output messages.
See [Recording content on attributes](/docs/gen-ai/gen-ai-spans.md#recording-content-on-attributes)
section for more details.
-**[17] `gen_ai.system_instructions`:** This attribute SHOULD be used when the corresponding provider or API
+**[18] `gen_ai.system_instructions`:** This attribute SHOULD be used when the corresponding provider or API
allows to provide system instructions or messages separately from the
chat history.
@@ -220,7 +223,7 @@ system instructions.
See [Recording content on attributes](/docs/gen-ai/gen-ai-spans.md#recording-content-on-attributes)
section for more details.
-**[18] `gen_ai.tool.definitions`:** Instrumentations MUST follow [Tool Definitions JSON Schema](/docs/gen-ai/gen-ai-tool-definitions.json).
+**[19] `gen_ai.tool.definitions`:** Instrumentations MUST follow [Tool Definitions JSON Schema](/docs/gen-ai/gen-ai-tool-definitions.json).
When the attribute is recorded on events, it MUST be recorded in structured
form. When recorded on spans, it MAY be recorded as a JSON string if structured
@@ -286,9 +289,9 @@ and SHOULD be provided **at span creation time** (if provided at all):
| `azure.ai.openai` | [Azure OpenAI](https://learn.microsoft.com/en-us/azure/ai-services/openai/overview) |  |
| `cohere` | [Cohere](https://cohere.com/) |  |
| `deepseek` | [DeepSeek](https://www.deepseek.com/) |  |
-| `gcp.gemini` | [Gemini](https://cloud.google.com/products/gemini) [19] |  |
-| `gcp.gen_ai` | Any Google generative AI endpoint [20] |  |
-| `gcp.vertex_ai` | [Vertex AI](https://cloud.google.com/vertex-ai) [21] |  |
+| `gcp.gemini` | [Gemini](https://cloud.google.com/products/gemini) [20] |  |
+| `gcp.gen_ai` | Any Google generative AI endpoint [21] |  |
+| `gcp.vertex_ai` | [Vertex AI](https://cloud.google.com/vertex-ai) [22] |  |
| `groq` | [Groq](https://groq.com/) |  |
| `ibm.watsonx.ai` | [IBM Watsonx AI](https://www.ibm.com/products/watsonx-ai) |  |
| `mistral_ai` | [Mistral AI](https://mistral.ai/) |  |
@@ -296,11 +299,11 @@ and SHOULD be provided **at span creation time** (if provided at all):
| `perplexity` | [Perplexity](https://www.perplexity.ai/) |  |
| `x_ai` | [xAI](https://x.ai/) |  |
-**[19]:** Used when accessing the 'generativelanguage.googleapis.com' endpoint. Also known as the AI Studio API.
+**[20]:** Used when accessing the 'generativelanguage.googleapis.com' endpoint. Also known as the AI Studio API.
-**[20]:** May be used when specific backend is unknown.
+**[21]:** May be used when specific backend is unknown.
-**[21]:** Used when accessing the 'aiplatform.googleapis.com' endpoint.
+**[22]:** Used when accessing the 'aiplatform.googleapis.com' endpoint.
diff --git a/docs/gen-ai/openai.md b/docs/gen-ai/openai.md
index cddeda5a9f..6848fbb187 100644
--- a/docs/gen-ai/openai.md
+++ b/docs/gen-ai/openai.md
@@ -92,13 +92,14 @@ Semantic Conventions for [OpenAI](https://openai.com/) client spans extend and o
| [`gen_ai.usage.cache_read.input_tokens`](/docs/registry/attributes/gen-ai.md) |  | `Recommended` | int | The number of input tokens served from a provider-managed cache. [13] | `50` |
| [`gen_ai.usage.input_tokens`](/docs/registry/attributes/gen-ai.md) |  | `Recommended` | int | The number of tokens used in the GenAI input (prompt). [14] | `100` |
| [`gen_ai.usage.output_tokens`](/docs/registry/attributes/gen-ai.md) |  | `Recommended` | int | The number of tokens used in the GenAI response (completion). | `180` |
+| [`gen_ai.usage.reasoning.output_tokens`](/docs/registry/attributes/gen-ai.md) |  | `Recommended` when applicable | int | The number of output tokens used for reasoning (e.g. chain-of-thought, extended thinking). [15] | `50` |
| [`openai.api.type`](/docs/registry/attributes/openai.md) |  | `Recommended` | string | The type of OpenAI API being used. | `chat_completions`; `responses` |
| [`openai.response.system_fingerprint`](/docs/registry/attributes/openai.md) |  | `Recommended` | string | A fingerprint to track any eventual change in the Generative AI environment. | `fp_44709d6fcb` |
-| [`server.address`](/docs/registry/attributes/server.md) |  | `Recommended` | string | GenAI server address. [15] | `example.com`; `10.1.2.80`; `/tmp/my.sock` |
-| [`gen_ai.input.messages`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | The chat history provided to the model as an input. [16] | [
{
"role": "user",
"parts": [
{
"type": "text",
"content": "Weather in Paris?"
}
]
},
{
"role": "assistant",
"parts": [
{
"type": "tool_call",
"id": "call_VSPygqKTWdrhaFErNvMV18Yl",
"name": "get_weather",
"arguments": {
"location": "Paris"
}
}
]
},
{
"role": "tool",
"parts": [
{
"type": "tool_call_response",
"id": " call_VSPygqKTWdrhaFErNvMV18Yl",
"result": "rainy, 57°F"
}
]
}
] |
-| [`gen_ai.output.messages`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | Messages returned by the model where each message represents a specific model response (choice, candidate). [17] | [
{
"role": "assistant",
"parts": [
{
"type": "text",
"content": "The weather in Paris is currently rainy with a temperature of 57°F."
}
],
"finish_reason": "stop"
}
] |
-| [`gen_ai.system_instructions`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | The system message or instructions provided to the GenAI model separately from the chat history. [18] | [
{
"type": "text",
"content": "You are an Agent that greet users, always use greetings tool to respond"
}
]; [
{
"type": "text",
"content": "You are a language translator."
},
{
"type": "text",
"content": "Your mission is to translate text in English to French."
}
] |
-| [`gen_ai.tool.definitions`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | The list of tool definitions available to the GenAI agent or model. [19] | [
{
"type": "function",
"name": "get_current_weather",
"description": "Get the current weather in a given location",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city and state, e.g. San Francisco, CA"
},
"unit": {
"type": "string",
"enum": [
"celsius",
"fahrenheit"
]
}
},
"required": [
"location",
"unit"
]
}
}
] |
+| [`server.address`](/docs/registry/attributes/server.md) |  | `Recommended` | string | GenAI server address. [16] | `example.com`; `10.1.2.80`; `/tmp/my.sock` |
+| [`gen_ai.input.messages`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | The chat history provided to the model as an input. [17] | [
{
"role": "user",
"parts": [
{
"type": "text",
"content": "Weather in Paris?"
}
]
},
{
"role": "assistant",
"parts": [
{
"type": "tool_call",
"id": "call_VSPygqKTWdrhaFErNvMV18Yl",
"name": "get_weather",
"arguments": {
"location": "Paris"
}
}
]
},
{
"role": "tool",
"parts": [
{
"type": "tool_call_response",
"id": " call_VSPygqKTWdrhaFErNvMV18Yl",
"result": "rainy, 57°F"
}
]
}
] |
+| [`gen_ai.output.messages`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | Messages returned by the model where each message represents a specific model response (choice, candidate). [18] | [
{
"role": "assistant",
"parts": [
{
"type": "text",
"content": "The weather in Paris is currently rainy with a temperature of 57°F."
}
],
"finish_reason": "stop"
}
] |
+| [`gen_ai.system_instructions`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | The system message or instructions provided to the GenAI model separately from the chat history. [19] | [
{
"type": "text",
"content": "You are an Agent that greet users, always use greetings tool to respond"
}
]; [
{
"type": "text",
"content": "You are a language translator."
},
{
"type": "text",
"content": "Your mission is to translate text in English to French."
}
] |
+| [`gen_ai.tool.definitions`](/docs/registry/attributes/gen-ai.md) |  | `Opt-In` | any | The list of tool definitions available to the GenAI agent or model. [20] | [
{
"type": "function",
"name": "get_current_weather",
"description": "Get the current weather in a given location",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city and state, e.g. San Francisco, CA"
},
"unit": {
"type": "string",
"enum": [
"celsius",
"fahrenheit"
]
}
},
"required": [
"location",
"unit"
]
}
}
] |
**[1] `gen_ai.operation.name`:** If one of the predefined values applies, but specific system uses a different name it's RECOMMENDED to document it in the semantic conventions for specific GenAI system and use system-specific name in the instrumentation. If a different name is not documented, instrumentation libraries SHOULD use applicable predefined value.
@@ -153,9 +154,11 @@ Additional output format details may be recorded in the future in the
**[14] `gen_ai.usage.input_tokens`:** The total input token count is returned by `usage.input_tokens` or a similar property in the model response.
-**[15] `server.address`:** When observed from the client side, and when communicating through an intermediary, `server.address` SHOULD represent the server address behind any intermediaries, for example proxies, if it's available.
+**[15] `gen_ai.usage.reasoning.output_tokens`:** Corresponds to `usage.output_tokens_details.reasoning_tokens` in the model response.
-**[16] `gen_ai.input.messages`:** Instrumentations MUST follow [Input messages JSON schema](/docs/gen-ai/gen-ai-input-messages.json).
+**[16] `server.address`:** When observed from the client side, and when communicating through an intermediary, `server.address` SHOULD represent the server address behind any intermediaries, for example proxies, if it's available.
+
+**[17] `gen_ai.input.messages`:** Instrumentations MUST follow [Input messages JSON schema](/docs/gen-ai/gen-ai-input-messages.json).
When the attribute is recorded on events, it MUST be recorded in structured
form. When recorded on spans, it MAY be recorded as a JSON string if structured
format is not supported and SHOULD be recorded in structured form otherwise.
@@ -170,7 +173,7 @@ input messages.
See [Recording content on attributes](/docs/gen-ai/gen-ai-spans.md#recording-content-on-attributes)
section for more details.
-**[17] `gen_ai.output.messages`:** Instrumentations MUST follow [Output messages JSON schema](/docs/gen-ai/gen-ai-output-messages.json)
+**[18] `gen_ai.output.messages`:** Instrumentations MUST follow [Output messages JSON schema](/docs/gen-ai/gen-ai-output-messages.json)
Each message represents a single output choice/candidate generated by
the model. Each message corresponds to exactly one generation
@@ -190,7 +193,7 @@ output messages.
See [Recording content on attributes](/docs/gen-ai/gen-ai-spans.md#recording-content-on-attributes)
section for more details.
-**[18] `gen_ai.system_instructions`:** This attribute SHOULD be used when the corresponding provider or API
+**[19] `gen_ai.system_instructions`:** This attribute SHOULD be used when the corresponding provider or API
allows to provide system instructions or messages separately from the
chat history.
@@ -211,7 +214,7 @@ system instructions.
See [Recording content on attributes](/docs/gen-ai/gen-ai-spans.md#recording-content-on-attributes)
section for more details.
-**[19] `gen_ai.tool.definitions`:** Instrumentations MUST follow [Tool Definitions JSON Schema](/docs/gen-ai/gen-ai-tool-definitions.json).
+**[20] `gen_ai.tool.definitions`:** Instrumentations MUST follow [Tool Definitions JSON Schema](/docs/gen-ai/gen-ai-tool-definitions.json).
When the attribute is recorded on events, it MUST be recorded in structured
form. When recorded on spans, it MAY be recorded as a JSON string if structured
diff --git a/docs/registry/attributes/gen-ai.md b/docs/registry/attributes/gen-ai.md
index ff3af2372e..f59ad53271 100644
--- a/docs/registry/attributes/gen-ai.md
+++ b/docs/registry/attributes/gen-ai.md
@@ -63,7 +63,8 @@ This document defines the attributes used to describe telemetry in the context o
| `gen_ai.usage.cache_read.input_tokens` |  | int | The number of input tokens served from a provider-managed cache. [17] | `50` |
| `gen_ai.usage.input_tokens` |  | int | The number of tokens used in the GenAI input (prompt). [18] | `100` |
| `gen_ai.usage.output_tokens` |  | int | The number of tokens used in the GenAI response (completion). | `180` |
-| `gen_ai.workflow.name` |  | string | Human-readable name of the GenAI workflow provided by the application. [19] | `multi_agent_rag`; `customer_support_pipeline` |
+| `gen_ai.usage.reasoning.output_tokens` |  | int | The number of output tokens used for reasoning (e.g. chain-of-thought, extended thinking). [19] | `50` |
+| `gen_ai.workflow.name` |  | string | Human-readable name of the GenAI workflow provided by the application. [20] | `multi_agent_rag`; `customer_support_pipeline` |
**[1] `gen_ai.data_source.id`:** Data sources are used by AI agents and RAG applications to store grounding data. A data source may be an external database, object store, document collection, website, or any other storage system used by the GenAI agent or application. The `gen_ai.data_source.id` SHOULD match the identifier used by the GenAI system rather than a name specific to the external storage, such as a database or object store. Semantic conventions referencing `gen_ai.data_source.id` MAY also leverage additional attributes, such as `db.*`, to further identify and describe the data source.
@@ -208,7 +209,9 @@ Instrumentations SHOULD make a best effort to populate this value, using a total
provided by the provider when available or, depending on the provider API,
by summing different token types parsed from the provider output.
-**[19] `gen_ai.workflow.name`:** This attribute can be populated in different frameworks eg: name of the first chain in LangChain OR name of the crew in CrewAI.
+**[19] `gen_ai.usage.reasoning.output_tokens`:** The value SHOULD be included in `gen_ai.usage.output_tokens`.
+
+**[20] `gen_ai.workflow.name`:** This attribute can be populated in different frameworks eg: name of the first chain in LangChain OR name of the crew in CrewAI.
---
@@ -249,9 +252,9 @@ by summing different token types parsed from the provider output.
| `azure.ai.openai` | [Azure OpenAI](https://learn.microsoft.com/en-us/azure/ai-services/openai/overview) |  |
| `cohere` | [Cohere](https://cohere.com/) |  |
| `deepseek` | [DeepSeek](https://www.deepseek.com/) |  |
-| `gcp.gemini` | [Gemini](https://cloud.google.com/products/gemini) [20] |  |
-| `gcp.gen_ai` | Any Google generative AI endpoint [21] |  |
-| `gcp.vertex_ai` | [Vertex AI](https://cloud.google.com/vertex-ai) [22] |  |
+| `gcp.gemini` | [Gemini](https://cloud.google.com/products/gemini) [21] |  |
+| `gcp.gen_ai` | Any Google generative AI endpoint [22] |  |
+| `gcp.vertex_ai` | [Vertex AI](https://cloud.google.com/vertex-ai) [23] |  |
| `groq` | [Groq](https://groq.com/) |  |
| `ibm.watsonx.ai` | [IBM Watsonx AI](https://www.ibm.com/products/watsonx-ai) |  |
| `mistral_ai` | [Mistral AI](https://mistral.ai/) |  |
@@ -259,11 +262,11 @@ by summing different token types parsed from the provider output.
| `perplexity` | [Perplexity](https://www.perplexity.ai/) |  |
| `x_ai` | [xAI](https://x.ai/) |  |
-**[20]:** Used when accessing the 'generativelanguage.googleapis.com' endpoint. Also known as the AI Studio API.
+**[21]:** Used when accessing the 'generativelanguage.googleapis.com' endpoint. Also known as the AI Studio API.
-**[21]:** May be used when specific backend is unknown.
+**[22]:** May be used when specific backend is unknown.
-**[22]:** Used when accessing the 'aiplatform.googleapis.com' endpoint.
+**[23]:** Used when accessing the 'aiplatform.googleapis.com' endpoint.
---
@@ -300,9 +303,9 @@ Describes deprecated `gen_ai` attributes.
| `azure.ai.openai` | Azure OpenAI |  |
| `cohere` | Cohere |  |
| `deepseek` | DeepSeek |  |
-| `gcp.gemini` | Gemini [23] |  |
-| `gcp.gen_ai` | Any Google generative AI endpoint [24] |  |
-| `gcp.vertex_ai` | Vertex AI [25] |  |
+| `gcp.gemini` | Gemini [24] |  |
+| `gcp.gen_ai` | Any Google generative AI endpoint [25] |  |
+| `gcp.vertex_ai` | Vertex AI [26] |  |
| `groq` | Groq |  |
| `ibm.watsonx.ai` | IBM Watsonx AI |  |
| `mistral_ai` | Mistral AI |  |
@@ -310,11 +313,11 @@ Describes deprecated `gen_ai` attributes.
| `perplexity` | Perplexity |  |
| `xai` | xAI |  |
-**[23]:** This refers to the 'generativelanguage.googleapis.com' endpoint. Also known as the AI Studio API. May use common attributes prefixed with 'gcp.gen_ai.'.
+**[24]:** This refers to the 'generativelanguage.googleapis.com' endpoint. Also known as the AI Studio API. May use common attributes prefixed with 'gcp.gen_ai.'.
-**[24]:** May be used when specific backend is unknown. May use common attributes prefixed with 'gcp.gen_ai.'.
+**[25]:** May be used when specific backend is unknown. May use common attributes prefixed with 'gcp.gen_ai.'.
-**[25]:** This refers to the 'aiplatform.googleapis.com' endpoint. May use common attributes prefixed with 'gcp.gen_ai.'.
+**[26]:** This refers to the 'aiplatform.googleapis.com' endpoint. May use common attributes prefixed with 'gcp.gen_ai.'.
## Deprecated OpenAI GenAI Attributes
diff --git a/model/gen-ai/registry.yaml b/model/gen-ai/registry.yaml
index 6b9ffe4970..6125ec5d8a 100644
--- a/model/gen-ai/registry.yaml
+++ b/model/gen-ai/registry.yaml
@@ -218,6 +218,13 @@ groups:
type: int
brief: The number of tokens used in the GenAI response (completion).
examples: [180]
+ - id: gen_ai.usage.reasoning.output_tokens
+ stability: development
+ type: int
+ brief: The number of output tokens used for reasoning (e.g. chain-of-thought, extended thinking).
+ note: >
+ The value SHOULD be included in `gen_ai.usage.output_tokens`.
+ examples: [50]
- id: gen_ai.token.type
stability: development
type:
diff --git a/model/gen-ai/spans.yaml b/model/gen-ai/spans.yaml
index e8a00eaf84..5440de8381 100644
--- a/model/gen-ai/spans.yaml
+++ b/model/gen-ai/spans.yaml
@@ -89,6 +89,11 @@ groups:
requirement_level: recommended
- ref: gen_ai.usage.output_tokens
requirement_level: recommended
+ - ref: gen_ai.usage.reasoning.output_tokens
+ requirement_level:
+ recommended: when applicable
+ note: >
+ The value SHOULD be included in `gen_ai.usage.output_tokens`.
- ref: gen_ai.conversation.id
requirement_level:
conditionally_required: when available
@@ -200,6 +205,9 @@ groups:
- ref: gen_ai.usage.cache_read.input_tokens
note: >
Corresponds to `usage.input_tokens_details.cached_tokens` or a similar property in the model response.
+ - ref: gen_ai.usage.reasoning.output_tokens
+ note: >
+ Corresponds to `usage.output_tokens_details.reasoning_tokens` in the model response.
- ref: openai.request.service_tier
requirement_level:
conditionally_required: if the request includes a service_tier and the value is not 'auto'